diff options
| author | 2017-12-16 15:24:13 +0100 | |
|---|---|---|
| committer | 2017-12-16 15:24:13 +0100 | |
| commit | fdc9e0d75a786101a14f64bc418b48fdd1cb4890 (patch) | |
| tree | 9a7a1d523ab1279e2efce84d2d0c73dd0ad47c70 | |
| parent | f7560c585f211be41b093906e3a8fb5a6071c660 (diff) | |
| parent | ccb829418d25af49d129ac227b0cbd09c085b8a3 (diff) | |
Merge branch 'dev' into hebrew-i18n
423 files changed, 24019 insertions, 5285 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..7bfefd8ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,46 @@ +language: php +php: + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - hhvm + - nightly + +install: + # newest version without https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 + - pear install PHP_CodeSniffer-3.0.0RC4 + +script: + - phpenv rehash + - | + if [[ $VALIDATE_STANDARD == yes ]]; then + phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p + fi + - | + if [[ $CHECK_TRANSLATION == yes ]]; then + php cli/check.translation.php -r + fi + +env: + - CHECK_TRANSLATION=no VALIDATE_STANDARD=yes + +matrix: + fast_finish: true + include: + - php: "5.3" + dist: precise + - php: "7.1" + env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no + allow_failures: + # PHP 5.3 only runs on Ubuntu 12.04 (precise), not 14.04 (trusty) + - php: "5.3" + dist: precise + - php: "5.4" + - php: "5.5" + - php: "5.6" + - php: "7.0" + - php: hhvm + - php: nightly + - env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index d1b49d339..000000000 --- a/CHANGELOG +++ /dev/null @@ -1,425 +0,0 @@ -# Changelog - -## 2015-xx-xx FreshRSS 1.1.1 (beta) - -## 2015-01-31 FreshRSS 1.0.0 / 1.1.0 (beta) - -* UI - * Slider math with Dark theme - * Add a message if request failed for mark as read / favourite -* I18n - * Fix some sentences - * Add German as a supported language - * Add some indications on password format -* Bug fixing - * Some shortcuts was never saved - * Global view didn't work if set by default - * Minz_Error was badly raised - * Feed update failed if nothing had changed (MySQL only) - * CRON task failed with multiple users - * Tricky bug caused by cookie path - * Email sharing was badly supported (no urlencode()) -* Misc. - * Add a CREDIT file with contributor names - * Update lib_opml - * Default favicon is now served by HTTP code 200 - * Change calls to syslog by Minz_Log::notice - * HTTP credentials are no longer logged - - -## 2015-01-15 FreshRSS 0.9.4 (beta) - -* Feature - * Extension system (!!): some extensions are available at https://github.com/FreshRSS/Extensions -* Refactoring - * Front controller (FreshRSS class) - * Configuration system - * Sharing system - * New data files organization -* Updates - * Remove restriction of 1h for updates - * Show the current version of FreshRSS and the next one -* UI - * Remove the "sticky position" of the feed aside (moved into an extension) - * "Show password" shows the password only while the user is pressing the mouse. - - -## 2014-12-12 FreshRSS 0.9.3 (beta) - -* SimplePie - * Support for content-type application/x-rss+xml - * New force_feed option (for feeds sent with the wrong content-type / MIME) by adding #force_feed at the end of the feed URL - * Improved error messages -* Statistics - * Add information on feed repartition pages - * Add percent repartition for the bigger feeds -* UI - * New theme selector - * Update Screwdriver theme - * Add BlueLagoon theme by Mister aiR -* Misc. - * Add option to remove articles after reading them - * Add comments - * Refactor i18n system to not load unnecessary strings - * Fix security issue in Minz_Error::error() method - * Fix redirection after refreshing a given feed - - -## 2014-10-31 FreshRSS 0.9.2 (beta) - -* UI - * New subscription page (introduce .box items) - * Change feed category by drag and drop - * New feed aside on the main page - * New configuration / administration organization -* Configuration - * New options in config.php for cache duration, timeout, max inactivity, max number of feeds and categories per user. -* Refactoring - * Refactor authentication system (introduce FreshRSS_Auth model) - * Refactor indexController (introduce FreshRSS_Context model) - * Use ```_t()```, ```_i()```, ```_url()```, ```Minz_Request::good()``` and ```Minz_Request::bad()``` as much as possible - * Refactor javascript_vars.phtml - * Better coding style -* I18n - * Introduce a new system for i18n keys (not finished yet) -* Misc. - * Fix global view (didn't work anymore) - * Add do_post_update for update system - * Introduce ```checkInstallAction``` to test if FreshRSS installation is ok - - -## 2014-10-09 FreshRSS 0.8.1 / 0.9.1 (beta) - -* UI - * Add a space after tag icon -* Statistics - * Add an average per day on the 30 day period graph - * Add percent of total on top 10 feed -* Bug fixes - * Fix "mark as read" in global view - * Fix "read all" shortcut - * Fix categories not appearing when adding a new feed (GET action) - * Fix enclosure problem - * Fix getExtension() on PHP < 5.3.7 - - -## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) - -* UI - * New interface for statistics - * Fix filter buttons - * Number of articles divided by 2 in reading view - * Redesign of bigMarkAsRead -* Features - * New automatic update system - * New reset auth system -* Security - * "Mark as read" requires POST requests for several articles - * Test HTTP REFERER in install.php -* Configuration - * New "Show all articles" / "Show only unread" / "Adjust viewing" option - * New notification timeout option -* Misc. - * Improve coding style + comments - * Fix SQLite bug "ON DELETE CASCADE" - * Improve performance when importing articles - - -## 2014-08-24 FreshRSS 0.7.4 - -* UI - * Hide categories/feeds with unread articles when showing only unread articles - * Dynamic favicon showing the number of unread articles - * New theme: Screwdriver by Mister aiR -* Statistics - * New page with article repartition - * Improvements -* Security - * Basic protection against XSRF (Cross-Site Request Forgery) based on HTTP Referer (POST requests only) -* API - * Compatible with lighttpd -* Misc. - * Changed lazyload implementation - * Support of HTML5 notifications for new upcoming articles - * Add option to stay logged in -* Bux fixes in export function, add/remove users, keyboard shortcuts, etc. - - -## 2014-07-21 FreshRSS 0.7.3 - -* New options - * Add system of user queries which are shortcuts to filter the view - * New TTL option to limit the frequency at which feeds are refreshed (by cron or manual refresh button). - It is still possible to manually refresh an individual feed at a higher frequency. -* SQL - * Add support for SQLite (beta) in addition to MySQL -* SimplePie - * Complies with HTTP "301 Moved Permanently" responses by automatically updating the URL of feeds that have changed address. -* Themes - * Flat and Dark designs are based on same template file as Origine -* Statistics - * Refactor code - * Add an idle feed page -* Misc - * Several bug fixes - * Add confirmation option when marking all articles as read - * Fix some typo - - -## 2014-06-13 FreshRSS 0.7.2 - -* API compatible with Google Reader API level 2 - * FreshRSS can now be used from e.g.: - * (Android) News+ https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader - * (Android) EasyRSS https://github.com/Alkarex/EasyRSS -* Basic support for audio and video podcasts -* Searching - * New search filters date: and pubdate: accepting ISO 8601 date intervals such as `date:2013-2014` or `pubdate:P1W` - * Possibility to combine search filters, e.g. `date:2014-05 intitle:FreshRSS intitle:Open great reader #Internet` -* Change nav menu with more buttons instead of dropdown menus and add some filters -* New system of import / export - * Support OPML, Json (like Google Reader) and Zip archives - * Can export and import articles (specific option for favorites) -* Refactor "Origine" theme - * Some improvements - * Based on a template file (other themes will use it too) - - -## 2014-02-19 FreshRSS 0.7.1 - -* Mise à jour des flux plus rapide grâce à une meilleure utilisation du cache - * Utilisation d’une signature MD5 du contenu intéressant pour les flux n’implémentant pas les requêtes conditionnelles -* Modification des raccourcis - * "s" partage directement si un seul moyen de partage - * Moyens de partage accessibles par "1", "2", "3", etc. - * Premier article : Home ; Dernier article : End - * Ajout du déplacement au sein des catégories / flux (via modificateurs shift et alt) -* UI - * Séparation des descriptions des raccourcis par groupes - * Revue rapide de la page de connexion - * Amélioration de l'affichage des notifications sur mobile -* Revue du système de rafraîchissement des flux - * Meilleure gestion de la file de flux à rafraîchir en JSON - * Rafraîchissement uniquement pour les flux non rafraîchis récemment - * Possibilité donnée aux anonymes de rafraîchir les flux -* SimplePie - * Mise à jour de la lib - * Corrige fuite de mémoire - * Meilleure tolérance aux flux invalides -* Corrections divers - * Ne déplie plus l'article lors du clic sur l'icône lien externe - * Ne boucle plus à la fin de la navigation dans les articles - * Suppression du champ category.color inutile - * Corrige bug redirection infinie (Persona) - * Amélioration vérification de la requête POST - * Ajout d'un verrou lorsqu'une action mark_read ou mark_favorite est en cours - - -## 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 - - -## 2013-11-17 FreshRSS 0.6 - -* Nettoyage du code JavaScript + optimisations -* Utilisation d’adresses relatives -* Amélioration des performances coté client -* 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 -* 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) -* Correction bugs divers - - -## 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 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 -* Quelques retouches du design par défaut -* 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 -* 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 -* Correction bugs divers - - -## 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 -* Affichage des flux en erreur (injoignable par exemple) en rouge pour les différencier -* 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 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) -* 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) - - -## 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) -* Gestion des flux protégés par authentification HTTP -* Mise en cache des favicons -* 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 -* Correction bugs divers - - -## 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 -* Possibilité de vider une catégorie -* Possibilité de sélectionner les catégories en vue mobile -* Les flux peuvent être sortis du flux principal (système de priorité) -* Amélioration ajout / import / export des flux -* Amélioration actualisation (meilleure gestion des erreurs) -* Améliorations CSS -* Changements dans la base de données -* Màj de la librairie SimplePie -* Flux sans auteurs gérés normalement -* Correction bugs divers - - -## 2013-04-08 FreshRSS 0.1.0 - -* “Première” version diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..e4dbc63fb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,800 @@ +# Changelog + +## 2017-1X-XX FreshRSS 1.8.1-dev + +* API + * Breaking change / compatibility fix (EasyRSS): Provide `link` to articles without HTML-encoding [#1683](https://github.com/FreshRSS/FreshRSS/issues/1683) +* Features + * Share with Mastodon [#1521](https://github.com/FreshRSS/FreshRSS/issues/1521) +* UI + * Add more Unicode glyphs in the Open Sans font [#1032](https://github.com/FreshRSS/FreshRSS/pull/1032) + * Show URL to add subscriptions from third-party tools [#1247](https://github.com/FreshRSS/FreshRSS/issues/1247) + * Improved message when checking for new versions [#1586](https://github.com/FreshRSS/FreshRSS/issues/1586) +* SimplePie + * Remove "SimplePie" name from HTTP User-Agent string [#1656](https://github.com/FreshRSS/FreshRSS/pull/1656) +* Bug fixing + * Work-around for `CURLOPT_FOLLOWLOCATION` `open_basedir` bug in favicons and PubSubHubbub [#1655](https://github.com/FreshRSS/FreshRSS/issues/1655) + * Fix PDO PostgreSQL detection [#1690](https://github.com/FreshRSS/FreshRSS/issues/1690) + * Fix punycode warning in PHP 7.2 [#1699](https://github.com/FreshRSS/FreshRSS/issues/1699) +* CLI + * New command `./cli/db-optimize.php` for database optimisation [#1583](https://github.com/FreshRSS/FreshRSS/issues/1583) + * Check PHP requirements before running `actualize_script.php` (cron for refreshing feeds) [#1711](https://github.com/FreshRSS/FreshRSS/pull/1711) +* SQL + * Perform `VACUUM` on SQLite and PostgreSQL databases when optimisation is requested [#918](https://github.com/FreshRSS/FreshRSS/issues/918) +* I18n + * Improved German [#1698](https://github.com/FreshRSS/FreshRSS/pull/1698) +* Extensions + * Show existing extensions in admin panel [#1708](https://github.com/FreshRSS/FreshRSS/pull/1708) + * New function `$entry->_hash($hex)` for extensions that change the content of entries [#1707](https://github.com/FreshRSS/FreshRSS/pull/1707) +* Misc. + * Basic mechanism to limit the size of the logs [#1712](https://github.com/FreshRSS/FreshRSS/pull/1712) + * Translation validation tool [#1653](https://github.com/FreshRSS/FreshRSS/pull/1653) + * Translation manipulation tool [#1658](https://github.com/FreshRSS/FreshRSS/pull/1658) + + +## 2017-10-01 FreshRSS 1.8.0 + +* Compatibility + * Minimal PHP version increased to PHP 5.3.8+ to fix sanitize bug [#1604](https://github.com/FreshRSS/FreshRSS/issues/1604) + * Add support for PHP 7.1 in the API [#1584](https://github.com/FreshRSS/FreshRSS/issues/1584), [#1594](https://github.com/FreshRSS/FreshRSS/pull/1594) +* UI + * New page for subscription tools [#1534](https://github.com/FreshRSS/FreshRSS/issues/1354) + * Adjustments to the padding of the tree of categories and feeds [1589](https://github.com/FreshRSS/FreshRSS/pull/1589) + * Fix feed column position after lazy-loading images [#1616](https://github.com/FreshRSS/FreshRSS/pull/1616) + * Force UI controls for HTML5 video and audio [#1642](https://github.com/FreshRSS/FreshRSS/pull/1642) + * Fix share menu on small screens [#1645](https://github.com/FreshRSS/FreshRSS/pull/1645) + * Go back to previous view when collapsing article [#1177](https://github.com/FreshRSS/FreshRSS/issues/1177) +* CLI + * New command `./cli/update-user.php` to update user settings [#1600](https://github.com/FreshRSS/FreshRSS/issues/1600) +* I18n + * Korean [#1578](https://github.com/FreshRSS/FreshRSS/pull/1578) + * Portuguese (Brazilian) [#1648](https://github.com/FreshRSS/FreshRSS/pull/1648) + * Fix month abbreviations [#1560](https://github.com/FreshRSS/FreshRSS/issues/1560) +* Bug fixing + * Fix API compatibility bug between PostgreSQL and EasyRSS [#1603](https://github.com/FreshRSS/FreshRSS/pull/1603) + * Fix PostgreSQL error when adding entries with duplicated GUID [#1610](https://github.com/FreshRSS/FreshRSS/issues/1610), [#1614](https://github.com/FreshRSS/FreshRSS/issues/1614) + * Fix for RSS feeds containing HTML in author field [#1590](https://github.com/FreshRSS/FreshRSS/issues/1590) + * Fix logout issue in global view due to CSRF [#1591](https://github.com/FreshRSS/FreshRSS/issues/1591) +* Misc. + * Travis continuous integration [#1619](https://github.com/FreshRSS/FreshRSS/pull/1619) + * Allow longer database usernames [#1597](https://github.com/FreshRSS/FreshRSS/issues/1597) + + +## 2017-06-03 FreshRSS 1.7.0 + +* Features + * Deferred insertion of new articles, for better chronological order [#530](https://github.com/FreshRSS/FreshRSS/issues/530) + * Better search: + * Possibility to use multiple `intitle:`, `inurl:`, `author:` [#1478](https://github.com/FreshRSS/FreshRSS/pull/1478) + * Negative searches with `!` or `-` [#1381](https://github.com/FreshRSS/FreshRSS/issues/1381) + * Examples: `!intitle:unwanted`, `-intitle:unwanted`, `-inurl:unwanted`, `-author:unwanted`, `-#unwanted`, `-unwanted` + * Allow double-quotes, such as `author:"some name"`, in addition to single-quotes such as `author:'some name'` [#1478](https://github.com/FreshRSS/FreshRSS/pull/1478) + * Multi-user tokens (to access RSS outputs of any user) [#1390](https://github.com/FreshRSS/FreshRSS/issues/1390) +* Compatibility + * Add support for PHP 7.1 [#1471](https://github.com/FreshRSS/FreshRSS/issues/1471) + * PostgreSQL is not experimental anymore [#1476](https://github.com/FreshRSS/FreshRSS/pull/1476) +* Bug fixing + * Fix PubSubHubbub bugs when deleting users, and improved behaviour when removing feeds [#1495](https://github.com/FreshRSS/FreshRSS/pull/1495) + * Fix SQL uniqueness bug with PostgreSQL [#1476](https://github.com/FreshRSS/FreshRSS/pull/1476) + * (Require manual update for existing installations) + * Do not require PHP extension `fileinfo` for favicons [#1461](https://github.com/FreshRSS/FreshRSS/issues/1461) + * Fix UI lowest subscription popup hidden [#1479](https://github.com/FreshRSS/FreshRSS/issues/1479) + * Fix update system via ZIP archive [#1498](https://github.com/FreshRSS/FreshRSS/pull/1498) + * Work around for IE / Edge bug in username pattern in version 1.6.3 [#1511](https://github.com/FreshRSS/FreshRSS/issues/1511) + * Fix *mark as read* articles when adding a new feed [#1535](https://github.com/FreshRSS/FreshRSS/issues/1535) + * Change load order of CSS and JS to help CustomCSS and CustomJS extensions [Extensions#13](https://github.com/FreshRSS/Extensions/issues/13), [#1547](https://github.com/FreshRSS/FreshRSS/pull/1547) +* UI + * New option for not closing the article when clicking outside its area [#1539](https://github.com/FreshRSS/FreshRSS/pull/1539) + * Add shortcut in reader view to open the original page [#1564](https://github.com/FreshRSS/FreshRSS/pull/1564) + * Download icon 💾 for other MIME types (e.g. `application/*`) [#1522](https://github.com/FreshRSS/FreshRSS/pull/1522) +* I18n + * Simplified Chinese [#1541](https://github.com/FreshRSS/FreshRSS/pull/1541) + * Improve English [#1465](https://github.com/FreshRSS/FreshRSS/pull/1465) + * Improve Dutch [#1559](https://github.com/FreshRSS/FreshRSS/pull/1559) + * Added Spanish language [#1631] (https://github.com/FreshRSS/FreshRSS/pull/1631/) +* Security + * Do not require write access to check availability of new versions [#1450](https://github.com/FreshRSS/FreshRSS/issues/1450) +* Misc. + * Move [documentation](./docs/) into FreshRSS code [#1510](https://github.com/FreshRSS/FreshRSS/pull/1510) + * Moved `./data/force-https.default.txt` to `./force-https.default.txt`, + `./data/config.default.php` to `./config.default.php`, + and `./data/users/_/config.default.php` to `./config-user.default.php` [#1531](https://github.com/FreshRSS/FreshRSS/issues/1531) + * Fall back to article URL when the article GUID is empty [#1482](https://github.com/FreshRSS/FreshRSS/issues/1482) + * Rewritten Favicon library using cURL [#1504](https://github.com/FreshRSS/FreshRSS/pull/1504) + * Fix SimplePie option to disable syslog [#1528](https://github.com/FreshRSS/FreshRSS/pull/1528) + + +## 2017-03-11 FreshRSS 1.6.3 + +* Features + * New option `disable_update` (also from CLI) to hide the system to update to new FreshRSS versions [#1436](https://github.com/FreshRSS/FreshRSS/pull/1436) + * Share with Ⓚnown [#1420](https://github.com/FreshRSS/FreshRSS/pull/1420) + * Share with GNU social [#1422](https://github.com/FreshRSS/FreshRSS/issues/1422) +* UI + * New theme *Origine-compact* [#1388](https://github.com/FreshRSS/FreshRSS/pull/1388) + * Chrome parity with Firefox: auto-focus tab when clicking on notification [#1409](https://github.com/FreshRSS/FreshRSS/pull/1409) +* CLI + * New command `./cli/reconfigure.php` to update an existing installation [#1439](https://github.com/FreshRSS/FreshRSS/pull/1439) + * Many CLI improvements [#1447](https://github.com/FreshRSS/FreshRSS/pull/1447) + * More information (number of feeds, articles, etc.) in `./cli/user-info.php` + * Better idempotency of `./cli/do-install.php` and language parameter [#1449](https://github.com/FreshRSS/FreshRSS/issues/1449) +* Bug fixing + * Fix several CLI issues [#1445](https://github.com/FreshRSS/FreshRSS/issues/1445) + * Fix CLI install bugs with SQLite [#1443](https://github.com/FreshRSS/FreshRSS/issues/1443), [#1448](https://github.com/FreshRSS/FreshRSS/issues/1448) + * Allow empty strings in CLI do-install [#1435](https://github.com/FreshRSS/FreshRSS/pull/1435) + * Fix PostgreSQL bugs with API and feed modifications [#1417](https://github.com/FreshRSS/FreshRSS/pull/1417) + * Do not mark as read in anonymous mode [#1431](https://github.com/FreshRSS/FreshRSS/issues/1431) + * Fix Favicons warnings [#59dfc64](https://github.com/FreshRSS/FreshRSS/commit/59dfc64512372eaba7609d84500d943bb7274399), [#1452](https://github.com/FreshRSS/FreshRSS/pull/1452) +* Security + * Sanitize feed Web site URL [#1434](https://github.com/FreshRSS/FreshRSS/issues/1434) + * No version number for anonymous users [#1404](https://github.com/FreshRSS/FreshRSS/issues/1404) +* Misc. + * Relaxed requirements for username to `/^[0-9a-zA-Z]|[0-9a-zA-Z_]{2,38}$/` [#1423](https://github.com/FreshRSS/FreshRSS/pull/1423) + + +## 2016-12-26 FreshRSS 1.6.2 + +* Features + * Add git compatibility in Web update system [#1357](https://github.com/FreshRSS/FreshRSS/issues/1357) + * Requires that the initial installation is done with git + * New option `limits.cookie_duration` in `data/config.php` to set the login cookie duration [#1384](https://github.com/FreshRSS/FreshRSS/issues/1384) +* SQL + * More robust export function in the case of large datasets [#1372](https://github.com/FreshRSS/FreshRSS/issues/1372) +* CLI + * New command `./cli/user-info.php` to get some user information [#1345](https://github.com/FreshRSS/FreshRSS/issues/1345) +* Bug fixing + * Fix bug in estimating last user activity [#1358](https://github.com/FreshRSS/FreshRSS/issues/1358) + * PostgreSQL: fix bug when updating cached values [#1360](https://github.com/FreshRSS/FreshRSS/issues/1360) + * Fix bug in confirmation before marking as read [#1348](https://github.com/FreshRSS/FreshRSS/issues/1348) + * Fix small bugs in installer [#1363](https://github.com/FreshRSS/FreshRSS/pull/1363) + * Allow slash in database hostname, when using sockets [#1364](https://github.com/FreshRSS/FreshRSS/issues/1364) + * Add curl user-agent to retrieve favicons [#1380](https://github.com/FreshRSS/FreshRSS/issues/1380) + * Send login cookie only once [#1398](https://github.com/FreshRSS/FreshRSS/pull/1398) + * Add a check for PHP extension fileinfo [#1375](https://github.com/FreshRSS/FreshRSS/issues/1375) + + +## 2016-11-02 FreshRSS 1.6.1 + +* Bug fixing + * Fix regression introduced in 1.6.0 when refreshing articles with *Mark updated articles as unread* [#1349](https://github.com/FreshRSS/FreshRSS/issues/1349) + + +## 2016-10-30 FreshRSS 1.6.0 + +* CLI + * New Command-Line Interface (CLI) [#1095](https://github.com/FreshRSS/FreshRSS/issues/1095) + * Install, add/delete users, actualize, import/export. See [CLI documentation](./cli/README.md). +* API + * Support for editing feeds and categories from client applications [#1254](https://github.com/FreshRSS/FreshRSS/issues/1254) +* Compatibility: + * Support for PostgreSQL [#416](https://github.com/FreshRSS/FreshRSS/issues/416) + * New client supporting FreshRSS on Linux: FeedReader 2.0+ [#1252](https://github.com/FreshRSS/FreshRSS/issues/1252) +* Features + * Rework the “mark as read during scroll” option, enabled by default for new users [#1258](https://github.com/FreshRSS/FreshRSS/issues/1258), [#1309](https://github.com/FreshRSS/FreshRSS/pull/1309) + * Including a *keep unread* function [#1327](https://github.com/FreshRSS/FreshRSS/pull/1327) + * In a multi-user context, take better advantage of other users’ refreshes [#1280](https://github.com/FreshRSS/FreshRSS/pull/1280) + * Better control of number of entries per page or RSS feed [#1249](https://github.com/FreshRSS/FreshRSS/issues/1249) + * Since X hours: `https://freshrss.example/i/?a=rss&hours=3` + * Explicit number: `https://freshrss.example/i/?a=rss&nb=10` + * Limited by `min_posts_per_rss` and `max_posts_per_rss` in user config + * Support custom ports `localhost:3306` for database servers [#1241](https://github.com/FreshRSS/FreshRSS/issues/1241) + * Add date to exported files [#1240](https://github.com/FreshRSS/FreshRSS/issues/1240) + * Auto-refresh favicons once or twice a month [#1181](https://github.com/FreshRSS/FreshRSS/issues/1181), [#1298](https://github.com/FreshRSS/FreshRSS/issues/1298) + * Cron updates will also refresh favicons every 2 weeks [#1306](https://github.com/FreshRSS/FreshRSS/pull/1306) +* Bug fixing + * Correction of bugs related to CSRF tokens introduced in version 1.5.0 [#1253](https://github.com/FreshRSS/FreshRSS/issues/1253), [44f22ab](https://github.com/FreshRSS/FreshRSS/pull/1261/commits/d9bf9b2c6f0b2cc9dec3b638841b7e3040dcf46f) + * Fix bug in Global view introduced in version 1.5.0 [#1269](https://github.com/FreshRSS/FreshRSS/pull/1269) + * Fix sharing bug [#1289](https://github.com/FreshRSS/FreshRSS/issues/1289) + * Fix bug in auto-loading more articles after marking an article as un-read [#1318](https://github.com/FreshRSS/FreshRSS/issues/1318) + * Fix bug during import of favourites [#1315](https://github.com/FreshRSS/FreshRSS/pull/1315), [#1312](https://github.com/FreshRSS/FreshRSS/issues/1312) + * Fix bug not respecting language option for new users [#1273](https://github.com/FreshRSS/FreshRSS/issues/1273) + * Bug in example of URL for FreshRSS RSS output with token [#1274](https://github.com/FreshRSS/FreshRSS/issues/1274) +* Security + * Prevent `<a target="_blank">` attacks with `window.opener` [#1245](https://github.com/FreshRSS/FreshRSS/issues/1245) + * Updated gitignore rules to keep user directories during a `git clean -f -d` [#1307](https://github.com/FreshRSS/FreshRSS/pull/1307) +* Extensions + * Allow extensions for default account in anonymous mode [#1288](https://github.com/FreshRSS/FreshRSS/pull/1288) + * Trigger a `freshrss:load-more` JavaScript event to help extensions [#1278](https://github.com/FreshRSS/FreshRSS/issues/1278) +* SQL + * Slightly modified several SQL requests (MySQL, SQLite) to simplify support of PostgreSQL [#1195](https://github.com/FreshRSS/FreshRSS/pull/1195) + * Increase performances by removing a superfluous category request [#1316](https://github.com/FreshRSS/FreshRSS/pull/1316) +* I18n + * Fix some messages during installation [#1339](https://github.com/FreshRSS/FreshRSS/pull/1339) +* UI + * Fix CSS line-height bug with `<sup>` in dates (English, Russian, Turkish) [#1340](https://github.com/FreshRSS/FreshRSS/pull/1340) + * Disable *Mark all as read* before confirmation script is loaded [#1342](https://github.com/FreshRSS/FreshRSS/issues/1342) + * Download icon 💾 for podcasts [#1236](https://github.com/FreshRSS/FreshRSS/issues/1236) +* SimplePie + * Fix auto-discovery of RSS feeds in Web pages served as `text/xml` [#1264](https://github.com/FreshRSS/FreshRSS/issues/1264) +* Misc. + * Removed *resource-priorities* attributes (`defer`, `lazyload`), deprecated by W3C [#1222](https://github.com/FreshRSS/FreshRSS/pull/1222) + + +## 2016-08-29 FreshRSS 1.5.0 + +* Compatibility + * Require at least MySQL 5.5.3+ [#1153](https://github.com/FreshRSS/FreshRSS/issues/1153) + * Require at least PHP 5.3.3+ [#1183](https://github.com/FreshRSS/FreshRSS/pull/1183) + * Restore compatibility with PHP 5.3.3 [#1208](https://github.com/FreshRSS/FreshRSS/issues/1208) + * Restore compatibility with Microsoft Internet Explorer 11 / Edge [#772](https://github.com/FreshRSS/FreshRSS/issues/772) +* Features + * Mark a search as read [#608](https://github.com/FreshRSS/FreshRSS/issues/608) + * Support for full Unicode such as emoji 💕 in MySQL with utf8mb4 [#1153](https://github.com/FreshRSS/FreshRSS/issues/1153) + * FreshRSS will automatically migrate MySQL tables to utf8mb4 the first time it is needed. +* Security + * Remove Mozilla Persona login (the service closes on 2016-11-30) [#1052](https://github.com/FreshRSS/FreshRSS/issues/1052) + * Use Referrer Policy `<meta name="referrer" content="never" />` for anonymizing HTTP Referer [#955](https://github.com/FreshRSS/FreshRSS/issues/955) + * Implement CSRF tokens for POST security [#570](https://github.com/FreshRSS/FreshRSS/issues/570) +* Bug fixing + * Fixed scroll in log view [#1178](https://github.com/FreshRSS/FreshRSS/issues/1178) + * Fixed JavaScript bug when articles were not always marked as read [#1123](https://github.com/FreshRSS/FreshRSS/issues/1123) + * Fixed Apache Etag issue that prevented caching [#1199](https://github.com/FreshRSS/FreshRSS/pull/1199) + * Fixed OPML import of categories [#1202](https://github.com/FreshRSS/FreshRSS/issues/1202) + * Fixed PubSubHubbub callback address bug on some configurations [1229](https://github.com/FreshRSS/FreshRSS/pull/1229) +* UI + * Use sticky category column [#1172](https://github.com/FreshRSS/FreshRSS/pull/1172) + * Updated to jQuery 3.1.0 and several JavaScript fixes (e.g. drag & drop) [#1197](https://github.com/FreshRSS/FreshRSS/pull/1197) +* API + * Add API link in FreshRSS profile settings to ease set-up [#1186](https://github.com/FreshRSS/FreshRSS/pull/1186) +* Misc. + * Work-around for SuperFeeder time-outs during PubSubHubbub registration [#1184](https://github.com/FreshRSS/FreshRSS/pull/1184) + * JSHint of JavaScript code and better initialisation [#1196](https://github.com/FreshRSS/FreshRSS/pull/1196) + * Updated credits, and images in README [#1201](https://github.com/FreshRSS/FreshRSS/issues/1201) + + +## 2016-07-23 FreshRSS 1.4.0 +## 2016-06-12 FreshRSS 1.3.2-beta + +* Compatibility + * Require at least PHP 5.3+ (drop PHP 5.2) [#1133](https://github.com/FreshRSS/FreshRSS/pull/1133) +* Features + * Support for MySQL 5.7+ (e.g. Ubuntu 16.04 LTS) [#1132](https://github.com/FreshRSS/FreshRSS/pull/1132) + * Speed optimization for HTTP/2 [#1133](https://github.com/FreshRSS/FreshRSS/pull/1133) + * API support for REDIRECT_* HTTP headers (fcgi) [#1128](https://github.com/FreshRSS/FreshRSS/issues/1128) +* SimplePie + * Support for feeds with invalid whitespace [#1142](https://github.com/FreshRSS/FreshRSS/issues/1142) +* Bug fixing + * Fix bug when adding feeds with passwords [#1137](https://github.com/FreshRSS/FreshRSS/pull/1137) + * Fix validator link [#1147](https://github.com/FreshRSS/FreshRSS/pull/1147) + * Fix Favicon small bugs [#1135](https://github.com/FreshRSS/FreshRSS/pull/1135) +* Security + * CSP compatibility for homepage [#1120](https://github.com/FreshRSS/FreshRSS/pull/1120) +* I18n + * Draft of Russian [#1085](https://github.com/FreshRSS/FreshRSS/pull/1085) +* Misc. + * Change default feed timeout to 15 seconds [#1146](https://github.com/FreshRSS/FreshRSS/pull/1146) + * Updated Wallabag v2 [#1150](https://github.com/FreshRSS/FreshRSS/pull/1150) + + +## 2016-03-11 FreshRSS 1.3.1-beta + +* Security + * Added CSP `Content-Security-Policy: default-src 'self'; child-src *; frame-src *; img-src * data:; media-src *` [#1075](https://github.com/FreshRSS/FreshRSS/issues/1075), [#1114](https://github.com/FreshRSS/FreshRSS/issues/1114) + * Added `X-Content-Type-Options: nosniff` [#1116](https://github.com/FreshRSS/FreshRSS/pull/1116) + * Cookie with `Secure` tag when used over HTTPS [#1117](https://github.com/FreshRSS/FreshRSS/pull/1117) + * Limit API post input to 1MB [#1118](https://github.com/FreshRSS/FreshRSS/pull/1118) +* Features + * New list of domains for which to force HTTPS (for images, videos, iframes…) defined in `./data/force-https.default.txt` and `./data/force-https.txt` [#1083](https://github.com/FreshRSS/FreshRSS/issues/1083) + * In particular useful for privacy and to avoid mixed content errors, e.g. to see YouTube videos when FreshRSS is in HTTPS + * Add sharing with “Journal du Hacker” [#1056](https://github.com/FreshRSS/FreshRSS/pull/1056) +* UI + * Updated to jQuery 2.2.1 and changed code for auto-load on scroll [#1050](https://github.com/FreshRSS/FreshRSS/pull/1050), [#1091](https://github.com/FreshRSS/FreshRSS/pull/1091) +* I18n + * Turkish [#1073](https://github.com/FreshRSS/FreshRSS/issues/1073) +* Bug fixing + * Fixed OPML import title bug [#1048](https://github.com/FreshRSS/FreshRSS/issues/1048) + * Fixed upgrade bug with SQLite when articles were marked as unread [#1049](https://github.com/FreshRSS/FreshRSS/issues/1049) + * Fixed error when deleting feeds from statistics page [#1047](https://github.com/FreshRSS/FreshRSS/issues/1047) + * Fixed several small bugs in global and reader view [#1050](https://github.com/FreshRSS/FreshRSS/pull/1050) + * Fixed sharing bug with PHP7 [#1072](https://github.com/FreshRSS/FreshRSS/issues/1072) + * Fixed fall-back when php-json is not installed [#1092](https://github.com/FreshRSS/FreshRSS/issues/1092) +* API + * Possibility to show only read items [#1035](https://github.com/FreshRSS/FreshRSS/pull/1035) +* Misc. + * Filters `<img />` attributes `srcset` and `sizes` [#1077](https://github.com/FreshRSS/FreshRSS/issues/1077), [#1086](https://github.com/FreshRSS/FreshRSS/pull/1086) + * Implement PubSubHubbub unsubscribe responses [#1058](https://github.com/FreshRSS/FreshRSS/issues/1058) + * Restored some compatibility with PHP 5.2 [#1055](https://github.com/FreshRSS/FreshRSS/issues/1055) + * Check for extension php-xml during install [#1094](https://github.com/FreshRSS/FreshRSS/issues/1094) + * Updated the sharing with Movim [#1030](https://github.com/FreshRSS/FreshRSS/pull/1030) + + +## 2015-11-03 FreshRSS 1.2.0 / 1.3.0-beta + +* Features + * Share with Movim [#992](https://github.com/FreshRSS/FreshRSS/issues/992) + * New option to allow robots / search engines [#938](https://github.com/FreshRSS/FreshRSS/issues/938) +* Security + * Invalid logins now return HTTP 403, to be easier to catch (e.g. fail2ban) [#1015](https://github.com/FreshRSS/FreshRSS/issues/1015) +* UI + * Remove "title" field during installation [#858](https://github.com/FreshRSS/FreshRSS/issues/858) + * Visual alert on categories containing feeds in error [#984](https://github.com/FreshRSS/FreshRSS/pull/984) +* I18n + * Italian [#1003](https://github.com/FreshRSS/FreshRSS/issues/1003) +* Misc. + * Support reverse proxy [#975](https://github.com/FreshRSS/FreshRSS/issues/975) + * Make auto-update server URL alterable [#1019](https://github.com/FreshRSS/FreshRSS/issues/1019) + + +## 2015-09-12 FreshRSS 1.1.3-beta + +* UI + * Configuration page for global settings such as limits [#958](https://github.com/FreshRSS/FreshRSS/pull/958) + * Add feed ID in articles to ease styling [#953](https://github.com/FreshRSS/FreshRSS/issues/953) +* I18n + * Dutch [#949](https://github.com/FreshRSS/FreshRSS/issues/949) +* Bug fixing + * Session cookie bug [#924](https://github.com/FreshRSS/FreshRSS/issues/924) + * Better error handling for PubSubHubbub [#939](https://github.com/FreshRSS/FreshRSS/issues/939) + * Fix tag search link from articles [#970](https://github.com/FreshRSS/FreshRSS/issues/970) + * Fix all queries deleted when deleting a feed or category [#982](https://github.com/FreshRSS/FreshRSS/pull/982) + + +## 2015-07-30 FreshRSS 1.1.2-beta + +* Features + * Support for PubSubHubbub for instant notifications from compatible Web sites. [#312](https://github.com/FreshRSS/FreshRSS/issues/312) + * cURL options to use a proxy for retrieving feeds. [#897](https://github.com/FreshRSS/FreshRSS/issues/897) [#675](https://github.com/FreshRSS/FreshRSS/issues/675) + * Allow anonymous users to create an account. [#679](https://github.com/FreshRSS/FreshRSS/issues/679) +* Security + * cURL options to verify or not SSL/TLS certificates (now enabled by default). [#897](https://github.com/FreshRSS/FreshRSS/issues/897) [#502](https://github.com/FreshRSS/FreshRSS/issues/502) + * Support for SSL connection to MySQL. [#868](https://github.com/FreshRSS/FreshRSS/issues/868) + * Workaround for browsers that have disabled support for `<form autocomplete="off">`. [#880](https://github.com/FreshRSS/FreshRSS/issues/880) +* UI + * Force UTF-8 for responses. [#870](https://github.com/FreshRSS/FreshRSS/issues/870) + * Increased pagination limit to 500 articles. [#872](https://github.com/FreshRSS/FreshRSS/issues/872) + * Improved UI for installation. [#855](https://github.com/FreshRSS/FreshRSS/issues/855) +* Misc. + * PHP 7 officially supported (~70% speed improvements on early tests). [#889](https://github.com/FreshRSS/FreshRSS/issues/889) + * Restore support for PHP 5.2.1+. [#214a5cc](https://github.com/Alkarex/FreshRSS/commit/214a5cc9a4c2b821961bc21f22b4b08e34b5be68) [#894](https://github.com/FreshRSS/FreshRSS/issues/894) + * Support for data-src for images of articles retrieved via the full-content module. [#877](https://github.com/FreshRSS/FreshRSS/issues/877) + * Add a couple of default feeds for fresh installations. [#886](https://github.com/FreshRSS/FreshRSS/issues/886) + * Changed some log visibilities. [#885](https://github.com/FreshRSS/FreshRSS/issues/885) + * Fix broken links for extension script / style files. [#862](https://github.com/FreshRSS/FreshRSS/issues/862) + * Load default configuration during installation to avoid hard-coded values. [#890](https://github.com/FreshRSS/FreshRSS/issues/890) + * Fix non-consistent behaviour in Minz_Request::getBaseUrl() and introduce Minz_Request::guessBaseUrl(). [#906](https://github.com/FreshRSS/FreshRSS/issues/906) + * Generate `base_url` during the installation and add a `pubsubhubbub_enabled` configuration key. [#865](https://github.com/FreshRSS/FreshRSS/issues/865) + * Load configuration by recursion to overwrite array values. [#923](https://github.com/FreshRSS/FreshRSS/issues/923) + * Cast `$limits` configuration values in integer. [#925](https://github.com/FreshRSS/FreshRSS/issues/925) + * Don't hide errors in configuration. [#920](https://github.com/FreshRSS/FreshRSS/issues/920) + + +## 2015-05-31 FreshRSS 1.1.1 (beta) + +* Features + * New option to detect and mark updated articles as unread. + * Support for internationalized domain name (IDN). + * Improved logic for automatic deletion of old articles. +* API + * Work-around for News+ bug when there is no unread article on the server. +* UI + * New confirmation message when leaving a configuration page without saving the changes. +* Bug fixing + * Corrected bug introduced in previous beta about handling of HTTP 301 (feeds that have changed address) + * Corrected bug in FreshRSS RSS feeds. +* Security + * Sanitize HTTP request header `Host`. +* Misc. + * Attempt to better handle encoded article titles. + + +## 2015-01-31 FreshRSS 1.0.0 / 1.1.0 (beta) + +* UI + * Slider math with Dark theme + * Add a message if request failed for mark as read / favourite +* I18n + * Fix some sentences + * Add German as a supported language + * Add some indications on password format +* Bug fixing + * Some shortcuts was never saved + * Global view didn't work if set by default + * Minz_Error was badly raised + * Feed update failed if nothing had changed (MySQL only) + * CRON task failed with multiple users + * Tricky bug caused by cookie path + * Email sharing was badly supported (no urlencode()) +* Misc. + * Add a CREDIT file with contributor names + * Update lib_opml + * Default favicon is now served by HTTP code 200 + * Change calls to syslog by Minz_Log::notice + * HTTP credentials are no longer logged + + +## 2015-01-15 FreshRSS 0.9.4 (beta) + +* Feature + * Extension system (!!): some extensions are available at https://github.com/FreshRSS/Extensions +* Refactoring + * Front controller (FreshRSS class) + * Configuration system + * Sharing system + * New data files organization +* Updates + * Remove restriction of 1h for updates + * Show the current version of FreshRSS and the next one +* UI + * Remove the "sticky position" of the feed aside (moved into an extension) + * "Show password" shows the password only while the user is pressing the mouse. + + +## 2014-12-12 FreshRSS 0.9.3 (beta) + +* SimplePie + * Support for content-type application/x-rss+xml + * New force_feed option (for feeds sent with the wrong content-type / MIME) by adding #force_feed at the end of the feed URL + * Improved error messages +* Statistics + * Add information on feed repartition pages + * Add percent repartition for the bigger feeds +* UI + * New theme selector + * Update Screwdriver theme + * Add BlueLagoon theme by Mister aiR +* Misc. + * Add option to remove articles after reading them + * Add comments + * Refactor i18n system to avoid loading unnecessary strings + * Fix security issue in Minz_Error::error() method + * Fix redirection after refreshing a given feed + + +## 2014-10-31 FreshRSS 0.9.2 (beta) + +* UI + * New subscription page (introduce .box items) + * Change feed category by drag and drop + * New feed aside on the main page + * New configuration / administration organization +* Configuration + * New options in config.php for cache duration, timeout, max inactivity, max number of feeds and categories per user. +* Refactoring + * Refactor authentication system (introduce FreshRSS_Auth model) + * Refactor indexController (introduce FreshRSS_Context model) + * Use ```_t()```, ```_i()```, ```_url()```, ```Minz_Request::good()``` and ```Minz_Request::bad()``` as much as possible + * Refactor javascript_vars.phtml + * Better coding style +* I18n + * Introduce a new system for i18n keys (not finished yet) +* Misc. + * Fix global view (did not work anymore) + * Add do_post_update for update system + * Introduce ```checkInstallAction``` to test if FreshRSS installation is ok + + +## 2014-10-09 FreshRSS 0.8.1 / 0.9.1 (beta) + +* UI + * Add a space after tag icon +* Statistics + * Add an average per day on the 30-day period graph + * Add percent of total on top 10 feed +* Bug fixes + * Fix "mark as read" in global view + * Fix "read all" shortcut + * Fix categories not appearing when adding a new feed (GET action) + * Fix enclosure problem + * Fix getExtension() on PHP < 5.3.7 + + +## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) + +* UI + * New interface for statistics + * Fix filter buttons + * Number of articles divided by 2 in reading view + * Redesign of bigMarkAsRead +* Features + * New automatic update system + * New reset auth system +* Security + * "Mark as read" requires POST requests for several articles + * Test HTTP REFERER in install.php +* Configuration + * New "Show all articles" / "Show only unread" / "Adjust viewing" option + * New notification timeout option +* Misc. + * Improve coding style + comments + * Fix SQLite bug "ON DELETE CASCADE" + * Improve performance when importing articles + + +## 2014-08-24 FreshRSS 0.7.4 + +* UI + * Hide categories/feeds with unread articles when showing only unread articles + * Dynamic favicon showing the number of unread articles + * New theme: Screwdriver by Mister aiR +* Statistics + * New page with article repartition + * Improvements +* Security + * Basic protection against XSRF (Cross-Site Request Forgery) based on HTTP Referer (POST requests only) +* API + * Compatible with lighttpd +* Misc. + * Changed lazyload implementation + * Support of HTML5 notifications for new upcoming articles + * Add option to stay logged in +* Bug fixes in export function, add/remove users, keyboard shortcuts, etc. + + +## 2014-07-21 FreshRSS 0.7.3 + +* New options + * Add system of user queries which are shortcuts to filter the view + * New TTL option to limit the frequency at which feeds are refreshed (by cron or manual refresh button). + It is still possible to manually refresh an individual feed at a higher frequency. +* SQL + * Add support for SQLite (beta) in addition to MySQL +* SimplePie + * Complies with HTTP "301 Moved Permanently" responses by automatically updating the URL of feeds that have changed address. +* Themes + * Flat and Dark designs are based on same template file as Origine +* Statistics + * Refactor code + * Add an idle feed page +* Misc + * Several bug fixes + * Add confirmation option when marking all articles as read + * Fix some typo + + +## 2014-06-13 FreshRSS 0.7.2 + +* API compatible with Google Reader API level 2 + * FreshRSS can now be used from e.g.: + * (Android) News+ https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader + * (Android) EasyRSS https://github.com/Alkarex/EasyRSS +* Basic support for audio and video podcasts +* Searching + * New search filters date: and pubdate: accepting ISO 8601 date intervals such as `date:2013-2014` or `pubdate:P1W` + * Possibility to combine search filters, e.g. `date:2014-05 intitle:FreshRSS intitle:Open great reader #Internet` +* Change nav menu with more buttons instead of dropdown menus and add some filters +* New system of import / export + * Support OPML, Json (like Google Reader) and ZIP archives + * Can export and import articles (specific option for favorites) +* Refactor "Origine" theme + * Some improvements + * Based on a template file (other themes will use it too) + + +## 2014-02-19 FreshRSS 0.7.1 + +* Mise à jour des flux plus rapide grâce à une meilleure utilisation du cache + * Utilisation d’une signature MD5 du contenu intéressant pour les flux n’implémentant pas les requêtes conditionnelles +* Modification des raccourcis + * "s" partage directement si un seul moyen de partage + * Moyens de partage accessibles par "1", "2", "3", etc. + * Premier article : Home ; Dernier article : End + * Ajout du déplacement au sein des catégories / flux (via modificateurs shift et alt) +* UI + * Séparation des descriptions des raccourcis par groupes + * Revue rapide de la page de connexion + * Amélioration de l'affichage des notifications sur mobile +* Revue du système de rafraîchissement des flux + * Meilleure gestion de la file de flux à rafraîchir en JSON + * Rafraîchissement uniquement pour les flux non rafraîchis récemment + * Possibilité donnée aux anonymes de rafraîchir les flux +* SimplePie + * Mise à jour de la lib + * Corrige fuite de mémoire + * Meilleure tolérance aux flux invalides +* Corrections divers + * Ne déplie plus l'article lors du clic sur l'icône lien externe + * Ne boucle plus à la fin de la navigation dans les articles + * Suppression du champ category.color inutile + * Corrige bug redirection infinie (Persona) + * Amélioration vérification de la requête POST + * Ajout d'un verrou lorsqu'une action mark_read ou mark_favorite est en cours + + +## 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 + + +## 2013-11-17 FreshRSS 0.6 + +* Nettoyage du code JavaScript + optimisations +* Utilisation d’adresses relatives +* Amélioration des performances coté client +* 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 +* 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) +* Correction bugs divers + + +## 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 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 +* Quelques retouches du design par défaut +* 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 +* 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 +* Correction bugs divers + + +## 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 +* Affichage des flux en erreur (injoignable par exemple) en rouge pour les différencier +* 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 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) +* 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) + + +## 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) +* Gestion des flux protégés par authentification HTTP +* Mise en cache des favicons +* 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 +* Correction bugs divers + + +## 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 +* Possibilité de vider une catégorie +* Possibilité de sélectionner les catégories en vue mobile +* Les flux peuvent être sortis du flux principal (système de priorité) +* Amélioration ajout / import / export des flux +* Amélioration actualisation (meilleure gestion des erreurs) +* Améliorations CSS +* Changements dans la base de données +* Màj de la librairie SimplePie +* Flux sans auteurs gérés normalement +* Correction bugs divers + + +## 2013-04-08 FreshRSS 0.1.0 + +* “Première” version diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..133813711 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +# How to contribute to FreshRSS? + +## Join us on the mailing lists + +Do you want to ask us some questions? Do you want to discuss with us? Don't hesitate to subscribe to our mailing lists! + +- The first mailing is destined to generic information, it should be adapted to users. [Join mailing@freshrss.org](https://freshrss.org/mailman/listinfo/mailing). +- The second mailing is mainly for developers. [Join dev@freshrss.org](https://freshrss.org/mailman/listinfo/dev) + +## Report a bug + +You found a bug? Don't panic, here are some steps to report it easily: + +1. Search for it on [the bug tracker](https://github.com/FreshRSS/FreshRSS/issues) (don't forget to use the search bar). +2. If you find a similar bug, don't hesitate to post a comment to add more importance to the related ticket. +3. If you didn't find it, [open a new ticket](https://github.com/FreshRSS/FreshRSS/issues/new). + +If you have to create a new ticket, try to apply the following advices: + +- Give an explicit title to the ticket so it will be easier to find it later. +- Be as exhaustive as possible in the description: what did you do? What is the bug? What are the steps to reproduce the bug? +- We also need some information: + + Your FreshRSS version (on about page or `constants.php` file) + + Your server configuration: type of hosting, PHP version + + Your storage system (MySQL / MariaDB or SQLite) + + If possible, the related logs (PHP logs and FreshRSS logs under `data/users/your_user/log.txt`) + +## Fix a bug + +Did you want to fix a bug? To keep a great coordination between collaborators, you will have to follow these indications: + +1. Be sure the bug is associated to a ticket and say you work on it. +2. [Fork this project repository](https://help.github.com/articles/fork-a-repo/). +3. [Create a new branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/). The name of the branch must be explicit and being prefixed by the related ticket id. For instance, `783-contributing-file` to fix [ticket #783](https://github.com/FreshRSS/FreshRSS/issues/783). +4. Make your changes to your fork and [send a pull request](https://help.github.com/articles/using-pull-requests/) on the **dev branch**. + +If you have to write code, please follow [our coding style recommendations](http://doc2.freshrss.org/en/Developer_documentation/First_steps/Coding_style). + +**Tip:** if you are searching for bugs easy to fix, have a look at the « [New comers](https://github.com/FreshRSS/FreshRSS/labels/New%20comers) » ticket label. + +## Submit an idea + +You have great ideas, yes! Don't be shy and open [a new ticket](https://github.com/FreshRSS/FreshRSS/issues/new) on our bug tracker to ask if we can implement it. The greatest ideas often come from the shyest suggestions! + +If your idea is nice, we'll have a look at it. + +## Contribute to internationalization (i18n) + +If you want to improve internationalization, please open a new ticket first and follow indications from « Fix a bug » section. + +Translations are present in the subdirectories of `./app/i18n/`. + +We are working on a better way to handle internationalization but don't hesitate to suggest any idea! + +## Contribute to documentation + +The documentation needs a lot of improvements in order to be more useful to new contributors and we are working on it. If you want to give some help, meet us on [the dedicated repository](https://github.com/FreshRSS/documentation)! diff --git a/CREDITS b/CREDITS deleted file mode 100644 index c2c6642dc..000000000 --- a/CREDITS +++ /dev/null @@ -1,42 +0,0 @@ -This is a credit file of people who have contributed to FreshRSS with, at least, -one commit on the FreshRSS repository (at https://github.com/FreshRSS/FreshRSS). -Please note a commit on THIS specific file is not considered as a contribution -(too easy!). It's purpose is to show even the smallest contribution is important. -People are sorted by name so please keep this order. - ---- - -Alexandre Alapetite -https://github.com/Alkarex - -Alexis Degrugillier -https://github.com/aledeg - -Alwaysin -https://github.com/Alwaysin - -Amaury Carrade -https://github.com/AmauryCarrade - -ealdraed -https://github.com/ealdraed - -Luc Didry -https://github.com/ldidry - -Marien Fressinaud -dev@marienfressinaud.fr -http://marienfressinaud.fr -https://github.com/marienfressinaud - -Melvyn Laïly -https://github.com/yaurthek - -Nicolas Elie -https://github.com/nicolaselie - -plopoyop -https://github.com/plopoyop - -tomgue -https://github.com/tomgue diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 000000000..afe4b13b2 --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,53 @@ +This is a credit file of people who have [contributed to FreshRSS](https://github.com/FreshRSS/FreshRSS/graphs/contributors) with, at least, +one commit on one of the FreshRSS repositories (at https://github.com/FreshRSS). +Please note a commit on THIS specific file is not considered as a contribution +(too easy!). Its purpose is to show that even the smallest contribution is important. +People are sorted by name so please keep this order. + +--- + +* [Adrien Dorsaz](https://github.com/Trim): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Trim), [Web](https://adorsaz.ch/) +* [Alexandre Alapetite](https://github.com/Alkarex): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Alkarex), [Web](https://alexandre.alapetite.fr/) +* [Alexis Degrugillier](https://github.com/aledeg): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=aledeg) +* [Alwaysin](https://github.com/Alwaysin): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Alwaysin) +* [Amaury Carrade](https://github.com/AmauryCarrade): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=AmauryCarrade), [Web](https://amaury.carrade.eu/) +* [Anton Smirnov](https://github.com/sandfoxme): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:sandfoxme), [Web](http://sandfox.me/) +* [ASMfreaK](https://github.com/ASMfreaK): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ASMfreaK) +* [Craig Andrews](https://github.com/candrews): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:candrews), [Web](http://candrews.integralblue.com/) +* [Crupuk](https://github.com/Crupuk): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Crupuk) +* [Damstre](https://github.com/Damstre): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Damstre) +* [danc](https://github.com/danc): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=danc), [Web](http://tintouli.free.fr/) +* [David Souza](https://github.com/araujo0205): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:araujo0205), [Web](http://davidsouza.tech/) +* [dswd](https://github.com/dswd): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:dswd) +* [ealdraed](https://github.com/ealdraed): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ealdraed) +* [Frans de Jonge](https://github.com/Frenzie): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Frenzie), [Web](http://fransdejonge.com/) +* [gsongsong](https://github.com/gsongsong): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:gsongsong) +* [Guillaume Fillon](https://github.com/kokaz): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:kokaz), [Web](http://www.guillaume-fillon.com/) +* [Guillaume Hayot](https://github.com/postblue): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:postblue), [Web](https://postblue.info/) +* [hckweb](https://github.com/hckweb): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=hckweb) +* [hoilc](https://github.com/hoilc): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:hoilc) +* [Jaussoin Timothée](https://github.com/edhelas): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=edhelas), [Web](http://edhelas.movim.eu/) +* [jlefler](https://github.com/jlefler): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:jlefler) +* [Jonas Östanbäck](https://github.com/cez81): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=cez81) +* [Julien Reichardt](https://github.com/j8r): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=j8r), [Web](https://blog.jrei.ch/) +* [Kevin Papst](https://github.com/kevinpapst): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=kevinpapst), [Web](http://www.kevinpapst.de/) +* [Luc Didry](https://github.com/ldidry): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ldidry), [Web](https://www.fiat-tux.fr/) +* [marcomrc](https://github.com/marcomrc): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=marcomrc) +* [Marcus Rohrmoser](https://github.com/mro): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=mro), [Web](http://mro.name/~me) +* [Marien Fressinaud](https://github.com/marienfressinaud): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=marienfressinaud), [Web](https://marienfressinaud.fr/) +* [Melvyn Laïly](https://github.com/yaurthek): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=yaurthek), [Web](http://x2a.yt/) +* [MSZ](https://github.com/mszkb): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=mszkb) +* [Nicolas Elie](https://github.com/nicolaselie): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=nicolaselie) +* [Nicolas Lœuillet](https://github.com/nicosomb): [contributions](https://github.com/FreshRSS/documentation/commits?author=nicosomb), [Web](http://www.loeuillet.org/) +* [Olivier Dossmann](https://github.com/blankoworld): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=blankoworld), [Web](https://olivier.dossmann.net) +* [plopoyop](https://github.com/plopoyop): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=plopoyop) +* [Paulius Šukys](https://github.com/psukys): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:psukys), [Web](http://sukys.eu) +* [purexo](https://github.com/purexo): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:purexo), [Web](https://purexo.mom/) +* [Quentin Dufour](https://github.com/superboum): [contributions](https://github.com/FreshRSS/documentation/commits?author=superboum), [Web](http://quentin.dufour.io/) +* [Ramón Cutanda](https://github.com/rcutanda): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:rcutanda) +* [romibi](https://github.com/romibi): [contributions](https://github.com/FreshRSS/FreshRSS/commits/dev?author=romibi) +* [subic](https://github.com/subic): [contributions](https://github.com/FreshRSS/documentation/commits?author=subic) +* [Tets42](https://github.com/Tets42): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Tets42) +* [Thomas Citharel](https://github.com/tcitworld): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:tomgue), [Web](https://www.tcit.fr/) +* [tomgue](https://github.com/tomgue): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=tomgue) +* [Wanabo](https://github.com/Wanabo): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Wanabo) diff --git a/README.fr.md b/README.fr.md index 380d7bc1e..797d43504 100644 --- a/README.fr.md +++ b/README.fr.md @@ -6,51 +6,108 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed] 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. +Il supporte [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) pour des notifications instantanées depuis les sites compatibles. +Il y a une API pour les clients (mobiles), ainsi qu’une [interface en ligne de commande](./cli/README.md). +Enfin, il permet l’ajout d’[extensions](#extensions) pour encore plus de personnalisation. -* Site officiel : http://freshrss.org +* Site officiel : https://freshrss.org * Démo : http://demo.freshrss.org/ * Licence : [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) - + -# Note sur les branches -**Ce logiciel est encore en développement !** Veuillez vous assurer d'utiliser la branche qui vous correspond : +# Téléchargement +Voir la [liste des versions](../../releases). +## À propos des branches * Utilisez [la branche master](https://github.com/FreshRSS/FreshRSS/tree/master/) si vous visez la stabilité. -* [La branche beta](https://github.com/FreshRSS/FreshRSS/tree/beta) est celle par défaut : les nouveautés y sont ajoutées environ tous les mois. -* Pour les développeurs et ceux qui savent ce qu'ils font, [la branche dev](https://github.com/FreshRSS/FreshRSS/tree/dev) vous ouvre les bras ! +* Pour ceux qui veulent bien aider à tester ou déveloper les dernières fonctionnalités, [la branche dev](https://github.com/FreshRSS/FreshRSS/tree/dev) vous ouvre les bras ! -# Disclaimer -Cette application a été développée pour s’adapter à des besoins personnels et non professionnels. -Je ne garantis en aucun cas la sécurité de celle-ci, ni son bon fonctionnement. -Je m’engage néanmoins à répondre dans la mesure du possible aux demandes d’évolution si celles-ci me semblent justifiées. -Privilégiez pour cela des demandes sur GitHub -(https://github.com/FreshRSS/FreshRSS/issues). +# Avertissements +Cette application a été développée pour s’adapter principalement à des besoins personnels, et aucune garantie n’est fournie. +Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont les bienvenues. Privilégiez pour cela des [demandes sur GitHub](https://github.com/FreshRSS/FreshRSS/issues). +Nous sommes une communauté amicale. -# Pré-requis +# Prérequis * 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) + * Fonctionne même sur un Raspberry Pi 1 avec des temps de réponse < 1s (testé sur 150 flux, 22k articles) * Serveur Web Apache2 (recommandé), ou nginx, lighttpd (non testé sur les autres) -* PHP 5.2.1+ (PHP 5.3.7+ recommandé) - * Requis : [PDO_MySQL](http://php.net/pdo-mysql) ou [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl), [GMP](http://php.net/gmp) (seulement pour accès API sur platformes < 64 bits) - * Recommandés : [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [zlib](http://php.net/zlib), [Zip](http://php.net/zip) -* MySQL 5.0.3+ (recommandé) ou SQLite 3.7.4+ -* Un navigateur Web récent tel Firefox 4+, Chrome, Opera, Safari, Internet Explorer 9+ +* PHP 5.3.8+ (PHP 5.4+ recommandé, et PHP 5.5+ pour les performances, et PHP 7+ pour d’encore meilleures performances) + * Requis : [cURL](http://php.net/curl), [DOM](http://php.net/dom), [XML](http://php.net/xml), [session](http://php.net/session), [ctype](http://php.net/ctype), et [PDO_MySQL](http://php.net/pdo-mysql) ou [PDO_SQLite](http://php.net/pdo-sqlite) ou [PDO_PGSQL](http://php.net/pdo-pgsql) + * Recommandés : [JSON](http://php.net/json), [GMP](http://php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](http://php.net/intl.idn) (pour les noms de domaines internationalisés), [mbstring](http://php.net/mbstring) et/ou [iconv](http://php.net/iconv) (pour conversion d’encodages), [ZIP](http://php.net/zip) (pour import/export), [zlib](http://php.net/zlib) (pour les flux compressés) +* MySQL 5.5.3+ (recommandé), ou SQLite 3.7.4+, ou PostgreSQL 9.2+ +* Un navigateur Web récent tel Firefox, Internet Explorer 11 / Edge, Chrome, Opera, Safari. * Fonctionne aussi sur mobile - + -# Installation -1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/FreshRSS/FreshRSS/archive/master.zip) +# Documentation +* https://freshrss.github.io/FreshRSS/fr/ + +# [Installation](https://freshrss.github.io/FreshRSS/fr/users/01_Installation.html) +1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](../releases) 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. + * ou utilisez [l’interface en ligne de commande](./cli/README.md) +5. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à [nous contacter](https://github.com/FreshRSS/FreshRSS/issues). +6. Des paramètres de configuration avancée peuvent être vues dans [config.default.php](./config.default.php) et modifiées dans `data/config.php`. +7. Avec Apache, activer [`AllowEncodedSlashes`](http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes) pour une meilleure compatibilité avec les clients mobiles. + +## Installation automatisée +* [](https://dfabric.github.io/DPlatform-ShellCore) +* [YunoHost](https://github.com/YunoHost-Apps/freshrss_ynh) + +## Exemple d’installation complète sur Linux Debian/Ubuntu +```sh +# Si vous utilisez le serveur Web Apache (sinon il faut un autre serveur Web) +sudo apt-get install apache2 +sudo a2enmod headers expires rewrite ssl #Modules Apache + +# Pour Ubuntu <= 15.10, Debian <= 8 Jessie +sudo apt-get install php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite +sudo apt-get install libapache2-mod-php5 #Pour Apache +sudo apt-get install mysql-server mysql-client php5-mysql #Base de données MySQL optionnelle +sudo apt-get install postgresql php5-pgsql #Base de données PostgreSQL optionnelle + +# Pour Ubuntu >= 16.04, Debian >= 9 Stretch +sudo apt install php php-curl php-gmp php-intl php-mbstring php-sqlite3 php-xml php-zip +sudo apt install libapache2-mod-php #Pour Apache +sudo apt install mysql-server mysql-client php-mysql #Base de données MySQL optionnelle +sudo apt install postgresql php-pgsql #Base de données PostgreSQL optionnelle + +## Redémarrage du serveur Web +sudo service apache2 restart + +# Pour FreshRSS lui-même (git est optionnel si vous déployez manuellement les fichiers d’installation) +cd /usr/share/ +sudo apt-get install git +sudo git clone https://github.com/FreshRSS/FreshRSS.git +cd FreshRSS + +# Si vous souhaitez utiliser la branche développement de FreshRSS +sudo git checkout -b dev origin/dev + +# Mettre les droits d’accès pour le serveur Web +sudo chown -R :www-data . && sudo chmod -R g+r . && sudo chmod -R g+w ./data/ +# Si vous souhaitez permettre les mises à jour par l’interface Web +sudo chmod -R g+w . + +# Publier FreshRSS dans votre répertoire HTML public +sudo ln -s /usr/share/FreshRSS/p /var/www/html/FreshRSS +# Naviguez vers http://example.net/FreshRSS pour terminer l’installation +# (Si vous le faite depuis localhost, vous pourrez avoir à ajuster le réglage de votre adresse publique) +# ou utilisez l’interface en ligne de commande + +# Mettre à jour FreshRSS vers une nouvelle version par git +cd /usr/share/FreshRSS +sudo git pull +sudo chown -R :www-data . && sudo chmod -R g+r . && sudo chmod -R g+w ./data/ +``` -# Contrôle d’accès +## 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. Au choix : -* En utilisant l’identification par formulaire (requiert JavaScript, et PHP 5.3.7+ recommandé – fonctionne avec certaines versions de PHP 5.3.3+) -* En utilisant l’identification par [Mozilla Persona](https://login.persona.org/about) incluse dans FreshRSS +* En utilisant l’identification par formulaire (requiert JavaScript, et PHP 5.5+ recommandé) * 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. @@ -62,30 +119,47 @@ C’est une bonne idée d’utiliser le même utilisateur que votre serveur Web Par exemple, pour exécuter le script toutes les heures : ``` -7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +8 * * * * php /usr/share/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` +### Exemple pour Debian / Ubuntu +Créer `/etc/cron.d/FreshRSS` avec : + +``` +7,37 * * * * www-data php -f /usr/share/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`. +* En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/users/*/log*.txt`. + * Le répertoire spécial `./data/users/_/` contient la partie des logs partagés par tous les utilisateurs. + # 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 : +* Il faut conserver vos fichiers `./data/config.php` ainsi que `./data/users/*/config.php` +* Vous pouvez exporter votre liste de flux au format OPML soit depuis l’interface Web, soit [en ligne de commande](./cli/README.md) +* Pour sauvegarder les articles eux-mêmes, vous pouvez utiliser [phpMyAdmin](http://www.phpmyadmin.net) ou les outils de MySQL : ```bash -mysqldump -u utilisateur -p --databases freshrss > freshrss.sql +mysqldump --skip-comments --disable-keys --user=<db_user> --password --host <db_host> --result-file=freshrss.dump.sql --databases <freshrss_db> ``` +# Extensions +FreshRSS permet l’ajout d’extensions en plus des fonctionnalités natives. +Voir le [dépôt dédié à ces extensions](https://github.com/FreshRSS/Extensions). + + # 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/) +* [php-http-304](https://alexandre.alapetite.fr/doc-alex/php-http-304/) * [jQuery](http://jquery.com/) +* [lib_opml](https://github.com/marienfressinaud/lib_opml) +* [jQuery Plugin Sticky-Kit](http://leafo.net/sticky-kit/) * [keyboard_shortcuts](http://www.openjs.com/scripts/events/keyboard_shortcuts/) * [flotr2](http://www.humblesoftware.com/flotr2) @@ -96,3 +170,13 @@ mysqldump -u utilisateur -p --databases freshrss > freshrss.sql ## 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) + + +# [Clients compatibles](https://freshrss.github.io/FreshRSS/en/users/06_Mobile_access.html) +Tout client supportant une API de type Google Reader. Sélection : + +* Android + * [News+](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus) avec [News+ Google Reader extension](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader) (Propriétaire) + * [EasyRSS](https://github.com/Alkarex/EasyRSS) (Libre, F-Droid) +* Linux + * [FeedReader 2.0+](https://jangernert.github.io/FeedReader/) (Libre) @@ -1,91 +1,171 @@ +[![Build Status][travis-badge]][travis-link] + * [Version française](README.fr.md) # FreshRSS -FreshRSS is a self-hosted RSS feed agregator like [Leed](http://projet.idleman.fr/leed/) or [Kriss Feed](http://tontof.net/kriss/feed/). +FreshRSS is a self-hosted RSS feed aggregator such as [Leed](http://projet.idleman.fr/leed/) or [Kriss Feed](http://tontof.net/kriss/feed/). -It is at the same time light-weight, easy to work with, powerful and customizable. +It is at the same time lightweight, easy to work with, powerful and customizable. It is a multi-user application with an anonymous reading mode. +It supports [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) for instant notifications from compatible Web sites. +There is an API for (mobile) clients, and a [Command-Line Interface](./cli/README.md). +Finally, it supports [extensions](#extensions) for further tuning. * Official website: http://freshrss.org * Demo: http://demo.freshrss.org/ * License: [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) - + -# Note on branches -**This application is still in development!** Please use the branch that suits your needs: +# Releases +See the [list of releases](../../releases). +## About branches * Use [the master branch](https://github.com/FreshRSS/FreshRSS/tree/master/) if you need a stable version. -* [The beta branch](https://github.com/FreshRSS/FreshRSS/tree/beta) is the default branch: new features are added on a monthly basis. -* For developers and tech savvy persons, [the dev branch](https://github.com/FreshRSS/FreshRSS/tree/dev) is waiting for you! +* For those willing to help testing or developing the latest features, [the dev branch](https://github.com/FreshRSS/FreshRSS/tree/dev) is waiting for you! # Disclaimer -This application was developed to fulfill personal needs not professional needs. -There is no guarantee neither on its security nor its proper functioning. -If there is feature requests which I think are good for the project, I'll do my best to include them. -The best way is to open issues on GitHub -(https://github.com/FreshRSS/FreshRSS/issues). +This application was developed to fulfil personal needs primarily, and comes with absolutely no warranty. +Feature requests, bug reports, and other contributions are welcome. The best way is to [open an issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues). +We are a friendly community. # Requirements * Light server running Linux or Windows - * It even works on Raspberry Pi with response time under a second (tested with 150 feeds, 22k articles, or 32Mo of compressed data) -* A web server: Apache2 (recommanded), nginx, lighttpd (not tested on others) -* PHP 5.2.1+ (PHP 5.3.7+ recommanded) - * Required extensions: [PDO_MySQL](http://php.net/pdo-mysql) or [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl), [GMP](http://php.net/gmp) (only for API access on platforms under 64 bits) - * Recommanded extensions : [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [zlib](http://php.net/zlib), [Zip](http://php.net/zip) -* MySQL 5.0.3+ (recommanded) or SQLite 3.7.4+ -* A recent browser like Firefox 4+, Chrome, Opera, Safari, Internet Explorer 9+ + * It even works on Raspberry Pi 1 with response time under a second (tested with 150 feeds, 22k articles) +* A web server: Apache2 (recommended), nginx, lighttpd (not tested on others) +* PHP 5.3.8+ (PHP 5.4+ recommended, and PHP 5.5+ for performance, and PHP 7 for even higher performance) + * Required extensions: [cURL](http://php.net/curl), [DOM](http://php.net/dom), [XML](http://php.net/xml), [session](http://php.net/session), [ctype](http://php.net/ctype), and [PDO_MySQL](http://php.net/pdo-mysql) or [PDO_SQLite](http://php.net/pdo-sqlite) or [PDO_PGSQL](http://php.net/pdo-pgsql) + * Recommended extensions: [JSON](http://php.net/json), [GMP](http://php.net/gmp) (for API access on platforms < 64 bits), [IDN](http://php.net/intl.idn) (for Internationalized Domain Names), [mbstring](http://php.net/mbstring) and/or [iconv](http://php.net/iconv) (for charset conversion), [ZIP](http://php.net/zip) (for import/export), [zlib](http://php.net/zlib) (for compressed feeds) +* MySQL 5.5.3+ (recommended), or SQLite 3.7.4+, or PostgreSQL 9.2+ +* A recent browser like Firefox, Internet Explorer 11 / Edge, Chrome, Opera, Safari. * Works on mobile - + + +# Documentation +* https://freshrss.github.io/FreshRSS/en/ -# Installation +# [Installation](https://freshrss.github.io/FreshRSS/en/users/01_Installation.html) 1. Get FreshRSS with git or [by downloading the archive](https://github.com/FreshRSS/FreshRSS/archive/master.zip) 2. Dump the application on your server (expose only the `./p/` folder) 3. Add write access on `./data/` folder to the webserver user 4. Access FreshRSS with your browser and follow the installation process -5. Every thing should be working :) If you encounter any problem, feel free to contact me. + * or use the [Command-Line Interface](./cli/README.md) +5. Everything should be working :) If you encounter any problem, feel free [contact us](https://github.com/FreshRSS/FreshRSS/issues). +6. Advanced configuration settings can be seen in [config.default.php](./config.default.php) and modified in `data/config.php`. +7. When using Apache, enable [`AllowEncodedSlashes`](http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes) for better compatibility with mobile clients. + +More information about installation and server configuration can be found in [our documentation](https://freshrss.github.io/FreshRSS/en/admins/02_Installation.html). + +## Automated install +* [](https://cloudron.io/button.html?app=org.freshrss.cloudronapp) +* [](https://dfabric.github.io/DPlatform-ShellCore) +* [YunoHost](https://github.com/YunoHost-Apps/freshrss_ynh) + +## Example of full installation on Linux Debian/Ubuntu +```sh +# If you use an Apache Web server (otherwise you need another Web server) +sudo apt-get install apache2 +sudo a2enmod headers expires rewrite ssl #Apache modules + +# For Ubuntu <= 15.10, Debian <= 8 Jessie +sudo apt-get install php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite +sudo apt-get install libapache2-mod-php5 #For Apache +sudo apt-get install mysql-server mysql-client php5-mysql #Optional MySQL database +sudo apt-get install postgresql php5-pgsql #Optional PostgreSQL database + +# For Ubuntu >= 16.04, Debian >= 9 Stretch +sudo apt install php php-curl php-gmp php-intl php-mbstring php-sqlite3 php-xml php-zip +sudo apt install libapache2-mod-php #For Apache +sudo apt install mysql-server mysql-client php-mysql #Optional MySQL database +sudo apt install postgresql php-pgsql #Optional PostgreSQL database + +# Restart Web server +sudo service apache2 restart + +# For FreshRSS itself (git is optional if you manually download the installation files) +cd /usr/share/ +sudo apt-get install git +sudo git clone https://github.com/FreshRSS/FreshRSS.git +cd FreshRSS + +# If you want to use the development version of FreshRSS +sudo git checkout -b dev origin/dev + +# Set the rights so that your Web server can access the files +sudo chown -R :www-data . && sudo chmod -R g+r . && sudo chmod -R g+w ./data/ +# If you would like to allow updates from the Web interface +sudo chmod -R g+w . + +# Publish FreshRSS in your public HTML directory +sudo ln -s /usr/share/FreshRSS/p /var/www/html/FreshRSS +# Navigate to http://example.net/FreshRSS to complete the installation +# (If you do it from localhost, you may have to adjust the setting of your public address later) +# or use the Command-Line Interface + +# Update to a newer version of FreshRSS with git +cd /usr/share/FreshRSS +sudo git pull +sudo chown -R :www-data . && sudo chmod -R g+r . && sudo chmod -R g+w ./data/ +``` +See more commands and git commands in the [Command-Line Interface documentation](./cli/README.md). -# Access control +## Access control It is needed for the multi-user mode to limit access to FreshRSS. You can: -* use form authentication (need JavaScript and PHP 5.3.7+, works with some PHP 5.3.3+) -* use [Mozilla Persona](https://login.persona.org/about) authentication included in FreshRSS +* use form authentication (needs JavaScript, and PHP 5.5+ recommended) * use HTTP authentication supported by your web server * See [Apache documentation](http://httpd.apache.org/docs/trunk/howto/auth.html) * In that case, create a `./p/i/.htaccess` file with a matching `.htpasswd` file. -# Automatic feed update +## Automatic feed update * You can add a Cron job to launch the update script. Check the Cron documentation related to your distribution ([Debian/Ubuntu](https://help.ubuntu.com/community/CronHowto), [Red Hat/Fedora](https://fedoraproject.org/wiki/Administration_Guide_Draft/Cron), [Slackware](http://docs.slackware.com/fr:slackbook:process_control?#cron), [Gentoo](https://wiki.gentoo.org/wiki/Cron), [Arch Linux](https://wiki.archlinux.org/index.php/Cron)…). -It’s a good idea to use the web server user . -For example, if you want to run the script every hour: +It is a good idea to use the Web server user. +For instance, if you want to run the script every hour: + +``` +9 * * * * php /usr/share/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +``` + +### Example on Debian / Ubuntu +Create `/etc/cron.d/FreshRSS` with: ``` -7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +6,36 * * * * www-data php -f /usr/share/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` + # Advices -* For a better security, expose only the `./p/` folder on the web. +* For a better security, expose only the `./p/` folder on the Web. * Be aware that the `./data/` folder contains all personal data, so it is a bad idea to expose it. * The `./constants.php` file defines access to application folder. If you want to customize your installation, every thing happens here. -* If you encounter any problem, logs are accessibles from the interface or manually in `./data/log/*.log` files. +* If you encounter any problem, logs are accessible from the interface or manually in `./data/users/*/log*.txt` files. + * The special folder `./data/users/_/` contains the part of the logs that are shared by all users. + # Backup -* You need to keep `./data/config.php`, `./data/*_user.php` and `./data/persona/` files -* You can export your feed list in OPML format from FreshRSS +* You need to keep `./data/config.php`, and `./data/users/*/config.php` files +* You can export your feed list in OPML format either from the Web interface, or from the [Command-Line Interface](./cli/README.md) * To save articles, you can use [phpMyAdmin](http://www.phpmyadmin.net) or MySQL tools: ```bash -mysqldump -u user -p --databases freshrss > freshrss.sql +mysqldump --skip-comments --disable-keys --user=<db_user> --password --host <db_host> --result-file=freshrss.dump.sql --databases <freshrss_db> ``` +# Extensions +FreshRSS supports further customizations by adding extensions on top of its core functionality. +See the [repository dedicated to those extensions](https://github.com/FreshRSS/Extensions). + + # Included libraries * [SimplePie](http://simplepie.org/) * [MINZ](https://github.com/marienfressinaud/MINZ) -* [php-http-304](http://alexandre.alapetite.fr/doc-alex/php-http-304/) +* [php-http-304](https://alexandre.alapetite.fr/doc-alex/php-http-304/) * [jQuery](http://jquery.com/) +* [lib_opml](https://github.com/marienfressinaud/lib_opml) +* [jQuery Plugin Sticky-Kit](http://leafo.net/sticky-kit/) * [keyboard_shortcuts](http://www.openjs.com/scripts/events/keyboard_shortcuts/) * [flotr2](http://www.humblesoftware.com/flotr2) @@ -96,3 +176,16 @@ mysqldump -u user -p --databases freshrss > freshrss.sql ## If native functions are not available * [Services_JSON](http://pear.php.net/pepr/pepr-proposal-show.php?id=198) * [password_compat](https://github.com/ircmaxell/password_compat) + + +# [Compatible clients](https://freshrss.github.io/FreshRSS/en/users/06_Mobile_access.html) +Any client supporting a Google Reader-like API. Selection: + +* Android + * [News+](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus) with [News+ Google Reader extension](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader) (Closed source) + * [EasyRSS](https://github.com/Alkarex/EasyRSS) (Open source, F-Droid) +* Linux + * [FeedReader 2.0+](https://jangernert.github.io/FeedReader/) (Open source) + +[travis-badge]:https://travis-ci.org/FreshRSS/FreshRSS.svg?branch=master +[travis-link]:https://travis-ci.org/FreshRSS/FreshRSS diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 937c0759d..5ad1a51d9 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -27,11 +27,6 @@ class FreshRSS_auth_Controller extends Minz_ActionController { if (Minz_Request::isPost()) { $ok = true; - $current_token = FreshRSS_Context::$user_conf->token; - $token = Minz_Request::param('token', $current_token); - FreshRSS_Context::$user_conf->token = $token; - $ok &= FreshRSS_Context::$user_conf->save(); - $anon = Minz_Request::param('anon_access', false); $anon = ((bool)$anon) && ($anon !== 'no'); $anon_refresh = Minz_Request::param('anon_refresh', false); @@ -70,7 +65,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { /** * This action handles the login page. * - * It forwards to the correct login page (form or Persona) or main page if + * It forwards to the correct login page (form) or main page if * the user is already connected. */ public function loginAction() { @@ -83,9 +78,6 @@ class FreshRSS_auth_Controller extends Minz_ActionController { case 'form': Minz_Request::forward(array('c' => 'auth', 'a' => 'formLogin')); break; - case 'persona': - Minz_Request::forward(array('c' => 'auth', 'a' => 'personaLogin')); - break; case 'http_auth': case 'none': // It should not happened! @@ -116,15 +108,19 @@ class FreshRSS_auth_Controller extends Minz_ActionController { $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'); Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . $file_mtime)); + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1); + if (Minz_Request::isPost()) { $nonce = Minz_Session::param('nonce'); $username = Minz_Request::param('username', ''); $challenge = Minz_Request::param('challenge', ''); $conf = get_user_configuration($username); - if (is_null($conf)) { - Minz_Request::bad(_t('feedback.auth.login.invalid'), - array('c' => 'auth', 'a' => 'login')); + if ($conf == null) { + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); + return; } $ok = FreshRSS_FormAuth::checkCredentials( @@ -151,8 +147,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { ' user=' . $username . ', nonce=' . $nonce . ', c=' . $challenge); - Minz_Request::bad(_t('feedback.auth.login.invalid'), - array('c' => 'auth', 'a' => 'login')); + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); } } elseif (FreshRSS_Context::$system_conf->unsafe_autologin_enabled) { $username = Minz_Request::param('u', ''); @@ -164,7 +159,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { } $conf = get_user_configuration($username); - if (is_null($conf)) { + if ($conf == null) { return; } @@ -184,84 +179,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { array('c' => 'index', 'a' => 'index')); } else { Minz_Log::warning('Unsafe password mismatch for user ' . $username); - Minz_Request::bad(_t('feedback.auth.login.invalid'), - array('c' => 'auth', 'a' => 'login')); - } - } - } - - /** - * This action handles Persona login page. - * - * If this action is reached through a POST request, assertion from Persona - * is verificated and user connected if all is ok. - * - * Parameter is: - * - assertion (default: false) - * - * @todo: Persona system should be moved to a plugin - */ - public function personaLoginAction() { - $this->view->res = false; - - if (Minz_Request::isPost()) { - $this->view->_useLayout(false); - - $assert = Minz_Request::param('assertion'); - $url = 'https://verifier.login.persona.org/verify'; - $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); - - $login_ok = false; - $reason = ''; - if ($res['status'] === 'okay') { - $email = filter_var($res['email'], FILTER_VALIDATE_EMAIL); - if ($email != '') { - $persona_file = DATA_PATH . '/persona/' . $email . '.txt'; - if (($current_user = @file_get_contents($persona_file)) !== false) { - $current_user = trim($current_user); - $conf = get_user_configuration($current_user); - if (!is_null($conf)) { - $login_ok = strcasecmp($email, $conf->mail_login) === 0; - } else { - $reason = 'Invalid configuration for user ' . - '[' . $current_user . ']'; - } - } - } else { - $reason = 'Invalid email format [' . $res['email'] . ']'; - } - } else { - $reason = $res['reason']; + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); } - - if ($login_ok) { - Minz_Session::_param('currentUser', $current_user); - Minz_Session::_param('mail', $email); - FreshRSS_Auth::giveAccess(); - invalidateHttpCache(); - } else { - Minz_Log::error($reason); - - $res = array(); - $res['status'] = 'failure'; - $res['reason'] = _t('feedback.auth.login.invalid'); - } - - header('Content-Type: application/json; charset=UTF-8'); - $this->view->res = $res; } } @@ -276,74 +195,13 @@ class FreshRSS_auth_Controller extends Minz_ActionController { } /** - * This action resets the authentication system. - * - * After reseting, form auth is set by default. + * This action gives possibility to a user to create an account. */ - public function resetAction() { - Minz_View::prependTitle(_t('admin.auth.title_reset') . ' · '); - - Minz_View::appendScript(Minz_Url::display( - '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') - )); - - $this->view->no_form = false; - // Enable changement of auth only if Persona! - if (FreshRSS_Context::$system_conf->auth_type != 'persona') { - $this->view->message = array( - 'status' => 'bad', - 'title' => _t('gen.short.damn'), - 'body' => _t('feedback.auth.not_persona') - ); - $this->view->no_form = true; - return; - } - - $conf = get_user_configuration(FreshRSS_Context::$system_conf->default_user); - if (is_null($conf)) { - return; - } - - // Admin user must have set its master password. - if (!$conf->passwordHash) { - $this->view->message = array( - 'status' => 'bad', - 'title' => _t('gen.short.damn'), - 'body' => _t('feedback.auth.no_password_set') - ); - $this->view->no_form = true; - return; + public function registerAction() { + if (max_registrations_reached()) { + Minz_Error::error(403); } - invalidateHttpCache(); - - if (Minz_Request::isPost()) { - $nonce = Minz_Session::param('nonce'); - $username = Minz_Request::param('username', ''); - $challenge = Minz_Request::param('challenge', ''); - - $ok = FreshRSS_FormAuth::checkCredentials( - $username, $conf->passwordHash, $nonce, $challenge - ); - - if ($ok) { - FreshRSS_Context::$system_conf->auth_type = 'form'; - $ok = FreshRSS_Context::$system_conf->save(); - - if ($ok) { - Minz_Request::good(_t('feedback.auth.form.set')); - } else { - Minz_Request::bad(_t('feedback.auth.form.not_set'), - array('c' => 'auth', 'a' => 'reset')); - } - } else { - Minz_Log::warning('Password mismatch for' . - ' user=' . $username . - ', nonce=' . $nonce . - ', c=' . $challenge); - Minz_Request::bad(_t('feedback.auth.login.invalid'), - array('c' => 'auth', 'a' => 'reset')); - } - } + Minz_View::prependTitle(_t('gen.auth.registration.title') . ' · '); } } diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index e65c146de..f3b35a323 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -117,7 +117,6 @@ class FreshRSS_category_Controller extends Minz_ActionController { public function deleteAction() { $feedDAO = FreshRSS_Factory::createFeedDao(); $catDAO = new FreshRSS_CategoryDAO(); - $default_category = $catDAO->getDefault(); $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { @@ -128,11 +127,11 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Request::bad(_t('feedback.sub.category.no_id'), $url_redirect); } - if ($id === $default_category->id()) { + if ($id === FreshRSS_CategoryDAO::DEFAULTCATEGORYID) { Minz_Request::bad(_t('feedback.sub.category.not_delete_default'), $url_redirect); } - if ($feedDAO->changeCategory($id, $default_category->id()) === false) { + if ($feedDAO->changeCategory($id, FreshRSS_CategoryDAO::DEFAULTCATEGORYID) === false) { Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); } diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 38ccd2b2d..9d2ee450c 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -109,9 +109,11 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->hide_read_feeds = Minz_Request::param('hide_read_feeds', false); FreshRSS_Context::$user_conf->onread_jump_next = Minz_Request::param('onread_jump_next', false); FreshRSS_Context::$user_conf->lazyload = Minz_Request::param('lazyload', false); + FreshRSS_Context::$user_conf->sides_close_article = Minz_Request::param('sides_close_article', false); FreshRSS_Context::$user_conf->sticky_post = Minz_Request::param('sticky_post', false); FreshRSS_Context::$user_conf->reading_confirm = Minz_Request::param('reading_confirm', false); FreshRSS_Context::$user_conf->auto_remove_article = Minz_Request::param('auto_remove_article', false); + FreshRSS_Context::$user_conf->mark_updated_article_unread = Minz_Request::param('mark_updated_article_unread', false); FreshRSS_Context::$user_conf->sort_order = Minz_Request::param('sort_order', 'DESC'); FreshRSS_Context::$user_conf->mark_when = array( 'article' => Minz_Request::param('mark_open_article', false), @@ -138,7 +140,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function sharingAction() { if (Minz_Request::isPost()) { - $params = Minz_Request::params(); + $params = Minz_Request::fetchPOST(); FreshRSS_Context::$user_conf->sharing = $params['share']; FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); @@ -223,10 +225,12 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $entryDAO = FreshRSS_Factory::createEntryDao(); $this->view->nb_total = $entryDAO->count(); - $this->view->size_user = $entryDAO->size(); + + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $this->view->size_user = $databaseDAO->size(); if (FreshRSS_Auth::hasAccess('admin')) { - $this->view->size_total = $entryDAO->size(true); + $this->view->size_total = $databaseDAO->size(true); } } @@ -241,13 +245,16 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * checking if categories and feeds are still in use. */ public function queriesAction() { + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); if (Minz_Request::isPost()) { - $queries = Minz_Request::param('queries', array()); + $params = Minz_Request::param('queries', array()); - foreach ($queries as $key => $query) { + foreach ($params as $key => $query) { if (!$query['name']) { $query['name'] = _t('conf.query.number', $key + 1); } + $queries[] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); @@ -255,62 +262,9 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.updated'), array('c' => 'configure', 'a' => 'queries')); } else { - $this->view->query_get = array(); - $cat_dao = new FreshRSS_CategoryDAO(); - $feed_dao = FreshRSS_Factory::createFeedDao(); + $this->view->queries = array(); foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { - if (!isset($query['get'])) { - continue; - } - - switch ($query['get'][0]) { - case 'c': - $category = $cat_dao->searchById(substr($query['get'], 2)); - - $deprecated = true; - $cat_name = ''; - if ($category) { - $cat_name = $category->name(); - $deprecated = false; - } - - $this->view->query_get[$key] = array( - 'type' => 'category', - 'name' => $cat_name, - 'deprecated' => $deprecated, - ); - break; - case 'f': - $feed = $feed_dao->searchById(substr($query['get'], 2)); - - $deprecated = true; - $feed_name = ''; - if ($feed) { - $feed_name = $feed->name(); - $deprecated = false; - } - - $this->view->query_get[$key] = array( - 'type' => 'feed', - 'name' => $feed_name, - 'deprecated' => $deprecated, - ); - break; - case 's': - $this->view->query_get[$key] = array( - 'type' => 'favorite', - 'name' => 'favorite', - 'deprecated' => false, - ); - break; - case 'a': - $this->view->query_get[$key] = array( - 'type' => 'all', - 'name' => 'all', - 'deprecated' => false, - ); - break; - } + $this->view->queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } } @@ -325,20 +279,56 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * lean data. */ public function addQueryAction() { - $whitelist = array('get', 'order', 'name', 'search', 'state'); - $queries = FreshRSS_Context::$user_conf->queries; - $query = Minz_Request::params(); - $query['name'] = _t('conf.query.number', count($queries) + 1); - foreach ($query as $key => $value) { - if (!in_array($key, $whitelist)) { - unset($query[$key]); - } + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); + $queries = array(); + foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { + $queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } - $queries[] = $query; + $params = Minz_Request::fetchGET(); + $params['url'] = Minz_Url::display(array('params' => $params)); + $params['name'] = _t('conf.query.number', count($queries) + 1); + $queries[] = new FreshRSS_UserQuery($params, $feed_dao, $category_dao); + FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); Minz_Request::good(_t('feedback.conf.query_created', $query['name']), array('c' => 'configure', 'a' => 'queries')); } + + /** + * This action handles the system configuration page. + * + * It displays the system configuration page. + * If this action is reach through a POST request, it stores all new + * configuration values then sends a notification to the user. + * + * The options available on the page are: + * - user limit (default: 1) + * - user category limit (default: 16384) + * - user feed limit (default: 16384) + */ + public function systemAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + if (Minz_Request::isPost()) { + $limits = FreshRSS_Context::$system_conf->limits; + $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); + $limits['max_feeds'] = Minz_Request::param('max-feeds', 16384); + $limits['max_categories'] = Minz_Request::param('max-categories', 16384); + FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->title = Minz_Request::param('instance-name', 'FreshRSS'); + FreshRSS_Context::$system_conf->auto_update_url = Minz_Request::param('auto-update-url', false); + FreshRSS_Context::$system_conf->save(); + + invalidateHttpCache(); + + Minz_Session::_param('notification', array( + 'type' => 'good', + 'content' => _t('feedback.conf.updated') + )); + } + } } diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 1d9989f40..bd8b65b2b 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -40,12 +40,24 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $get = Minz_Request::param('get'); $next_get = Minz_Request::param('nextGet', $get); $id_max = Minz_Request::param('idMax', 0); + FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', '')); + + FreshRSS_Context::$state = Minz_Request::param('state', 0); + if (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_FAVORITE)) { + FreshRSS_Context::$state = FreshRSS_Entry::STATE_FAVORITE; + } elseif (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_FAVORITE)) { + FreshRSS_Context::$state = FreshRSS_Entry::STATE_NOT_FAVORITE; + } else { + FreshRSS_Context::$state = 0; + } + $params = array(); $entryDAO = FreshRSS_Factory::createEntryDao(); if ($id === false) { // id is false? It MUST be a POST request! if (!Minz_Request::isPost()) { + Minz_Request::bad(_t('feedback.access.not_found'), array('c' => 'index', 'a' => 'index')); return; } @@ -57,16 +69,16 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $get = substr($get, 2); switch($type_get) { case 'c': - $entryDAO->markReadCat($get, $id_max); + $entryDAO->markReadCat($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state); break; case 'f': - $entryDAO->markReadFeed($get, $id_max); + $entryDAO->markReadFeed($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state); break; case 's': - $entryDAO->markReadEntries($id_max, true); + $entryDAO->markReadEntries($id_max, true, 0, FreshRSS_Context::$search); break; case 'a': - $entryDAO->markReadEntries($id_max); + $entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state); break; } @@ -135,8 +147,8 @@ class FreshRSS_entry_Controller extends Minz_ActionController { @set_time_limit(300); - $entryDAO = FreshRSS_Factory::createEntryDao(); - $entryDAO->optimizeTable(); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->optimize(); $feedDAO = FreshRSS_Factory::createFeedDao(); $feedDAO->updateCachedValues(); diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index b6d2d3fe4..bb846e921 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -25,10 +25,47 @@ class FreshRSS_extension_Controller extends Minz_ActionController { 'user' => array(), ); + $this->view->extensions_installed = array(); + $extensions = Minz_ExtensionManager::listExtensions(); foreach ($extensions as $ext) { $this->view->extension_list[$ext->getType()][] = $ext; + $this->view->extensions_installed[$ext->getEntrypoint()] = $ext->getVersion(); + } + + $availableExtensions = $this->getAvailableExtensionList(); + $this->view->available_extensions = $availableExtensions; + } + + /** + * fetch extension list from GitHub + */ + protected function getAvailableExtensionList() { + $extensionListUrl = 'https://raw.githubusercontent.com/FreshRSS/Extensions/master/extensions.json'; + $json = file_get_contents($extensionListUrl); + + // we ran into problems, simply ignore them + if ($json === false) { + Minz_Log::error('Could not fetch available extension from GitHub'); + return array(); + } + + // fetch the list as an array + $list = json_decode($json, true); + if (empty($list)) { + Minz_Log::warning('Failed to convert extension file list'); + return array(); } + + // we could use that for comparing and caching later + $version = $list['version']; + + // By now, all the needed data is kept in the main extension file. + // In the future we could fetch detail information from the extensions metadata.json, but I tend to stick with + // the current implementation for now, unless it becomes too much effort maintain the extension list manually + $extensions = $list['extensions']; + + return $extensions; } /** diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 6f544d834..883f7af05 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -26,6 +26,63 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } + public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '') { + FreshRSS_UserDAO::touch(); + @set_time_limit(300); + + $catDAO = new FreshRSS_CategoryDAO(); + + $cat = null; + if ($cat_id > 0) { + $cat = $catDAO->searchById($cat_id); + } + if ($cat == null && $new_cat_name != '') { + $cat = $catDAO->addCategory(array('name' => $new_cat_name)); + } + if ($cat == null) { + $catDAO->checkDefault(); + } + $cat_id = $cat == null ? FreshRSS_CategoryDAO::DEFAULTCATEGORYID : $cat->id(); + + $feed = new FreshRSS_Feed($url); //Throws FreshRSS_BadUrl_Exception + $feed->_httpAuth($http_auth); + $feed->load(true); //Throws FreshRSS_Feed_Exception, Minz_FileNotExistException + $feed->_category($cat_id); + + $feedDAO = FreshRSS_Factory::createFeedDao(); + if ($feedDAO->searchByUrl($feed->url())) { + throw new FreshRSS_AlreadySubscribed_Exception($url, $feed->name()); + } + + // Call the extension hook + $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); + if ($feed === null) { + throw new FreshRSS_FeedNotAdded_Exception($url, $feed->name()); + } + + $values = array( + 'url' => $feed->url(), + 'category' => $feed->category(), + 'name' => $title != '' ? $title : $feed->name(), + 'website' => $feed->website(), + 'description' => $feed->description(), + 'lastUpdate' => time(), + 'httpAuth' => $feed->httpAuth(), + ); + + $id = $feedDAO->addFeed($values); + if (!$id) { + // There was an error in database... we cannot say what here. + throw new FreshRSS_FeedNotAdded_Exception($url, $feed->name()); + } + $feed->_id($id); + + // Ok, feed has been added in database. Now we have to refresh entries. + self::actualizeFeed($id, $url, false, null, true); + + return $feed; + } + /** * This action subscribes to a feed. * @@ -59,7 +116,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } $feedDAO = FreshRSS_Factory::createFeedDao(); - $this->catDAO = new FreshRSS_CategoryDAO(); $url_redirect = array( 'c' => 'subscription', 'a' => 'index', @@ -74,133 +130,44 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } if (Minz_Request::isPost()) { - @set_time_limit(300); - $cat = Minz_Request::param('category'); + $new_cat_name = ''; if ($cat === 'nc') { // User want to create a new category, new_category parameter // must exist $new_cat = Minz_Request::param('new_category'); - if (empty($new_cat['name'])) { - $cat = false; - } else { - $cat = $this->catDAO->addCategory($new_cat); - } - } - - if ($cat === false) { - // If category was not given or if creating new category failed, - // get the default category - $this->catDAO->checkDefault(); - $def_cat = $this->catDAO->getDefault(); - $cat = $def_cat->id(); + $new_cat_name = isset($new_cat['name']) ? $new_cat['name'] : ''; } // HTTP information are useful if feed is protected behind a // HTTP authentication - $user = Minz_Request::param('http_user'); - $pass = Minz_Request::param('http_pass'); + $user = trim(Minz_Request::param('http_user', '')); + $pass = Minz_Request::param('http_pass', ''); $http_auth = ''; - if ($user != '' || $pass != '') { + if ($user != '' && $pass != '') { //TODO: Sanitize $http_auth = $user . ':' . $pass; } - $transaction_started = false; try { - $feed = new FreshRSS_Feed($url); + $feed = self::addFeed($url, '', $cat, $new_cat_name, $http_auth); } catch (FreshRSS_BadUrl_Exception $e) { // Given url was not a valid url! Minz_Log::warning($e->getMessage()); Minz_Request::bad(_t('feedback.sub.feed.invalid_url', $url), $url_redirect); - } - - try { - $feed->load(true); } catch (FreshRSS_Feed_Exception $e) { // Something went bad (timeout, server not found, etc.) Minz_Log::warning($e->getMessage()); - Minz_Request::bad( - _t('feedback.sub.feed.internal_problem', _url('index', 'logs')), - $url_redirect - ); + Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); } catch (Minz_FileNotExistException $e) { // Cache directory doesn't exist! Minz_Log::error($e->getMessage()); - Minz_Request::bad( - _t('feedback.sub.feed.internal_problem', _url('index', 'logs')), - $url_redirect - ); + Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); + } catch (FreshRSS_AlreadySubscribed_Exception $e) { + Minz_Request::bad(_t('feedback.sub.feed.already_subscribed', $e->feedName()), $url_redirect); + } catch (FreshRSS_FeedNotAdded_Exception $e) { + Minz_Request::bad(_t('feedback.sub.feed.not_added', $e->feedName()), $url_redirect); } - if ($feedDAO->searchByUrl($feed->url())) { - Minz_Request::bad( - _t('feedback.sub.feed.already_subscribed', $feed->name()), - $url_redirect - ); - } - - $feed->_category($cat); - $feed->_httpAuth($http_auth); - - // Call the extension hook - $name = $feed->name(); - $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); - if (is_null($feed)) { - Minz_Request::bad(_t('feed_not_added', $name), $url_redirect); - } - - $values = array( - 'url' => $feed->url(), - 'category' => $feed->category(), - 'name' => $feed->name(), - 'website' => $feed->website(), - 'description' => $feed->description(), - 'lastUpdate' => time(), - 'httpAuth' => $feed->httpAuth(), - ); - - $id = $feedDAO->addFeed($values); - if (!$id) { - // There was an error in database... we cannot say what here. - Minz_Request::bad(_t('feedback.sub.feed.not_added', $feed->name()), $url_redirect); - } - - // Ok, feed has been added in database. Now we have to refresh entries. - $feed->_id($id); - $feed->faviconPrepare(); - - $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; - - $entryDAO = FreshRSS_Factory::createEntryDao(); - // We want chronological order and SimplePie uses reverse order. - $entries = array_reverse($feed->entries()); - - // Calculate date of oldest entries we accept in DB. - $nb_month_old = FreshRSS_Context::$user_conf->old_entries; - $date_min = time() - (3600 * 24 * 30 * $nb_month_old); - - // Use a shared statement and a transaction to improve a LOT the - // performances. - $prepared_statement = $entryDAO->addEntryPrepare(); - $feedDAO->beginTransaction(); - foreach ($entries as $entry) { - // Entries are added without any verification. - $entry->_feed($feed->id()); - $entry->_id(min(time(), $entry->date(true)) . uSecString()); - $entry->_isRead($is_read); - - $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); - if (is_null($entry)) { - // An extension has returned a null value, there is nothing to insert. - continue; - } - - $values = $entry->toArray(); - $entryDAO->addEntry($values, $prepared_statement); - } - $feedDAO->updateLastUpdate($feed->id()); - $feedDAO->commit(); - // Entries are in DB, we redirect to feed configuration page. $url_redirect['params']['id'] = $feed->id(); Minz_Request::good(_t('feedback.sub.feed.added', $feed->name()), $url_redirect); @@ -208,6 +175,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // GET request: we must ask confirmation to user before adding feed. Minz_View::prependTitle(_t('sub.feed.title_add') . ' · '); + $this->catDAO = new FreshRSS_CategoryDAO(); $this->view->categories = $this->catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { @@ -258,137 +226,217 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } - /** - * This action actualizes entries from one or several feeds. - * - * Parameters are: - * - id (default: false) - * - force (default: false) - * If id is not specified, all the feeds are actualized. But if force is - * false, process stops at 10 feeds to avoid time execution problem. - */ - public function actualizeAction() { + public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush = null, $isNewFeed = false, $noCommit = false) { @set_time_limit(300); $feedDAO = FreshRSS_Factory::createFeedDao(); $entryDAO = FreshRSS_Factory::createEntryDao(); - Minz_Session::_param('actualize_feeds', false); - $id = Minz_Request::param('id'); - $force = Minz_Request::param('force'); - // Create a list of feeds to actualize. - // If id is set and valid, corresponding feed is added to the list but + // If feed_id is set and valid, corresponding feed is added to the list but // alone in order to automatize further process. $feeds = array(); - if ($id) { - $feed = $feedDAO->searchById($id); + if ($feed_id > 0 || $feed_url) { + $feed = $feed_id > 0 ? $feedDAO->searchById($feed_id) : $feedDAO->searchByUrl($feed_url); if ($feed) { $feeds[] = $feed; } } else { - $feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$user_conf->ttl_default); + $feeds = $feedDAO->listFeedsOrderUpdate(-1); } // Calculate date of oldest entries we accept in DB. $nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + // PubSubHubbub support + $pubsubhubbubEnabledGeneral = FreshRSS_Context::$system_conf->pubsubhubbub_enabled; + $pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration. + $updated_feeds = 0; + $nb_new_articles = 0; $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { + $url = $feed->url(); //For detection of HTTP 301 + + $pubSubHubbubEnabled = $pubsubhubbubEnabledGeneral && $feed->pubSubHubbubEnabled(); + if ((!$simplePiePush) && (!$feed_id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { + //$text = 'Skip pull of feed using PubSubHubbub: ' . $url; + //Minz_Log::debug($text); + //Minz_Log::debug($text, PSHB_LOG); + continue; //When PubSubHubbub is used, do not pull refresh so often + } + + $mtime = 0; + $ttl = $feed->ttl(); + if ($ttl == -1) { + continue; //Feed refresh is disabled + } + if ((!$simplePiePush) && (!$feed_id) && + ($feed->lastUpdate() + 10 >= time() - ($ttl == -2 ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) { + //Too early to refresh from source, but check whether the feed was updated by another user + $mtime = $feed->cacheModifiedTime(); + if ($feed->lastUpdate() + 10 >= $mtime) { + continue; //Nothing newer from other users + } + //Minz_Log::debug($feed->url() . ' was updated at ' . date('c', $mtime) . ' by another user'); + //Will take advantage of the newer cache + } + if (!$feed->lock()) { Minz_Log::notice('Feed already being actualized: ' . $feed->url()); continue; } try { - // Load entries - $feed->load(false); + if ($simplePiePush) { + $feed->loadEntries($simplePiePush); //Used by PubSubHubbub + } else { + $feed->load(false, $isNewFeed); + } } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::notice($e->getMessage()); - $feedDAO->updateLastUpdate($feed->id(), 1); + Minz_Log::warning($e->getMessage()); + $feedDAO->updateLastUpdate($feed->id(), true); $feed->unlock(); continue; } - $url = $feed->url(); $feed_history = $feed->keepHistory(); - if ($feed_history == -2) { + if ($isNewFeed) { + $feed_history = -1; //∞ + } elseif ($feed_history == -2) { // TODO: -2 must be a constant! // -2 means we take the default value from configuration $feed_history = FreshRSS_Context::$user_conf->keep_history_default; } + $needFeedCacheRefresh = false; // We want chronological order and SimplePie uses reverse order. $entries = array_reverse($feed->entries()); if (count($entries) > 0) { - // For this feed, check last n entry GUIDs already in database. - $existing_guids = array_fill_keys($entryDAO->listLastGuidsByFeed( - $feed->id(), count($entries) + 10 - ), 1); - $use_declared_date = empty($existing_guids); + $newGuids = array(); + foreach ($entries as $entry) { + $newGuids[] = safe_ascii($entry->guid()); + } + // For this feed, check existing GUIDs already in database. + $existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids); + $newGuids = array(); + $oldGuids = array(); // Add entries in database if possible. - $prepared_statement = $entryDAO->addEntryPrepare(); - $feedDAO->beginTransaction(); foreach ($entries as $entry) { - $entry_date = $entry->date(true); - if (isset($existing_guids[$entry->guid()]) || - ($feed_history == 0 && $entry_date < $date_min)) { - // This entry already exists in DB or should not be added - // considering configuration and date. - continue; + if (isset($newGuids[$entry->guid()])) { + continue; //Skip subsequent articles with same GUID } + $newGuids[$entry->guid()] = true; - $id = uTimeString(); - if ($use_declared_date || $entry_date < $date_min) { - // Use declared date at first import. - $id = min(time(), $entry_date) . uSecString(); - } - - $entry->_id($id); - $entry->_isRead($is_read); - - $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); - if (is_null($entry)) { - // An extension has returned a null value, there is nothing to insert. - continue; + $entry_date = $entry->date(true); + if (isset($existingHashForGuids[$entry->guid()])) { + $existingHash = $existingHashForGuids[$entry->guid()]; + if (strcasecmp($existingHash, $entry->hash()) === 0 || trim($existingHash, '0') == '') { + //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 + $oldGuids[] = $entry->guid(); + } else { //This entry already exists but has been updated + //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . + //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); + //TODO: Make an updated/is_read policy by feed, in addition to the global one. + $needFeedCacheRefresh = FreshRSS_Context::$user_conf->mark_updated_article_unread; + $entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->updateEntry($entry->toArray()); + } + } elseif ($feed_history == 0 && $entry_date < $date_min) { + // This entry should not be added considering configuration and date. + $oldGuids[] = $entry->guid(); + } else { + if ($isNewFeed) { + $id = min(time(), $entry_date) . uSecString(); + $entry->_isRead($is_read); + } elseif ($entry_date < $date_min) { + $id = min(time(), $entry_date) . uSecString(); + $entry->_isRead(true); //Old article that was not in database. Probably an error, so mark as read + } else { + $id = uTimeString(); + $entry->_isRead($is_read); + } + $entry->_id($id); + + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); + if ($entry === null) { + // An extension has returned a null value, there is nothing to insert. + continue; + } + + if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull! + $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url . ' GUID ' . $entry->guid(); + Minz_Log::warning($text, PSHB_LOG); + Minz_Log::warning($text); + $pubSubHubbubEnabled = false; + $feed->pubSubHubbubError(true); + } + + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->addEntry($entry->toArray()); + $nb_new_articles++; } - - $values = $entry->toArray(); - $entryDAO->addEntry($values, $prepared_statement); } + $entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime); } if ($feed_history >= 0 && rand(0, 30) === 1) { // TODO: move this function in web cron when available (see entry::purge) // Remove old entries once in 30. - if (!$feedDAO->hasTransaction()) { - $feedDAO->beginTransaction(); + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); } $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, max($feed_history, count($entries) + 10)); if ($nb > 0) { + $needFeedCacheRefresh = true; Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url() . ']'); } } - $feedDAO->updateLastUpdate($feed->id(), 0, $feedDAO->hasTransaction()); - if ($feedDAO->hasTransaction()) { - $feedDAO->commit(); + $feedDAO->updateLastUpdate($feed->id(), false, $mtime); + if ($needFeedCacheRefresh) { + $feedDAO->updateCachedValue($feed->id()); + } + if ($entryDAO->inTransaction()) { + $entryDAO->commit(); } - if ($feed->url() !== $url) { - // HTTP 301 Moved Permanently + if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for PubSubHubbub + if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs + $selfUrl = checkUrl($feed->selfUrl()); + if ($selfUrl) { + Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe + Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url()); + } + $feed->_url($selfUrl, false); + Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url()); + $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); + } + } + } elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url()); $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } $feed->faviconPrepare(); + if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) { + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); + } + } $feed->unlock(); $updated_feeds++; unset($feed); @@ -399,6 +447,48 @@ class FreshRSS_feed_Controller extends Minz_ActionController { break; } } + if (!$noCommit) { + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->commitNewEntries(); + $feedDAO->updateCachedValues(); + if ($entryDAO->inTransaction()) { + $entryDAO->commit(); + } + } + return array($updated_feeds, reset($feeds), $nb_new_articles); + } + + /** + * This action actualizes entries from one or several feeds. + * + * Parameters are: + * - id (default: false): Feed ID + * - url (default: false): Feed URL + * - force (default: false) + * - noCommit (default: 0): Set to 1 to prevent committing the new articles to the main database + * If id and url are not specified, all the feeds are actualized. But if force is + * false, process stops at 10 feeds to avoid time execution problem. + */ + public function actualizeAction() { + Minz_Session::_param('actualize_feeds', false); + $id = Minz_Request::param('id'); + $url = Minz_Request::param('url'); + $force = Minz_Request::param('force'); + $noCommit = Minz_Request::fetchPOST('noCommit', 0) == 1; + + if ($id == -1 && !$noCommit) { //Special request only to commit & refresh DB cache + $updated_feeds = 0; + $entryDAO = FreshRSS_Factory::createEntryDao(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $entryDAO->beginTransaction(); + $entryDAO->commitNewEntries(); + $feedDAO->updateCachedValues(); + $entryDAO->commit(); + } else { + list($updated_feeds, $feed, $nb_new_articles) = self::actualizeFeed($id, $url, $force, null, false, $noCommit); + } if (Minz_Request::param('ajax')) { // Most of the time, ajax request is for only one feed. But since @@ -411,20 +501,51 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); // No layout in ajax request. $this->view->_useLayout(false); - return; + } else { + // Redirect to the main page with correct notification. + if ($updated_feeds === 1) { + Minz_Request::good(_t('feedback.sub.feed.actualized', $feed->name()), array( + 'params' => array('get' => 'f_' . $feed->id()) + )); + } elseif ($updated_feeds > 1) { + Minz_Request::good(_t('feedback.sub.feed.n_actualized', $updated_feeds), array()); + } else { + Minz_Request::good(_t('feedback.sub.feed.no_refresh'), array()); + } } + return $updated_feeds; + } - // Redirect to the main page with correct notification. - if ($updated_feeds === 1) { - $feed = reset($feeds); - Minz_Request::good(_t('feedback.sub.feed.actualized', $feed->name()), array( - 'params' => array('get' => 'f_' . $feed->id()) - )); - } elseif ($updated_feeds > 1) { - Minz_Request::good(_t('feedback.sub.feed.n_actualized', $updated_feeds), array()); - } else { - Minz_Request::good(_t('feedback.sub.feed.no_refresh'), array()); + public static function renameFeed($feed_id, $feed_name) { + if ($feed_id <= 0 || $feed_name == '') { + return false; + } + FreshRSS_UserDAO::touch(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + return $feedDAO->updateFeed($feed_id, array('name' => $feed_name)); + } + + public static function moveFeed($feed_id, $cat_id, $new_cat_name = '') { + if ($feed_id <= 0 || ($cat_id <= 0 && $new_cat_name == '')) { + return false; + } + FreshRSS_UserDAO::touch(); + + $catDAO = new FreshRSS_CategoryDAO(); + if ($cat_id > 0) { + $cat = $catDAO->searchById($cat_id); + $cat_id = $cat == null ? 0 : $cat->id(); + } + if ($cat_id <= 1 && $new_cat_name != '') { + $cat_id = $catDAO->addCategory(array('name' => $new_cat_name)); } + if ($cat_id <= 1) { + $catDAO->checkDefault(); + $cat_id = FreshRSS_CategoryDAO::DEFAULTCATEGORYID; + } + + $feedDAO = FreshRSS_Factory::createFeedDao(); + return $feedDAO->updateFeed($feed_id, array('category' => $cat_id)); } /** @@ -447,21 +568,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed_id = Minz_Request::param('f_id'); $cat_id = Minz_Request::param('c_id'); - if ($cat_id === false) { - // If category was not given get the default one. - $catDAO = new FreshRSS_CategoryDAO(); - $catDAO->checkDefault(); - $def_cat = $catDAO->getDefault(); - $cat_id = $def_cat->id(); - } - - $feedDAO = FreshRSS_Factory::createFeedDao(); - $values = array('category' => $cat_id); - - $feed = $feedDAO->searchById($feed_id); - if ($feed && ($feed->category() == $cat_id || - $feedDAO->updateFeed($feed_id, $values))) { + if (self::moveFeed($feed_id, $cat_id)) { // TODO: return something useful + // Log a notice to prevent "Empty IF statement" warning in PHP_CodeSniffer + Minz_Log::notice('Moved feed `' . $feed_id . '` ' . + 'in the category `' . $cat_id . '`');; } else { Minz_Log::warning('Cannot move feed `' . $feed_id . '` ' . 'in the category `' . $cat_id . '`'); @@ -469,6 +580,22 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } + public static function deleteFeed($feed_id) { + FreshRSS_UserDAO::touch(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + if ($feedDAO->deleteFeed($feed_id)) { + // TODO: Delete old favicon + + // Remove related queries + FreshRSS_Context::$user_conf->queries = remove_query_by_get( + 'f_' . $feed_id, FreshRSS_Context::$user_conf->queries); + FreshRSS_Context::$user_conf->save(); + + return true; + } + return false; + } + /** * This action deletes a feed. * @@ -487,21 +614,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if (!$redirect_url) { $redirect_url = array('c' => 'subscription', 'a' => 'index'); } - if (!Minz_Request::isPost()) { Minz_Request::forward($redirect_url, true); } $id = Minz_Request::param('id'); - $feedDAO = FreshRSS_Factory::createFeedDao(); - if ($feedDAO->deleteFeed($id)) { - // TODO: Delete old favicon - - // Remove related queries - FreshRSS_Context::$user_conf->queries = remove_query_by_get( - 'f_' . $id, FreshRSS_Context::$user_conf->queries); - FreshRSS_Context::$user_conf->save(); + if (self::deleteFeed($id)) { Minz_Request::good(_t('feedback.sub.feed.deleted'), $redirect_url); } else { Minz_Request::bad(_t('feedback.sub.feed.error'), $redirect_url); diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 589777b2a..a76dd9a2b 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -29,32 +29,14 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('sub.import_export.title') . ' · '); } - /** - * This action handles import action. - * - * It must be reached by a POST request. - * - * Parameter is: - * - file (default: nothing!) - * Available file types are: zip, json or xml. - */ - public function importAction() { - if (!Minz_Request::isPost()) { - Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); - } - - $file = $_FILES['file']; - $status_file = $file['error']; - - if ($status_file !== 0) { - Minz_Log::error('File cannot be uploaded. Error code: ' . $status_file); - Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), - array('c' => 'importExport', 'a' => 'index')); - } + public function importFile($name, $path, $username = null) { + require_once(LIB_PATH . '/lib_opml.php'); - @set_time_limit(300); + $this->catDAO = new FreshRSS_CategoryDAO($username); + $this->entryDAO = FreshRSS_Factory::createEntryDao($username); + $this->feedDAO = FreshRSS_Factory::createFeedDao($username); - $type_file = $this->guessFileType($file['name']); + $type_file = self::guessFileType($name); $list_files = array( 'opml' => array(), @@ -65,21 +47,17 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { // We try to list all files according to their type $list = array(); if ($type_file === 'zip' && extension_loaded('zip')) { - $zip = zip_open($file['tmp_name']); - + $zip = zip_open($path); if (!is_resource($zip)) { // zip_open cannot open file: something is wrong - Minz_Log::error('Zip archive cannot be imported. Error code: ' . $zip); - Minz_Request::bad(_t('feedback.import_export.zip_error'), - array('c' => 'importExport', 'a' => 'index')); + throw new FreshRSS_Zip_Exception($zip); } - while (($zipfile = zip_read($zip)) !== false) { if (!is_resource($zipfile)) { // zip_entry() can also return an error code! - Minz_Log::error('Zip file cannot be imported. Error code: ' . $zipfile); + throw new FreshRSS_Zip_Exception($zipfile); } else { - $type_zipfile = $this->guessFileType(zip_entry_name($zipfile)); + $type_zipfile = self::guessFileType(zip_entry_name($zipfile)); if ($type_file !== 'unknown') { $list_files[$type_zipfile][] = zip_entry_read( $zipfile, @@ -88,35 +66,93 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } } } - zip_close($zip); } elseif ($type_file === 'zip') { - // Zip extension is not loaded - Minz_Request::bad(_t('feedback.import_export.no_zip_extension'), - array('c' => 'importExport', 'a' => 'index')); + // ZIP extension is not loaded + throw new FreshRSS_ZipMissing_Exception(); } elseif ($type_file !== 'unknown') { - $list_files[$type_file][] = file_get_contents($file['tmp_name']); + $list_files[$type_file][] = file_get_contents($path); } // Import file contents. // OPML first(so categories and feeds are imported) // Starred articles then so the "favourite" status is already set // And finally all other files. - $error = false; + $ok = true; foreach ($list_files['opml'] as $opml_file) { - $error = $this->importOpml($opml_file); + if (!$this->importOpml($opml_file)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML import' . "\n"); + } else { + Minz_Log::warning('Error during OPML import'); + } + } } foreach ($list_files['json_starred'] as $article_file) { - $error = $this->importJson($article_file, true); + if (!$this->importJson($article_file, true)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON stars import' . "\n"); + } else { + Minz_Log::warning('Error during JSON stars import'); + } + } } foreach ($list_files['json_feed'] as $article_file) { - $error = $this->importJson($article_file); + if (!$this->importJson($article_file)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON feeds import' . "\n"); + } else { + Minz_Log::warning('Error during JSON feeds import'); + } + } + } + + return $ok; + } + + /** + * This action handles import action. + * + * It must be reached by a POST request. + * + * Parameter is: + * - file (default: nothing!) + * Available file types are: zip, json or xml. + */ + public function importAction() { + if (!Minz_Request::isPost()) { + Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); + } + + $file = $_FILES['file']; + $status_file = $file['error']; + + if ($status_file !== 0) { + Minz_Log::warning('File cannot be uploaded. Error code: ' . $status_file); + Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), + array('c' => 'importExport', 'a' => 'index')); + } + + @set_time_limit(300); + + $error = false; + try { + $error = !$this->importFile($file['name'], $file['tmp_name']); + } catch (FreshRSS_ZipMissing_Exception $zme) { + Minz_Request::bad(_t('feedback.import_export.no_zip_extension'), + array('c' => 'importExport', 'a' => 'index')); + } catch (FreshRSS_Zip_Exception $ze) { + Minz_Log::warning('ZIP archive cannot be imported. Error code: ' . $ze->zipErrorCode()); + Minz_Request::bad(_t('feedback.import_export.zip_error'), + array('c' => 'importExport', 'a' => 'index')); } // And finally, we get import status and redirect to the home page Minz_Session::_param('actualize_feeds', true); - $content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') : - _t('feedback.import_export.feeds_imported'); + $content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') : _t('feedback.import_export.feeds_imported'); Minz_Request::good($content_notif); } @@ -126,7 +162,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * Itis a *very* basic guess file type function. Only based on filename. * That's could be improved but should be enough for what we have to do. */ - private function guessFileType($filename) { + private static function guessFileType($filename) { if (substr_compare($filename, '.zip', -4) === 0) { return 'zip'; } elseif (substr_compare($filename, '.opml', -5) === 0 || @@ -146,15 +182,19 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * This method parses and imports an OPML file. * * @param string $opml_file the OPML file content. - * @return boolean true if an error occured, false else. + * @return boolean false if an error occured, true otherwise. */ private function importOpml($opml_file) { $opml_array = array(); try { $opml_array = libopml_parse_string($opml_file, false); } catch (LibOPML_Exception $e) { - Minz_Log::warning($e->getMessage()); - return true; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML parsing: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } + return false; } $this->catDAO->checkDefault(); @@ -167,51 +207,49 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * * @param array $opml_elements an OPML element (body or outline). * @param string $parent_cat the name of the parent category. - * @return boolean true if an error occured, false else. + * @return boolean false if an error occured, true otherwise. */ private function addOpmlElements($opml_elements, $parent_cat = null) { - $error = false; + $ok = true; $nb_feeds = count($this->feedDAO->listFeeds()); $nb_cats = count($this->catDAO->listCategories(false)); $limits = FreshRSS_Context::$system_conf->limits; foreach ($opml_elements as $elt) { - $is_error = false; if (isset($elt['xmlUrl'])) { // If xmlUrl exists, it means it is a feed - if ($nb_feeds >= $limits['max_feeds']) { + if (FreshRSS_Context::$isCli && $nb_feeds >= $limits['max_feeds']) { Minz_Log::warning(_t('feedback.sub.feed.over_max', - $limits['max_feeds'])); - $is_error = true; + $limits['max_feeds'])); + $ok = false; continue; } - $is_error = $this->addFeedOpml($elt, $parent_cat); - if (!$is_error) { - $nb_feeds += 1; + if ($this->addFeedOpml($elt, $parent_cat)) { + $nb_feeds++; + } else { + $ok = false; } } else { // No xmlUrl? It should be a category! $limit_reached = ($nb_cats >= $limits['max_categories']); - if ($limit_reached) { + if (!FreshRSS_Context::$isCli && $limit_reached) { Minz_Log::warning(_t('feedback.sub.category.over_max', - $limits['max_categories'])); + $limits['max_categories'])); + $ok = false; + continue; } - $is_error = $this->addCategoryOpml($elt, $parent_cat, $limit_reached); - if (!$is_error) { - $nb_cats += 1; + if ($this->addCategoryOpml($elt, $parent_cat, $limit_reached)) { + $nb_cats++; + } else { + $ok = false; } } - - if (!$error && $is_error) { - // oops: there is at least one error! - $error = $is_error; - } } - return $error; + return $ok; } /** @@ -219,21 +257,23 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * * @param array $feed_elt an OPML element (must be a feed element). * @param string $parent_cat the name of the parent category. - * @return boolean true if an error occured, false else. + * @return boolean false if an error occured, true otherwise. */ private function addFeedOpml($feed_elt, $parent_cat) { - $default_cat = $this->catDAO->getDefault(); - if (is_null($parent_cat)) { + if ($parent_cat == null) { // This feed has no parent category so we get the default one + $this->catDAO->checkDefault(); + $default_cat = $this->catDAO->getDefault(); $parent_cat = $default_cat->name(); } $cat = $this->catDAO->searchByName($parent_cat); - if (is_null($cat)) { + if ($cat == null) { // If there is not $cat, it means parent category does not exist in // database. // If it happens, take the default category. - $cat = $default_cat; + $this->catDAO->checkDefault(); + $cat = $this->catDAO->getDefault(); } // We get different useful information @@ -259,7 +299,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { // Call the extension hook $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); - if (!is_null($feed)) { + if ($feed != null) { // addFeedObject checks if feed is already in DB so nothing else to // check here $id = $this->feedDAO->addFeedObject($feed); @@ -268,11 +308,23 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $error = true; } } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::warning($e->getMessage()); + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML feed import: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } $error = true; } - return $error; + if ($error) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML feed import from URL: ' . $url . ' in category ' . $cat->id() . "\n"); + } else { + Minz_Log::warning('Error during OPML feed import from URL: ' . $url . ' in category ' . $cat->id()); + } + } + + return !$error; } /** @@ -282,29 +334,34 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * @param string $parent_cat the name of the parent category. * @param boolean $cat_limit_reached indicates if category limit has been reached. * if yes, category is not added (but we try for feeds!) - * @return boolean true if an error occured, false else. + * @return boolean false if an error occured, true otherwise. */ private function addCategoryOpml($cat_elt, $parent_cat, $cat_limit_reached) { // Create a new Category object - $cat = new FreshRSS_Category(Minz_Helper::htmlspecialchars_utf8($cat_elt['text'])); + $catName = Minz_Helper::htmlspecialchars_utf8($cat_elt['text']); + $cat = new FreshRSS_Category($catName); $error = true; - if (!$cat_limit_reached) { + if (FreshRSS_Context::$isCli || !$cat_limit_reached) { $id = $this->catDAO->addCategoryObject($cat); $error = ($id === false); } + if ($error) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML category import from URL: ' . $catName . "\n"); + } else { + Minz_Log::warning('Error during OPML category import from URL: ' . $catName); + } + } if (isset($cat_elt['@outlines'])) { // Our cat_elt contains more categories or more feeds, so we // add them recursively. // Note: FreshRSS does not support yet category arborescence - $res = $this->addOpmlElements($cat_elt['@outlines'], $cat->name()); - if (!$error && $res) { - $error = true; - } + $error &= !$this->addOpmlElements($cat_elt['@outlines'], $catName); } - return $error; + return !$error; } /** @@ -312,13 +369,17 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * * @param string $article_file the JSON file content. * @param boolean $starred true if articles from the file must be starred. - * @return boolean true if an error occured, false else. + * @return boolean false if an error occured, true otherwise. */ private function importJson($article_file, $starred = false) { $article_object = json_decode($article_file, true); - if (is_null($article_object)) { - Minz_Log::warning('Try to import a non-JSON file'); - return true; + if ($article_object == null) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error trying to import a non-JSON file' . "\n"); + } else { + Minz_Log::warning('Try to import a non-JSON file'); + } + return false; } $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; @@ -337,31 +398,37 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $feed = new FreshRSS_Feed($item['origin'][$key]); $feed = $this->feedDAO->searchByUrl($feed->url()); - if (is_null($feed)) { + if ($feed == null) { // Feed does not exist in DB,we should to try to add it. - if ($nb_feeds >= $limits['max_feeds']) { + if ((!FreshRSS_Context::$isCli) && ($nb_feeds >= $limits['max_feeds'])) { // Oops, no more place! Minz_Log::warning(_t('feedback.sub.feed.over_max', $limits['max_feeds'])); } else { $feed = $this->addFeedJson($item['origin'], $google_compliant); } - if (is_null($feed)) { + if ($feed == null) { // Still null? It means something went wrong. $error = true; } else { - // Nice! Increase the counter. - $nb_feeds += 1; + $nb_feeds++; } } - if (!is_null($feed)) { + if ($feed != null) { $article_to_feed[$item['id']] = $feed->id(); } } + $newGuids = array(); + foreach ($article_object['items'] as $item) { + $newGuids[] = safe_ascii($item['id']); + } + // For this feed, check existing GUIDs already in database. + $existingHashForGuids = $this->entryDAO->listHashForFeedGuids($feed->id(), $newGuids); + $newGuids = array(); + // Then, articles are imported. - $prepared_statement = $this->entryDAO->addEntryPrepare(); $this->entryDAO->beginTransaction(); foreach ($article_object['items'] as $item) { if (!isset($article_to_feed[$item['id']])) { @@ -371,13 +438,12 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $feed_id = $article_to_feed[$item['id']]; $author = isset($item['author']) ? $item['author'] : ''; - $key_content = ($google_compliant && !isset($item['content'])) ? - 'summary' : 'content'; + $key_content = ($google_compliant && !isset($item['content'])) ? 'summary' : 'content'; $tags = $item['categories']; if ($google_compliant) { // Remove tags containing "/state/com.google" which are useless. $tags = array_filter($tags, function($var) { - return strpos($var, '/state/com.google') === false; + return strpos($var, '/state/com.google') !== false; }); } @@ -389,22 +455,35 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $entry->_id(min(time(), $entry->date(true)) . uSecString()); $entry->_tags($tags); + if (isset($newGuids[$entry->guid()])) { + continue; //Skip subsequent articles with same GUID + } + $newGuids[$entry->guid()] = true; + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); - if (is_null($entry)) { + if ($entry == null) { // An extension has returned a null value, there is nothing to insert. continue; } $values = $entry->toArray(); - $id = $this->entryDAO->addEntry($values, $prepared_statement); - - if (!$error && ($id === false)) { - $error = true; + $ok = false; + if (isset($existingHashForGuids[$entry->guid()])) { + $ok = $this->entryDAO->updateEntry($values); + } else { + $ok = $this->entryDAO->addEntry($values); } + $error |= ($ok === false); + } $this->entryDAO->commit(); - return $error; + $this->entryDAO->beginTransaction(); + $this->entryDAO->commitNewEntries(); + $this->feedDAO->updateCachedValues(); + $this->entryDAO->commit(); + + return !$error; } /** @@ -416,8 +495,6 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * else null. */ private function addFeedJson($origin, $google_compliant) { - $default_cat = $this->catDAO->getDefault(); - $return = null; $key = $google_compliant ? 'htmlUrl' : 'feedUrl'; $url = $origin[$key]; @@ -427,13 +504,13 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { try { // Create a Feed object and add it in database. $feed = new FreshRSS_Feed($url); - $feed->_category($default_cat->id()); + $feed->_category(FreshRSS_CategoryDAO::DEFAULTCATEGORYID); $feed->_name($name); $feed->_website($website); // Call the extension hook $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); - if (!is_null($feed)) { + if ($feed != null) { // addFeedObject checks if feed is already in DB so nothing else to // check here. $id = $this->feedDAO->addFeedObject($feed); @@ -444,67 +521,100 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } } } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::warning($e->getMessage()); + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON feed import: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } } return $return; } - /** - * This action handles export action. - * - * This action must be reached by a POST request. - * - * Parameters are: - * - export_opml (default: false) - * - export_starred (default: false) - * - export_feeds (default: array()) a list of feed ids - */ - public function exportAction() { - if (!Minz_Request::isPost()) { - Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); - } + public function exportFile($export_opml = true, $export_starred = false, $export_feeds = array(), $maxFeedEntries = 50, $username = null) { + require_once(LIB_PATH . '/lib_opml.php'); - $this->view->_useLayout(false); + $this->catDAO = new FreshRSS_CategoryDAO($username); + $this->entryDAO = FreshRSS_Factory::createEntryDao($username); + $this->feedDAO = FreshRSS_Factory::createFeedDao($username); - $export_opml = Minz_Request::param('export_opml', false); - $export_starred = Minz_Request::param('export_starred', false); - $export_feeds = Minz_Request::param('export_feeds', array()); + $this->entryDAO->disableBuffering(); + + if ($export_feeds === true) { + //All feeds + $export_feeds = $this->feedDAO->listFeedsIds(); + } + if (!is_array($export_feeds)) { + $export_feeds = array(); + } + + $day = date('Y-m-d'); $export_files = array(); if ($export_opml) { - $export_files['feeds.opml'] = $this->generateOpml(); + $export_files["feeds_${day}.opml.xml"] = $this->generateOpml(); } if ($export_starred) { - $export_files['starred.json'] = $this->generateEntries('starred'); + $export_files["starred_${day}.json"] = $this->generateEntries('starred'); } foreach ($export_feeds as $feed_id) { $feed = $this->feedDAO->searchById($feed_id); if ($feed) { - $filename = 'feed_' . $feed->category() . '_' + $filename = "feed_${day}_" . $feed->category() . '_' . $feed->id() . '.json'; - $export_files[$filename] = $this->generateEntries('feed', $feed); + $export_files[$filename] = $this->generateEntries('feed', $feed, $maxFeedEntries); } } $nb_files = count($export_files); if ($nb_files > 1) { - // If there are more than 1 file to export, we need a zip archive. + // If there are more than 1 file to export, we need a ZIP archive. try { - $this->exportZip($export_files); + $this->sendZip($export_files); } catch (Exception $e) { - # Oops, there is no Zip extension! - Minz_Request::bad(_t('feedback.import_export.export_no_zip_extension'), - array('c' => 'importExport', 'a' => 'index')); + throw new FreshRSS_ZipMissing_Exception($e); } } elseif ($nb_files === 1) { // Only one file? Guess its type and export it. $filename = key($export_files); - $type = $this->guessFileType($filename); - $this->exportFile('freshrss_' . $filename, $export_files[$filename], $type); - } else { + $type = self::guessFileType($filename); + $this->sendFile('freshrss_' . $filename, $export_files[$filename], $type); + } + return $nb_files; + } + + /** + * This action handles export action. + * + * This action must be reached by a POST request. + * + * Parameters are: + * - export_opml (default: false) + * - export_starred (default: false) + * - export_feeds (default: array()) a list of feed ids + */ + public function exportAction() { + if (!Minz_Request::isPost()) { + Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); + } + $this->view->_useLayout(false); + + $nb_files = 0; + try { + $nb_files = $this->exportFile( + Minz_Request::param('export_opml', false), + Minz_Request::param('export_starred', false), + Minz_Request::param('export_feeds', array()) + ); + } catch (FreshRSS_ZipMissing_Exception $zme) { + # Oops, there is no ZIP extension! + Minz_Request::bad(_t('feedback.import_export.export_no_zip_extension'), + array('c' => 'importExport', 'a' => 'index')); + } + + if ($nb_files < 1) { // Nothing to do... Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); } @@ -533,22 +643,22 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * @param FreshRSS_Feed $feed feed of which we want to get entries. * @return string the JSON file content. */ - private function generateEntries($type, $feed = NULL) { + private function generateEntries($type, $feed = null, $maxFeedEntries = 50) { $this->view->categories = $this->catDAO->listCategories(); if ($type == 'starred') { $this->view->list_title = _t('sub.import_export.starred_list'); $this->view->type = 'starred'; $unread_fav = $this->entryDAO->countUnreadReadFavorites(); - $this->view->entries = $this->entryDAO->listWhere( + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( 's', '', FreshRSS_Entry::STATE_ALL, 'ASC', $unread_fav['all'] ); - } elseif ($type == 'feed' && !is_null($feed)) { + } elseif ($type === 'feed' && $feed != null) { $this->view->list_title = _t('sub.import_export.feed_list', $feed->name()); $this->view->type = 'feed/' . $feed->id(); - $this->view->entries = $this->entryDAO->listWhere( + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', - FreshRSS_Context::$user_conf->posts_per_page + $maxFeedEntries ); $this->view->feed = $feed; } @@ -562,7 +672,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * @param array $files list of files where key is filename and value the content. * @throws Exception if Zip extension is not loaded. */ - private function exportZip($files) { + private function sendZip($files) { if (!extension_loaded('zip')) { throw new Exception(); } @@ -580,7 +690,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $zip->close(); header('Content-Type: application/zip'); header('Content-Length: ' . filesize($zip_file)); - header('Content-Disposition: attachment; filename="freshrss_export.zip"'); + $day = date('Y-m-d'); + header('Content-Disposition: attachment; filename="freshrss_' . $day . '_export.zip"'); readfile($zip_file); unlink($zip_file); } @@ -593,16 +704,16 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * @param string $type the file type (opml, json_feed or json_starred). * If equals to unknown, nothing happens. */ - private function exportFile($filename, $content, $type) { + private function sendFile($filename, $content, $type) { if ($type === 'unknown') { return; } $content_type = ''; if ($type === 'opml') { - $content_type = "text/opml"; + $content_type = 'application/xml'; } elseif ($type === 'json_feed' || $type === 'json_starred') { - $content_type = "text/json"; + $content_type = 'application/json'; } header('Content-Type: ' . $content_type . '; charset=utf-8'); diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index c53d3223e..e8dde36fa 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -32,42 +32,44 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(404); } - try { - $entries = $this->listEntriesByContext(); - - $nb_entries = count($entries); - if ($nb_entries > FreshRSS_Context::$number) { - // We have more elements for pagination - $last_entry = array_pop($entries); - FreshRSS_Context::$next_id = $last_entry->id(); - } + $this->view->callbackBeforeContent = function($view) { + try { + FreshRSS_Context::$number++; //+1 for pagination + $entries = FreshRSS_index_Controller::listEntriesByContext(); + FreshRSS_Context::$number--; + + $nb_entries = count($entries); + if ($nb_entries > FreshRSS_Context::$number) { + // We have more elements for pagination + $last_entry = array_pop($entries); + FreshRSS_Context::$next_id = $last_entry->id(); + } - $first_entry = $nb_entries > 0 ? $entries[0] : null; - FreshRSS_Context::$id_max = $first_entry === null ? - (time() - 1) . '000000' : - $first_entry->id(); - if (FreshRSS_Context::$order === 'ASC') { - // In this case we do not know but we guess id_max - $id_max = (time() - 1) . '000000'; - if (strcmp($id_max, FreshRSS_Context::$id_max) > 0) { - FreshRSS_Context::$id_max = $id_max; + $first_entry = $nb_entries > 0 ? $entries[0] : null; + FreshRSS_Context::$id_max = $first_entry === null ? (time() - 1) . '000000' : $first_entry->id(); + if (FreshRSS_Context::$order === 'ASC') { + // In this case we do not know but we guess id_max + $id_max = (time() - 1) . '000000'; + if (strcmp($id_max, FreshRSS_Context::$id_max) > 0) { + FreshRSS_Context::$id_max = $id_max; + } } - } - $this->view->entries = $entries; - } catch (FreshRSS_EntriesGetter_Exception $e) { - Minz_Log::notice($e->getMessage()); - Minz_Error::error(404); - } + $view->entries = $entries; + } catch (FreshRSS_EntriesGetter_Exception $e) { + Minz_Log::notice($e->getMessage()); + Minz_Error::error(404); + } - $this->view->categories = FreshRSS_Context::$categories; + $view->categories = FreshRSS_Context::$categories; - $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); - $title = FreshRSS_Context::$name; - if (FreshRSS_Context::$get_unread > 0) { - $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; - } - Minz_View::prependTitle($title . ' · '); + $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = FreshRSS_Context::$name; + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; + } + Minz_View::prependTitle($title . ' · '); + }; } /** @@ -130,13 +132,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { } try { - $this->view->entries = $this->listEntriesByContext(); + $this->view->entries = FreshRSS_index_Controller::listEntriesByContext(); } catch (FreshRSS_EntriesGetter_Exception $e) { Minz_Log::notice($e->getMessage()); Minz_Error::error(404); } // No layout for RSS output. + $this->view->url = empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']; $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); $this->view->_useLayout(false); header('Content-Type: application/rss+xml; charset=utf-8'); @@ -151,8 +154,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { * - order (default: conf->sort_order) * - nb (default: conf->posts_per_page) * - next (default: empty string) + * - hours (default: 0) */ private function updateContext() { + if (empty(FreshRSS_Context::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + FreshRSS_Context::$categories = $catDAO->listCategories(); + } + // Update number of read / unread variables. $entryDAO = FreshRSS_Factory::createEntryDao(); FreshRSS_Context::$total_starred = $entryDAO->countUnreadReadFavorites(); @@ -173,20 +182,24 @@ class FreshRSS_index_Controller extends Minz_ActionController { FreshRSS_Context::$state |= FreshRSS_Entry::STATE_READ; } - FreshRSS_Context::$search = Minz_Request::param('search', ''); + FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', '')); FreshRSS_Context::$order = Minz_Request::param( 'order', FreshRSS_Context::$user_conf->sort_order ); - FreshRSS_Context::$number = Minz_Request::param( - 'nb', FreshRSS_Context::$user_conf->posts_per_page - ); + FreshRSS_Context::$number = intval(Minz_Request::param('nb', FreshRSS_Context::$user_conf->posts_per_page)); + if (FreshRSS_Context::$number > FreshRSS_Context::$user_conf->max_posts_per_rss) { + FreshRSS_Context::$number = max( + FreshRSS_Context::$user_conf->max_posts_per_rss, + FreshRSS_Context::$user_conf->posts_per_page); + } FreshRSS_Context::$first_id = Minz_Request::param('next', ''); + FreshRSS_Context::$sinceHours = intval(Minz_Request::param('hours', 0)); } /** * This method returns a list of entries based on the Context object. */ - private function listEntriesByContext() { + public static function listEntriesByContext() { $entryDAO = FreshRSS_Factory::createEntryDao(); $get = FreshRSS_Context::currentGet(true); @@ -198,11 +211,31 @@ class FreshRSS_index_Controller extends Minz_ActionController { $id = ''; } - return $entryDAO->listWhere( + $limit = FreshRSS_Context::$number; + + $date_min = 0; + if (FreshRSS_Context::$sinceHours) { + $date_min = time() - (FreshRSS_Context::$sinceHours * 3600); + $limit = FreshRSS_Context::$user_conf->max_posts_per_rss; + } + + $entries = $entryDAO->listWhere( $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, - FreshRSS_Context::$number + 1, FreshRSS_Context::$first_id, - FreshRSS_Context::$search + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min ); + + if (FreshRSS_Context::$sinceHours && (count($entries) < FreshRSS_Context::$user_conf->min_posts_per_rss)) { + $date_min = 0; + $limit = FreshRSS_Context::$user_conf->min_posts_per_rss; + $entries = $entryDAO->listWhere( + $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min + ); + } + + return $entries; } /** diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 421cf6f72..6336106a9 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -6,7 +6,7 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { } public function actualizeAction() { - header('Content-Type: text/javascript; charset=UTF-8'); + header('Content-Type: application/json; charset=UTF-8'); $feedDAO = FreshRSS_Factory::createFeedDao(); $this->view->feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$user_conf->ttl_default); } @@ -26,7 +26,7 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { header('Pragma: no-cache'); $user = isset($_GET['user']) ? $_GET['user'] : ''; - if (ctype_alnum($user)) { + if (FreshRSS_user_Controller::checkUsername($user)) { try { $salt = FreshRSS_Context::$system_conf->salt; $conf = get_user_configuration($user); @@ -43,7 +43,12 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { } else { Minz_Log::notice('Nonce failure due to invalid username!'); } - $this->view->nonce = ''; //Failure - $this->view->salt1 = ''; + //Failure: Return random data. + $this->view->salt1 = sprintf('$2a$%02d$', FreshRSS_user_Controller::BCRYPT_COST); + $alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for ($i = 22; $i > 0; $i--) { + $this->view->salt1 .= $alphabet[rand(0, 63)]; + } + $this->view->nonce = sha1(rand()); } } diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 4a597ae7d..5d1dee72c 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -18,6 +18,27 @@ class FreshRSS_stats_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('admin.stats.title') . ' · '); } + private function convertToSerie($data) { + $serie = array(); + + foreach ($data as $key => $value) { + $serie[] = array($key, $value); + } + + return $serie; + } + + private function convertToPieSerie($data) { + $serie = array(); + + foreach ($data as $value) { + $value['data'] = array(array(0, (int) $value['data'])); + $serie[] = $value; + } + + return $serie; + } + /** * This action handles the statistic main page. * @@ -33,10 +54,11 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $statsDAO = FreshRSS_Factory::createStatsDAO(); 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->average = $statsDAO->calculateEntryAverage(); - $this->view->feedByCategory = $statsDAO->calculateFeedByCategory(); - $this->view->entryByCategory = $statsDAO->calculateEntryByCategory(); + $entryCount = $statsDAO->calculateEntryCount(); + $this->view->count = $this->convertToSerie($entryCount); + $this->view->average = round(array_sum(array_values($entryCount)) / count($entryCount), 2); + $this->view->feedByCategory = $this->convertToPieSerie($statsDAO->calculateFeedByCategory()); + $this->view->entryByCategory = $this->convertToPieSerie($statsDAO->calculateEntryByCategory()); $this->view->topFeed = $statsDAO->calculateTopFeed(); } @@ -118,11 +140,11 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->days = $statsDAO->getDays(); $this->view->months = $statsDAO->getMonths(); $this->view->repartition = $statsDAO->calculateEntryRepartitionPerFeed($id); - $this->view->repartitionHour = $statsDAO->calculateEntryRepartitionPerFeedPerHour($id); + $this->view->repartitionHour = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerHour($id)); $this->view->averageHour = $statsDAO->calculateEntryAveragePerFeedPerHour($id); - $this->view->repartitionDayOfWeek = $statsDAO->calculateEntryRepartitionPerFeedPerDayOfWeek($id); + $this->view->repartitionDayOfWeek = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerDayOfWeek($id)); $this->view->averageDayOfWeek = $statsDAO->calculateEntryAveragePerFeedPerDayOfWeek($id); - $this->view->repartitionMonth = $statsDAO->calculateEntryRepartitionPerFeedPerMonth($id); + $this->view->repartitionMonth = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerMonth($id)); $this->view->averageMonth = $statsDAO->calculateEntryAveragePerFeedPerMonth($id); } } diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 333565faf..6af048b84 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -77,11 +77,11 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $this->view->feed->name() . ' · '); if (Minz_Request::isPost()) { - $user = Minz_Request::param('http_user', ''); - $pass = Minz_Request::param('http_pass', ''); + $user = trim(Minz_Request::param('http_user_feed' . $id, '')); + $pass = Minz_Request::param('http_pass_feed' . $id, ''); $httpAuth = ''; - if ($user != '' || $pass != '') { + if ($user != '' && $pass != '') { //TODO: Sanitize $httpAuth = $user . ':' . $pass; } @@ -90,8 +90,8 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $values = array( 'name' => Minz_Request::param('name', ''), 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), - 'website' => Minz_Request::param('website', ''), - 'url' => Minz_Request::param('url', ''), + 'website' => checkUrl(Minz_Request::param('website', '')), + 'url' => checkUrl(Minz_Request::param('url', '')), 'category' => $cat, 'pathEntries' => Minz_Request::param('path_entries', ''), 'priority' => intval(Minz_Request::param('priority', 0)), @@ -113,4 +113,11 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { } } } + + /** + * This action displays the bookmarklet page. + */ + public function bookmarkletAction() { + Minz_View::prependTitle(_t('sub.title.subscription_tools') . ' . '); + } } diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 4797a3486..c67b358bb 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -2,6 +2,45 @@ class FreshRSS_update_Controller extends Minz_ActionController { + public static function isGit() { + return is_dir(FRESHRSS_PATH . '/.git/'); + } + + public static function hasGitUpdate() { + $cwd = getcwd(); + chdir(FRESHRSS_PATH); + $output = array(); + try { + exec('git fetch', $output, $return); + if ($return == 0) { + exec('git status -sb --porcelain remote', $output, $return); + } else { + $line = is_array($output) ? implode('; ', $output) : '' . $output; + Minz_Log::warning('git fetch warning:' . $line); + } + } catch (Exception $e) { + Minz_Log::warning('git fetch error:' . $e->getMessage()); + } + chdir($cwd); + $line = is_array($output) ? implode('; ', $output) : '' . $output; + return strpos($line, '[behind') !== false; + } + + public static function gitPull() { + $cwd = getcwd(); + chdir(FRESHRSS_PATH); + $output = array(); + $return = 1; + try { + exec('git pull --ff-only', $output, $return); + } catch (Exception $e) { + Minz_Log::warning('git pull error:' . $e->getMessage()); + } + chdir($cwd); + $line = is_array($output) ? implode('; ', $output) : '' . $output; + return $return == 0 ? true : 'Git error: ' . $line; + } + public function firstAction() { if (!FreshRSS_Auth::hasAccess('admin')) { Minz_Error::error(403); @@ -20,24 +59,26 @@ class FreshRSS_update_Controller extends Minz_ActionController { public function indexAction() { Minz_View::prependTitle(_t('admin.update.title') . ' · '); - if (file_exists(UPDATE_FILENAME) && !is_writable(FRESHRSS_PATH)) { - $this->view->message = array( - 'status' => 'bad', - 'title' => _t('gen.short.damn'), - 'body' => _t('feedback.update.file_is_nok', FRESHRSS_PATH) - ); - } elseif (file_exists(UPDATE_FILENAME)) { + if (file_exists(UPDATE_FILENAME)) { // There is an update file to apply! $version = @file_get_contents(join_path(DATA_PATH, 'last_update.txt')); - if (empty($version)) { + if ($version == '') { $version = 'unknown'; } - $this->view->update_to_apply = true; - $this->view->message = array( - 'status' => 'good', - 'title' => _t('gen.short.ok'), - 'body' => _t('feedback.update.can_apply', $version) - ); + if (is_writable(FRESHRSS_PATH)) { + $this->view->update_to_apply = true; + $this->view->message = array( + 'status' => 'good', + 'title' => _t('gen.short.ok'), + 'body' => _t('feedback.update.can_apply', $version), + ); + } else { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.file_is_nok', $version, FRESHRSS_PATH), + ); + } } } @@ -53,48 +94,65 @@ class FreshRSS_update_Controller extends Minz_ActionController { return; } - $c = curl_init(FRESHRSS_UPDATE_WEBSITE); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); - $result = curl_exec($c); - $c_status = curl_getinfo($c, CURLINFO_HTTP_CODE); - $c_error = curl_error($c); - curl_close($c); - - if ($c_status !== 200) { - Minz_Log::error( - 'Error during update (HTTP code ' . $c_status . '): ' . $c_error - ); + $script = ''; + $version = ''; - $this->view->message = array( - 'status' => 'bad', - 'title' => _t('gen.short.damn'), - 'body' => _t('feedback.update.server_not_found', FRESHRSS_UPDATE_WEBSITE) - ); - return; - } - - $res_array = explode("\n", $result, 2); - $status = $res_array[0]; - if (strpos($status, 'UPDATE') !== 0) { - $this->view->message = array( - 'status' => 'bad', - 'title' => _t('gen.short.damn'), - 'body' => _t('feedback.update.none') - ); + if (self::isGit()) { + if (self::hasGitUpdate()) { + $version = 'git'; + } else { + $this->view->message = array( + 'status' => 'latest', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.none') + ); + @touch(join_path(DATA_PATH, 'last_update.txt')); + return; + } + } else { + $auto_update_url = FreshRSS_Context::$system_conf->auto_update_url . '?v=' . FRESHRSS_VERSION; + Minz_Log::debug('HTTP GET ' . $auto_update_url); + $c = curl_init($auto_update_url); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + $result = curl_exec($c); + $c_status = curl_getinfo($c, CURLINFO_HTTP_CODE); + $c_error = curl_error($c); + curl_close($c); + + if ($c_status !== 200) { + Minz_Log::warning( + 'Error during update (HTTP code ' . $c_status . '): ' . $c_error + ); + + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.server_not_found', $auto_update_url) + ); + return; + } - @touch(join_path(DATA_PATH, 'last_update.txt')); + $res_array = explode("\n", $result, 2); + $status = $res_array[0]; + if (strpos($status, 'UPDATE') !== 0) { + $this->view->message = array( + 'status' => 'latest', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.none') + ); + @touch(join_path(DATA_PATH, 'last_update.txt')); + return; + } - return; + $script = $res_array[1]; + $version = explode(' ', $status, 2); + $version = $version[1]; } - $script = $res_array[1]; if (file_put_contents(UPDATE_FILENAME, $script) !== false) { - $version = explode(' ', $status, 2); - $version = $version[1]; @file_put_contents(join_path(DATA_PATH, 'last_update.txt'), $version); - Minz_Request::forward(array('c' => 'update'), true); } else { $this->view->message = array( @@ -106,14 +164,17 @@ class FreshRSS_update_Controller extends Minz_ActionController { } public function applyAction() { - if (!file_exists(UPDATE_FILENAME) || !is_writable(FRESHRSS_PATH)) { + if (!file_exists(UPDATE_FILENAME) || !is_writable(FRESHRSS_PATH) || Minz_Configuration::get('system')->disable_update) { Minz_Request::forward(array('c' => 'update'), true); } - require(UPDATE_FILENAME); - if (Minz_Request::param('post_conf', false)) { - $res = do_post_update(); + if (self::isGit()) { + $res = !self::hasGitUpdate(); + } else { + require(UPDATE_FILENAME); + $res = do_post_update(); + } Minz_ExtensionManager::callHook('post_update'); @@ -125,14 +186,22 @@ class FreshRSS_update_Controller extends Minz_ActionController { Minz_Request::bad(_t('feedback.update.error', $res), array('c' => 'update', 'a' => 'index')); } - } - - if (Minz_Request::isPost()) { - save_info_update(); - } + } else { + $res = false; - if (!need_info_update()) { - $res = apply_update(); + if (self::isGit()) { + $res = self::gitPull(); + } else { + require(UPDATE_FILENAME); + if (Minz_Request::isPost()) { + save_info_update(); + } + if (!need_info_update()) { + $res = apply_update(); + } else { + return; + } + } if ($res === true) { Minz_Request::forward(array( diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index ed01b83c5..2a1d43d9e 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -12,63 +12,83 @@ class FreshRSS_user_Controller extends Minz_ActionController { * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the * underlying framework. + * + * @todo clean up the access condition. */ public function firstAction() { - if (!FreshRSS_Auth::hasAccess()) { + if (!FreshRSS_Auth::hasAccess() && !( + Minz_Request::actionName() === 'create' && + !max_registrations_reached() + )) { Minz_Error::error(403); } } + public static function hashPassword($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 + return $passwordHash == '' ? '' : $passwordHash; + } + /** - * This action displays the user profile page. + * The username is also used as folder name, file name, and part of SQL table name. + * '_' is a reserved internal username. */ - public function profileAction() { - Minz_View::prependTitle(_t('conf.profile.title') . ' · '); + const USERNAME_PATTERN = '[0-9a-zA-Z_]{2,38}|[0-9a-zA-Z]'; - if (Minz_Request::isPost()) { - $ok = true; + public static function checkUsername($username) { + return preg_match('/^' . self::USERNAME_PATTERN . '$/', $username) === 1; + } - $passwordPlain = Minz_Request::param('passwordPlain', '', true); - 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 != ''); - FreshRSS_Context::$user_conf->passwordHash = $passwordHash; - } - Minz_Session::_param('passwordHash', FreshRSS_Context::$user_conf->passwordHash); + public static function updateContextUser($passwordPlain, $apiPasswordPlain, $userConfigUpdated = array()) { + if ($passwordPlain != '') { + $passwordHash = self::hashPassword($passwordPlain); + FreshRSS_Context::$user_conf->passwordHash = $passwordHash; + } - $passwordPlain = Minz_Request::param('apiPasswordPlain', '', true); - if ($passwordPlain != '') { - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); + if ($apiPasswordPlain != '') { + $apiPasswordHash = self::hashPassword($apiPasswordPlain); + FreshRSS_Context::$user_conf->apiPasswordHash = $apiPasswordHash; + } + + if (is_array($userConfigUpdated)) { + foreach ($userConfigUpdated as $configName => $configValue) { + if ($configValue !== null) { + FreshRSS_Context::$user_conf->_param($configName, $configValue); } - $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 != ''); - FreshRSS_Context::$user_conf->apiPasswordHash = $passwordHash; } + } - // TODO: why do we need of hasAccess here? - if (FreshRSS_Auth::hasAccess('admin')) { - FreshRSS_Context::$user_conf->mail_login = Minz_Request::param('mail_login', '', true); - } - $email = FreshRSS_Context::$user_conf->mail_login; - Minz_Session::_param('mail', $email); + $ok = FreshRSS_Context::$user_conf->save(); + return $ok; + } + + /** + * This action displays the user profile page. + */ + public function profileAction() { + Minz_View::prependTitle(_t('conf.profile.title') . ' · '); - $ok &= FreshRSS_Context::$user_conf->save(); + Minz_View::appendScript(Minz_Url::display( + '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') + )); - if ($email != '') { - $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false); - } + if (Minz_Request::isPost()) { + $passwordPlain = Minz_Request::param('newPasswordPlain', '', true); + Minz_Request::_param('newPasswordPlain'); //Discard plain-text password ASAP + $_POST['newPasswordPlain'] = ''; + + $apiPasswordPlain = Minz_Request::param('apiPasswordPlain', '', true); + + $ok = self::updateContextUser($passwordPlain, $apiPasswordPlain, array( + 'token' => Minz_Request::param('token', null), + )); + + Minz_Session::_param('passwordHash', FreshRSS_Context::$user_conf->passwordHash); if ($ok) { Minz_Request::good(_t('feedback.profile.updated'), @@ -100,72 +120,82 @@ class FreshRSS_user_Controller extends Minz_ActionController { // Get information about the current user. $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user); $this->view->nb_articles = $entryDAO->count(); - $this->view->size_user = $entryDAO->size(); + + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $this->view->size_user = $databaseDAO->size(); } - public function createAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { - $db = FreshRSS_Context::$system_conf->db; - require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + public static function createUser($new_user_name, $passwordPlain, $apiPasswordPlain, $userConfig = array(), $insertDefaultFeeds = true) { + if (!is_array($userConfig)) { + $userConfig = array(); + } - $new_user_language = Minz_Request::param('new_user_language', FreshRSS_Context::$user_conf->language); + $ok = self::checkUsername($new_user_name); + $homeDir = join_path(DATA_PATH, 'users', $new_user_name); + + if ($ok) { $languages = Minz_Translate::availableLanguages(); - if (!isset($languages[$new_user_language])) { - $new_user_language = FreshRSS_Context::$user_conf->language; + if (empty($userConfig['language']) || !in_array($userConfig['language'], $languages)) { + $userConfig['language'] = 'en'; } - $new_user_name = Minz_Request::param('new_user_name'); - $ok = ($new_user_name != '') && ctype_alnum($new_user_name); - - if ($ok) { - $default_user = FreshRSS_Context::$system_conf->default_user; - $ok &= (strcasecmp($new_user_name, $default_user) !== 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 + $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive - $configPath = join_path(DATA_PATH, 'users', $new_user_name, 'config.php'); - $ok &= !file_exists($configPath); + $configPath = join_path($homeDir, 'config.php'); + $ok &= !file_exists($configPath); + } + if ($ok) { + $passwordHash = ''; + if ($passwordPlain != '') { + $passwordHash = self::hashPassword($passwordPlain); + $ok &= ($passwordHash != ''); } - if ($ok) { - $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); - $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 = join_path(DATA_PATH, 'persona', $new_user_email . '.txt'); - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, $new_user_name) !== false); - } + $apiPasswordHash = ''; + if ($apiPasswordPlain != '') { + $apiPasswordHash = self::hashPassword($apiPasswordPlain); + $ok &= ($apiPasswordHash != ''); } - if ($ok) { - mkdir(join_path(DATA_PATH, 'users', $new_user_name)); - $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); + } + if ($ok) { + if (!is_dir($homeDir)) { + mkdir($homeDir); } + $userConfig['passwordHash'] = $passwordHash; + $userConfig['apiPasswordHash'] = $apiPasswordHash; + $ok &= (file_put_contents($configPath, "<?php\n return " . var_export($userConfig, true) . ';') !== false); + } + if ($ok) { + $userDAO = new FreshRSS_UserDAO(); + $ok &= $userDAO->createUser($new_user_name, $userConfig['language'], $insertDefaultFeeds); + } + return $ok; + } + + /** + * This action creates a new user. + * + * Request parameters are: + * - new_user_language + * - new_user_name + * - new_user_passwordPlain + * - r (i.e. a redirection url, optional) + * + * @todo clean up this method. Idea: write a method to init a user with basic information. + * @todo handle r redirection in Minz_Request::forward directly? + */ + public function createAction() { + if (Minz_Request::isPost() && ( + FreshRSS_Auth::hasAccess('admin') || + !max_registrations_reached() + )) { + $new_user_name = Minz_Request::param('new_user_name'); + $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); + $new_user_language = Minz_Request::param('new_user_language', FreshRSS_Context::$user_conf->language); + + $ok = self::createUser($new_user_name, $passwordPlain, '', array('language' => $new_user_language)); + Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP + $_POST['new_user_passwordPlain'] = ''; invalidateHttpCache(); $notif = array( @@ -175,30 +205,73 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); } - Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } + Minz_Request::forward($redirect_url, true); + } + + public static function deleteUser($username) { + $db = FreshRSS_Context::$system_conf->db; + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + $ok = self::checkUsername($username); + if ($ok) { + $default_user = FreshRSS_Context::$system_conf->default_user; + $ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user + } + $user_data = join_path(DATA_PATH, 'users', $username); + if ($ok) { + $ok &= is_dir($user_data); + } + if ($ok) { + $userDAO = new FreshRSS_UserDAO(); + $ok &= $userDAO->deleteUser($username); + $ok &= recursive_unlink($user_data); + array_map('unlink', glob(PSHB_PATH . '/feeds/*/' . $username . '.txt')); + } + return $ok; } + /** + * This action delete an existing user. + * + * Request parameter is: + * - username + * + * @todo clean up this method. Idea: create a User->clean() method. + */ public function deleteAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { - $db = FreshRSS_Context::$system_conf->db; - require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + $username = Minz_Request::param('username'); + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } - $username = Minz_Request::param('username'); - $ok = ctype_alnum($username); - $user_data = join_path(DATA_PATH, 'users', $username); + $self_deletion = Minz_Session::param('currentUser', '_') === $username; - if ($ok) { - $default_user = FreshRSS_Context::$system_conf->default_user; - $ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user + if (Minz_Request::isPost() && ( + FreshRSS_Auth::hasAccess('admin') || + $self_deletion + )) { + $ok = true; + if ($ok && $self_deletion) { + // We check the password if it's a self-destruction + $nonce = Minz_Session::param('nonce'); + $challenge = Minz_Request::param('challenge', ''); + + $ok &= FreshRSS_FormAuth::checkCredentials( + $username, FreshRSS_Context::$user_conf->passwordHash, + $nonce, $challenge + ); } if ($ok) { - $ok &= is_dir($user_data); + $ok &= self::deleteUser($username); } - if ($ok) { - $userDAO = new FreshRSS_UserDAO(); - $ok &= $userDAO->deleteUser($username); - $ok &= recursive_unlink($user_data); - //TODO: delete Persona file + if ($ok && $self_deletion) { + FreshRSS_Auth::removeAccess(); + $redirect_url = array('c' => 'index', 'a' => 'index'); } invalidateHttpCache(); @@ -209,6 +282,6 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); } - Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + Minz_Request::forward($redirect_url, true); } } diff --git a/app/Exceptions/AlreadySubscribedException.php b/app/Exceptions/AlreadySubscribedException.php new file mode 100644 index 000000000..33b9f9555 --- /dev/null +++ b/app/Exceptions/AlreadySubscribedException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_AlreadySubscribed_Exception extends Exception { + private $feedName = ''; + + public function __construct($url, $feedName) { + parent::__construct('Already subscribed! ' . $url, 2135); + $this->feedName = $feedName; + } + + public function feedName() { + return $this->feedName; + } +} diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php index 59574e1e5..d2509e4ba 100644 --- a/app/Exceptions/BadUrlException.php +++ b/app/Exceptions/BadUrlException.php @@ -1,6 +1,9 @@ <?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/ContextException.php b/app/Exceptions/ContextException.php index 357751b7c..00934cbfd 100644 --- a/app/Exceptions/ContextException.php +++ b/app/Exceptions/ContextException.php @@ -4,7 +4,5 @@ * An exception raised when a context is invalid */ class FreshRSS_Context_Exception extends Exception { - public function __construct($message) { - parent::__construct($message); - } + } diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php new file mode 100644 index 000000000..14bee3403 --- /dev/null +++ b/app/Exceptions/DAOException.php @@ -0,0 +1,5 @@ +<?php + +class FreshRSS_DAO_Exception extends Exception { + +} diff --git a/app/Exceptions/EntriesGetterException.php b/app/Exceptions/EntriesGetterException.php index 5f47c830b..3b76195ee 100644 --- a/app/Exceptions/EntriesGetterException.php +++ b/app/Exceptions/EntriesGetterException.php @@ -1,7 +1,5 @@ <?php class FreshRSS_EntriesGetter_Exception extends Exception { - public function __construct($message) { - parent::__construct($message); - } + } diff --git a/app/Exceptions/FeedException.php b/app/Exceptions/FeedException.php index 2433b3964..abfcbce79 100644 --- a/app/Exceptions/FeedException.php +++ b/app/Exceptions/FeedException.php @@ -1,6 +1,5 @@ <?php + class FreshRSS_Feed_Exception extends Exception { - public function __construct($message) { - parent::__construct($message); - } + } diff --git a/app/Exceptions/FeedNotAddedException.php b/app/Exceptions/FeedNotAddedException.php new file mode 100644 index 000000000..350a17c56 --- /dev/null +++ b/app/Exceptions/FeedNotAddedException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_FeedNotAdded_Exception extends Exception { + private $feedName = ''; + + public function __construct($url, $feedName) { + parent::__construct('Feed not added! ' . $url, 2147); + $this->feedName = $feedName; + } + + public function feedName() { + return $this->feedName; + } +} diff --git a/app/Exceptions/ZipException.php b/app/Exceptions/ZipException.php new file mode 100644 index 000000000..ad01b87ea --- /dev/null +++ b/app/Exceptions/ZipException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_Zip_Exception extends Exception { + private $zipErrorCode = 0; + + public function __construct($zipErrorCode) { + parent::__construct('ZIP error! ' . $url, 2141); + $this->zipErrorCode = $zipErrorCode; + } + + public function zipErrorCode() { + return $this->zipErrorCode; + } +} diff --git a/app/Exceptions/ZipMissingException.php b/app/Exceptions/ZipMissingException.php new file mode 100644 index 000000000..864cc3991 --- /dev/null +++ b/app/Exceptions/ZipMissingException.php @@ -0,0 +1,4 @@ +<?php + +class FreshRSS_ZipMissing_Exception extends Exception { +} diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 021687999..f53c85bfb 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -34,54 +34,53 @@ class FreshRSS extends Minz_FrontController { // Auth has to be initialized before using currentUser session parameter // because it's this part which create this parameter. - $this->initAuth(); + self::initAuth(); // Then, register the user configuration and use the configuration setter // created above. $current_user = Minz_Session::param('currentUser', '_'); Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php'), + join_path(FRESHRSS_PATH, 'config-user.default.php'), $configuration_setter); // Finish to initialize the other FreshRSS / Minz components. FreshRSS_Context::init(); - $this->initI18n(); - FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); - $this->loadStylesAndScripts(); - $this->loadNotifications(); + self::initI18n(); + self::loadNotifications(); // Enable extensions for the current (logged) user. - if (FreshRSS_Auth::hasAccess()) { + if (FreshRSS_Auth::hasAccess() || $system_conf->allow_anonymous) { $ext_list = FreshRSS_Context::$user_conf->extensions_enabled; Minz_ExtensionManager::enableByList($ext_list); } } - private function initAuth() { + private static function initAuth() { FreshRSS_Auth::init(); - if (Minz_Request::isPost() && !is_referer_from_same_domain()) { + if (Minz_Request::isPost() && !(is_referer_from_same_domain() && FreshRSS_Auth::isCsrfOk())) { // Basic protection against XSRF attacks FreshRSS_Auth::removeAccess(); $http_referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; + Minz_Translate::init('en'); //TODO: Better choice of fallback language Minz_Error::error( 403, array('error' => array( - _t('access_denied'), + _t('feedback.access.denied'), ' [HTTP_REFERER=' . htmlspecialchars($http_referer) . ']' )) ); } } - private function initI18n() { + private static function initI18n() { Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); Minz_Translate::init(FreshRSS_Context::$user_conf->language); } - private function loadStylesAndScripts() { + public static function loadStylesAndScripts() { $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { - foreach($theme['files'] as $file) { + foreach(array_reverse($theme['files']) as $file) { if ($file[0] === '_') { $theme_id = 'base-theme'; $filename = substr($file, 1); @@ -90,30 +89,46 @@ class FreshRSS extends Minz_FrontController { $filename = $file; } $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename); - Minz_View::appendStyle(Minz_Url::display( - '/themes/' . $theme_id . '/' . $filename . '?' . $filetime - )); + $url = '/themes/' . $theme_id . '/' . $filename . '?' . $filetime; + header('Link: <' . Minz_Url::display($url, '', 'root') . '>;rel=preload', false); //HTTP2 + Minz_View::prependStyle(Minz_Url::display($url)); } } - - Minz_View::appendScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.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'))); - - if (FreshRSS_Context::$system_conf->auth_type === 'persona') { - // TODO move it in a plugin - // Needed for login AND logout with Persona. - Minz_View::appendScript('https://login.persona.org/include.js'); - $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/persona.js'); - Minz_View::appendScript(Minz_Url::display('/scripts/persona.js?' . $file_mtime)); - } + //Use prepend to insert before extensions. Added in reverse order. + Minz_View::prependScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); + Minz_View::prependScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); + Minz_View::prependScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js'))); } - private function loadNotifications() { + private static function loadNotifications() { $notif = Minz_Session::param('notification'); if ($notif) { Minz_View::_param('notification', $notif); Minz_Session::_param('notification'); } } + + public static function preLayout() { + switch (Minz_Request::controllerName()) { + case 'index': + $urlToAuthorize = array_filter(array_map(function ($a) { + if (isset($a['method']) && $a['method'] === 'POST') { + return $a['url']; + } + }, FreshRSS_Context::$user_conf->sharing)); + $connectSrc = count($urlToAuthorize) ? sprintf("; connect-src 'self' %s", implode(' ', $urlToAuthorize)) : ''; + header(sprintf("Content-Security-Policy: default-src 'self'; child-src *; frame-src *; img-src * data:; media-src *%s", $connectSrc)); + break; + case 'stats': + header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'"); + break; + default: + header("Content-Security-Policy: default-src 'self'"); + break; + } + header("X-Content-Type-Options: nosniff"); + + FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); + self::loadStylesAndScripts(); + } } diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 4e7a71947..4de058999 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -25,7 +25,7 @@ class FreshRSS_Auth { self::giveAccess(); } elseif (self::accessControl()) { self::giveAccess(); - FreshRSS_UserDAO::touch($current_user); + FreshRSS_UserDAO::touch(); } else { // Be sure all accesses are removed! self::removeAccess(); @@ -60,16 +60,6 @@ class FreshRSS_Auth { Minz_Session::_param('currentUser', $current_user); } return $login_ok; - case 'persona': - $email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL); - $persona_file = DATA_PATH . '/persona/' . $email . '.txt'; - if (($current_user = @file_get_contents($persona_file)) !== false) { - $current_user = trim($current_user); - Minz_Session::_param('currentUser', $current_user); - Minz_Session::_param('mail', $email); - return true; - } - return false; case 'none': return true; default: @@ -84,6 +74,10 @@ class FreshRSS_Auth { public static function giveAccess() { $current_user = Minz_Session::param('currentUser'); $user_conf = get_user_configuration($current_user); + if ($user_conf == null) { + self::$login_ok = false; + return; + } $system_conf = Minz_Configuration::get('system'); switch ($system_conf->auth_type) { @@ -93,9 +87,6 @@ class FreshRSS_Auth { case 'http_auth': self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0; break; - case 'persona': - self::$login_ok = strcasecmp(Minz_Session::param('mail'), $user_conf->mail_login) === 0; - break; case 'none': self::$login_ok = true; break; @@ -133,19 +124,32 @@ class FreshRSS_Auth { * Removes all accesses for the current user. */ public static function removeAccess() { - Minz_Session::_param('loginOk'); self::$login_ok = false; - $conf = Minz_Configuration::get('system'); - Minz_Session::_param('currentUser', $conf->default_user); + Minz_Session::_param('loginOk'); + Minz_Session::_param('csrf'); + $system_conf = Minz_Configuration::get('system'); + + $username = ''; + $token_param = Minz_Request::param('token', ''); + if ($token_param != '') { + $username = trim(Minz_Request::param('user', '')); + if ($username != '') { + $conf = get_user_configuration($username); + if ($conf == null) { + $username = ''; + } + } + } + if ($username == '') { + $username = $system_conf->default_user; + } + Minz_Session::_param('currentUser', $username); - switch ($conf->auth_type) { + switch ($system_conf->auth_type) { case 'form': Minz_Session::_param('passwordHash'); FreshRSS_FormAuth::deleteCookie(); break; - case 'persona': - Minz_Session::_param('mail'); - break; case 'http_auth': case 'none': // Nothing to do... @@ -170,14 +174,34 @@ class FreshRSS_Auth { public static function accessNeedsAction() { $conf = Minz_Configuration::get('system'); $auth_type = $conf->auth_type; - return $auth_type === 'form' || $auth_type === 'persona'; + return $auth_type === 'form'; + } + + public static function csrfToken() { + $csrf = Minz_Session::param('csrf'); + if ($csrf == '') { + $salt = FreshRSS_Context::$system_conf->salt; + $csrf = sha1($salt . uniqid(mt_rand(), true)); + Minz_Session::_param('csrf', $csrf); + } + return $csrf; + } + public static function isCsrfOk($token = null) { + $csrf = Minz_Session::param('csrf'); + if ($csrf == '') { + return true; //Not logged in yet + } + if ($token === null) { + $token = Minz_Request::fetchPOST('_csrf'); + } + return $token === $csrf; } } class FreshRSS_FormAuth { public static function checkCredentials($username, $hash, $nonce, $challenge) { - if (!ctype_alnum($username) || + if (!FreshRSS_user_Controller::checkUsername($username) || !ctype_graph($challenge) || !ctype_alnum($nonce)) { Minz_Log::debug('Invalid credential parameters:' . @@ -206,7 +230,7 @@ class FreshRSS_FormAuth { // Token has expired (> 1 month) or does not exist. // TODO: 1 month -> use a configuration instead @unlink($token_file); - return array(); + return array(); } $credentials = @file_get_contents($token_file); @@ -214,8 +238,8 @@ class FreshRSS_FormAuth { } public static function makeCookie($username, $password_hash) { + $conf = Minz_Configuration::get('system'); do { - $conf = Minz_Configuration::get('system'); $token = sha1($conf->salt . $username . uniqid(mt_rand(), true)); $token_file = DATA_PATH . '/tokens/' . $token . '.txt'; } while (file_exists($token_file)); @@ -224,15 +248,17 @@ class FreshRSS_FormAuth { return false; } - $expire = time() + 2629744; //1 month //TODO: Use a configuration instead + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $expire = time() + $cookie_duration; Minz_Session::setLongTermCookie('FreshRSS_login', $token, $expire); return $token; } public static function deleteCookie() { $token = Minz_Session::getLongTermCookie('FreshRSS_login'); - Minz_Session::deleteLongTermCookie('FreshRSS_login'); if (ctype_alnum($token)) { + Minz_Session::deleteLongTermCookie('FreshRSS_login'); @unlink(DATA_PATH . '/tokens/' . $token . '.txt'); } @@ -242,7 +268,10 @@ class FreshRSS_FormAuth { } public static function purgeTokens() { - $oldest = time() - 2629744; // 1 month // TODO: Use a configuration instead + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $oldest = time() - $cookie_duration; foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $file_info) { // $extension = $file_info->getExtension(); doesn't work in PHP < 5.3.7 $extension = pathinfo($file_info->getFilename(), PATHINFO_EXTENSION); diff --git a/app/Models/Category.php b/app/Models/Category.php index 37cb44dc3..9a44a2d09 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -6,6 +6,7 @@ class FreshRSS_Category extends Minz_Model { private $nbFeed = -1; private $nbNotRead = -1; private $feeds = null; + private $hasFeedsWithError = false; public function __construct($name = '', $feeds = null) { $this->_name($name); @@ -16,6 +17,7 @@ class FreshRSS_Category extends Minz_Model { foreach ($feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } } @@ -51,12 +53,17 @@ class FreshRSS_Category extends Minz_Model { foreach ($this->feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } return $this->feeds; } + public function hasFeedsWithError() { + return $this->hasFeedsWithError; + } + public function _id($value) { $this->id = $value; } diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 27a558522..f219c275f 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -1,6 +1,9 @@ <?php -class FreshRSS_CategoryDAO extends Minz_ModelPdo { +class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { + + const DEFAULTCATEGORYID = 1; + public function addCategory($valuesTmp) { $sql = 'INSERT INTO `' . $this->prefix . 'category`(name) VALUES(?)'; $stm = $this->bd->prepare($sql); @@ -10,10 +13,10 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { ); if ($stm && $stm->execute($values)) { - return $this->bd->lastInsertId(); + return $this->bd->lastInsertId('"' . $this->prefix . 'category_id_seq"'); } else { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error addCategory: ' . $info[2] ); + Minz_Log::error('SQL error addCategory: ' . $info[2]); return false; } } @@ -50,6 +53,9 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { } public function deleteCategory($id) { + if ($id <= self::DEFAULTCATEGORYID) { + return false; + } $sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?'; $stm = $this->bd->prepare($sql); @@ -100,10 +106,10 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { public function listCategories($prePopulateFeeds = true, $details = false) { if ($prePopulateFeeds) { $sql = 'SELECT c.id AS c_id, c.name AS c_name, ' - . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.cache_nbEntries, f.cache_nbUnreads ') + . ($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 ' + . 'GROUP BY f.id, c_id ' . 'ORDER BY c.name, f.name'; $stm = $this->bd->prepare($sql); $stm->execute(); @@ -117,7 +123,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { } public function getDefault() { - $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=1'; + $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=' . self::DEFAULTCATEGORYID; $stm = $this->bd->prepare($sql); $stm->execute(); @@ -131,11 +137,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { } } public function checkDefault() { - $def_cat = $this->searchById(1); + $def_cat = $this->searchById(self::DEFAULTCATEGORYID); if ($def_cat == null) { $cat = new FreshRSS_Category(_t('gen.short.default_category')); - $cat->_id(1); + $cat->_id(self::DEFAULTCATEGORYID); $values = array( 'id' => $cat->id(), @@ -207,12 +213,13 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { $previousLine = null; $feedsDao = array(); + $feedDao = FreshRSS_Factory::createFeedDAO(); 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'], - FreshRSS_FeedDAO::daoToFeed($feedsDao, $previousLine['c_id']) + $feedDao->daoToFeed($feedsDao, $previousLine['c_id']) ); $cat->_id($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; @@ -228,7 +235,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { if ($previousLine != null) { $cat = new FreshRSS_Category( $previousLine['c_name'], - FreshRSS_FeedDAO::daoToFeed($feedsDao, $previousLine['c_id']) + $feedDao->daoToFeed($feedsDao, $previousLine['c_id']) ); $cat->_id($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index eeb1f2f4c..ca4709903 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -56,8 +56,7 @@ class FreshRSS_ConfigurationSetter { switch ($value) { case 'all': $data['default_view'] = $value; - $data['default_state'] = (FreshRSS_Entry::STATE_READ + - FreshRSS_Entry::STATE_NOT_READ); + $data['default_state'] = (FreshRSS_Entry::STATE_READ + FreshRSS_Entry::STATE_NOT_READ); break; case 'adaptive': case 'unread': @@ -95,11 +94,6 @@ class FreshRSS_ConfigurationSetter { $data['language'] = $value; } - private function _mail_login(&$data, $value) { - $value = filter_var($value, FILTER_VALIDATE_EMAIL); - $data['mail_login'] = $value ? $value : ''; - } - private function _old_entries(&$data, $value) { $value = intval($value); $data['old_entries'] = $value > 0 ? $value : 3; @@ -117,12 +111,11 @@ class FreshRSS_ConfigurationSetter { private function _queries(&$data, $values) { $data['queries'] = array(); foreach ($values as $value) { - $value = array_filter($value); - $params = $value; - unset($params['name']); - unset($params['url']); - $value['url'] = Minz_Url::display(array('params' => $params)); - $data['queries'][] = $value; + if ($value instanceof FreshRSS_UserQuery) { + $data['queries'][] = $value->toArray(); + } elseif (is_array($value)) { + $data['queries'][] = $value; + } } } @@ -135,12 +128,7 @@ class FreshRSS_ConfigurationSetter { // Verify URL and add default value when needed if (isset($value['url'])) { - $is_url = ( - filter_var($value['url'], FILTER_VALIDATE_URL) || - (version_compare(PHP_VERSION, '5.3.3', '<') && - (strpos($value, '-') > 0) && - ($value === filter_var($value, FILTER_SANITIZE_URL))) - ); //PHP bug #51192 + $is_url = filter_var($value['url'], FILTER_VALIDATE_URL); if (!$is_url) { continue; } @@ -174,7 +162,7 @@ class FreshRSS_ConfigurationSetter { if (!in_array($value, array('global', 'normal', 'reader'))) { $value = 'normal'; } - $data['view_mode'] = $value; + $data['view_mode'] = $value; } /** @@ -192,6 +180,10 @@ class FreshRSS_ConfigurationSetter { $data['auto_remove_article'] = $this->handleBool($value); } + private function _mark_updated_article_unread(&$data, $value) { + $data['mark_updated_article_unread'] = $this->handleBool($value); + } + private function _display_categories(&$data, $value) { $data['display_categories'] = $this->handleBool($value); } @@ -204,6 +196,10 @@ class FreshRSS_ConfigurationSetter { $data['hide_read_feeds'] = $this->handleBool($value); } + private function _sides_close_article(&$data, $value) { + $data['sides_close_article'] = $this->handleBool($value); + } + private function _lazyload(&$data, $value) { $data['lazyload'] = $this->handleBool($value); } @@ -275,7 +271,7 @@ class FreshRSS_ConfigurationSetter { private function _auth_type(&$data, $value) { $value = strtolower($value); - if (!in_array($value, array('form', 'http_auth', 'persona', 'none'))) { + if (!in_array($value, array('form', 'http_auth', 'none'))) { $value = 'none'; } $data['auth_type'] = $value; @@ -289,6 +285,7 @@ class FreshRSS_ConfigurationSetter { switch ($value['type']) { case 'mysql': + case 'pgsql': if (empty($value['host']) || empty($value['user']) || empty($value['base']) || @@ -328,7 +325,7 @@ class FreshRSS_ConfigurationSetter { if (!in_array($value, array('silent', 'development', 'production'))) { $value = 'production'; } - $data['environment'] = $value; + $data['environment'] = $value; } private function _limits(&$data, $values) { @@ -351,6 +348,9 @@ class FreshRSS_ConfigurationSetter { 'min' => 0, 'max' => $max_small_int, ), + 'max_registrations' => array( + 'min' => 0, + ), ); foreach ($values as $key => $value) { @@ -358,10 +358,10 @@ class FreshRSS_ConfigurationSetter { continue; } + $value = intval($value); $limits = $limits_keys[$key]; - if ( - (!isset($limits['min']) || $value > $limits['min']) && - (!isset($limits['max']) || $value < $limits['max']) + if ((!isset($limits['min']) || $value >= $limits['min']) && + (!isset($limits['max']) || $value <= $limits['max']) ) { $data['limits'][$key] = $value; } @@ -371,4 +371,12 @@ class FreshRSS_ConfigurationSetter { private function _unsafe_autologin_enabled(&$data, $value) { $data['unsafe_autologin_enabled'] = $this->handleBool($value); } + + private function _auto_update_url(&$data, $value) { + if (!$value) { + return; + } + + $data['auto_update_url'] = $value; + } } diff --git a/app/Models/Context.php b/app/Models/Context.php index 645639907..2ca8f80b0 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -10,6 +10,7 @@ class FreshRSS_Context { public static $categories = array(); public static $name = ''; + public static $description = ''; public static $total_unread = 0; public static $total_starred = array( @@ -30,10 +31,13 @@ class FreshRSS_Context { public static $state = 0; public static $order = 'DESC'; public static $number = 0; - public static $search = ''; + public static $search; public static $first_id = ''; public static $next_id = ''; public static $id_max = ''; + public static $sinceHours = 0; + + public static $isCli = false; /** * Initialize the context. @@ -44,9 +48,6 @@ class FreshRSS_Context { // Init configuration. self::$system_conf = Minz_Configuration::get('system'); self::$user_conf = Minz_Configuration::get('user'); - - $catDAO = new FreshRSS_CategoryDAO(); - self::$categories = $catDAO->listCategories(); } /** @@ -94,6 +95,13 @@ class FreshRSS_Context { } /** + * Return true if the current request targets a feed (and not a category or all articles), false otherwise. + */ + public static function isFeed() { + return self::$current_get['feed'] != false; + } + + /** * Return true if $get parameter correspond to the $current_get attribute. */ public static function isCurrentGet($get) { @@ -131,23 +139,30 @@ class FreshRSS_Context { $id = substr($get, 2); $nb_unread = 0; + if (empty(self::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + self::$categories = $catDAO->listCategories(); + } + switch($type) { case 'a': self::$current_get['all'] = true; self::$name = _t('index.feed.title'); + self::$description = self::$system_conf->meta_description; self::$get_unread = self::$total_unread; break; case 's': self::$current_get['starred'] = true; self::$name = _t('index.feed.title_fav'); + self::$description = self::$system_conf->meta_description; self::$get_unread = self::$total_starred['unread']; // Update state if favorite is not yet enabled. self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE; break; case 'f': - // We try to find the corresponding feed. - $feed = FreshRSS_CategoryDAO::findFeed(self::$categories, $id); + // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description + $feed = FreshRSS_Context::$system_conf->allow_robots ? null : FreshRSS_CategoryDAO::findFeed(self::$categories, $id); if ($feed === null) { $feedDAO = FreshRSS_Factory::createFeedDao(); $feed = $feedDAO->searchById($id); @@ -160,6 +175,7 @@ class FreshRSS_Context { self::$current_get['feed'] = $id; self::$current_get['category'] = $feed->category(); self::$name = $feed->name(); + self::$description = $feed->description(); self::$get_unread = $feed->nbNotRead(); break; case 'c': @@ -189,11 +205,16 @@ class FreshRSS_Context { /** * Set the value of $next_get attribute. */ - public static function _nextGet() { + private static function _nextGet() { $get = self::currentGet(); // By default, $next_get == $get self::$next_get = $get; + if (empty(self::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + self::$categories = $catDAO->listCategories(); + } + if (self::$user_conf->onread_jump_next && strlen($get) > 2) { $another_unread_id = ''; $found_current_get = false; @@ -229,9 +250,7 @@ class FreshRSS_Context { } // If no feed have been found, next_get is the current category. - self::$next_get = empty($another_unread_id) ? - 'c_' . self::$current_get['category'] : - 'f_' . $another_unread_id; + self::$next_get = empty($another_unread_id) ? 'c_' . self::$current_get['category'] : 'f_' . $another_unread_id; break; case 'c': // We search the next category with at least one unread article. @@ -254,9 +273,7 @@ class FreshRSS_Context { } // No unread category? The main stream will be our destination! - self::$next_get = empty($another_unread_id) ? - 'a' : - 'c_' . $another_unread_id; + self::$next_get = empty($another_unread_id) ? 'a' : 'c_' . $another_unread_id; break; } } @@ -302,152 +319,4 @@ class FreshRSS_Context { return false; } - /** - * Parse search string to extract the different keywords. - * - * @return array - */ - public function parseSearch() { - $search = self::$search; - $intitle = $this->parseIntitleSearch($search); - $author = $this->parseAuthorSearch($intitle['string']); - $inurl = $this->parseInurlSearch($author['string']); - $pubdate = $this->parsePubdateSearch($inurl['string']); - $date = $this->parseDateSearch($pubdate['string']); - - $remaining = array(); - $remaining_search = trim($date['string']); - if (strcmp($remaining_search, '') != 0) { - $remaining['search'] = $remaining_search; - } - - return array_merge($intitle['search'], $author['search'], $inurl['search'], $date['search'], $pubdate['search'], $remaining); - } - - /** - * Parse the search string to find intitle keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseIntitleSearch($search) { - if (preg_match('/intitle:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('intitle' => $matches['search']), - ); - } - if (preg_match('/intitle:(?P<search>\w*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('intitle' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find author keyword and the search related - * to it. - * The search is the first word following the keyword except when using - * a delimiter. Supported delimiters are single quote (') and double - * quotes ("). - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseAuthorSearch($search) { - if (preg_match('/author:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('author' => $matches['search']), - ); - } - if (preg_match('/author:(?P<search>\w*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('author' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find inurl keyword and the search related - * to it. - * The search is the first word following the keyword except. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseInurlSearch($search) { - if (preg_match('/inurl:(?P<search>[^\s]*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('inurl' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find date keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseDateSearch($search) { - if (preg_match('/date:(?P<search>[^\s]*)/', $search, $matches)) { - list($min_date, $max_date) = parseDateInterval($matches['search']); - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('min_date' => $min_date, 'max_date' => $max_date), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find pubdate keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parsePubdateSearch($search) { - if (preg_match('/pubdate:(?P<search>[^\s]*)/', $search, $matches)) { - list($min_date, $max_date) = parseDateInterval($matches['search']); - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('min_pubdate' => $min_date, 'max_pubdate' => $max_date), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - } diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 0d85718e3..f5469f2b7 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -9,7 +9,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - + $tables = array( $this->prefix . 'category' => false, $this->prefix . 'feed' => false, @@ -80,4 +80,45 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { return $list; } + + public function size($all = false) { + $db = FreshRSS_Context::$system_conf->db; + $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema=?'; //MySQL + $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 function optimize() { + $ok = true; + + $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'entry`'; //MySQL + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'feed`'; //MySQL + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'category`'; //MySQL + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + return $ok; + } } diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php new file mode 100644 index 000000000..1b3f7408d --- /dev/null +++ b/app/Models/DatabaseDAOPGSQL.php @@ -0,0 +1,80 @@ +<?php + +/** + * This class is used to test database is well-constructed. + */ +class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAO { + public function tablesAreCorrect() { + $db = FreshRSS_Context::$system_conf->db; + $dbowner = $db['user']; + $sql = 'SELECT * FROM pg_catalog.pg_tables where tableowner=?'; + $stm = $this->bd->prepare($sql); + $values = array($dbowner); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + $this->prefix . 'category' => false, + $this->prefix . 'feed' => false, + $this->prefix . 'entry' => false, + ); + foreach ($res as $value) { + $tables[array_pop($value)] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'select column_name as field, data_type as type, column_default as default, is_nullable as null from INFORMATION_SCHEMA.COLUMNS where table_name = ?'; + $stm = $this->bd->prepare($sql); + $stm->execute(array($this->prefix . $table)); + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['field'], + 'type' => strtolower($dao['type']), + 'notnull' => (bool)$dao['null'], + 'default' => $dao['default'], + ); + } + + public function size($all = true) { + $db = FreshRSS_Context::$system_conf->db; + $sql = 'SELECT pg_size_pretty(pg_database_size(?))'; + $values = array($db['base']); + $stm = $this->bd->prepare($sql); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return $res[0]; + } + + public function optimize() { + $ok = true; + + $sql = 'VACUUM `' . $this->prefix . 'entry`'; + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + $sql = 'VACUUM `' . $this->prefix . 'feed`'; + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + $sql = 'VACUUM `' . $this->prefix . 'category`'; + $stm = $this->bd->prepare($sql); + $ok &= $stm != false; + if ($stm) { + $ok &= $stm->execute(); + } + + return $ok; + } +} diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php index 7f53f967d..d3aedb3c0 100644 --- a/app/Models/DatabaseDAOSQLite.php +++ b/app/Models/DatabaseDAOSQLite.php @@ -9,7 +9,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO { $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - + $tables = array( 'category' => false, 'feed' => false, @@ -45,4 +45,17 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO { 'default' => $dao['dflt_value'], ); } + + public function size($all = false) { + return @filesize(join_path(DATA_PATH, 'users', $this->current_user, 'db.sqlite')); + } + + public function optimize() { + $sql = 'VACUUM'; + $stm = $this->bd->prepare($sql); + if ($stm) { + return $stm->execute(); + } + return false; + } } diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 346c98a92..0ad3781e5 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -14,14 +14,14 @@ class FreshRSS_Entry extends Minz_Model { private $content; private $link; private $date; - private $is_read; + private $hash = null; + private $is_read; //Nullable boolean 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); @@ -31,6 +31,7 @@ class FreshRSS_Entry extends Minz_Model { $this->_isFavorite($is_favorite); $this->_feed($feed); $this->_tags(preg_split('/[\s#]/', $tags)); + $this->_guid($guid); } public function id() { @@ -88,30 +89,57 @@ class FreshRSS_Entry extends Minz_Model { } } + public function hash() { + if ($this->hash === null) { + //Do not include $this->date because it may be automatically generated when lacking + $this->hash = md5($this->link . $this->title . $this->author . $this->content . $this->tags(true)); + } + return $this->hash; + } + + public function _hash($value) { + $value = trim($value); + if (ctype_xdigit($value)) { + $this->hash = substr($value, 0, 32); + } + return $this->hash; + } + public function _id($value) { $this->id = $value; } public function _guid($value) { + if ($value == '') { + $value = $this->link; + if ($value == '') { + $value = $this->hash(); + } + } $this->guid = $value; } public function _title($value) { + $this->hash = null; $this->title = $value; } public function _author($value) { + $this->hash = null; $this->author = $value; } public function _content($value) { + $this->hash = null; $this->content = $value; } public function _link($value) { + $this->hash = null; $this->link = $value; } public function _date($value) { + $this->hash = null; $value = intval($value); $this->date = $value > 1 ? $value : time(); } public function _isRead($value) { - $this->is_read = $value; + $this->is_read = $value === null ? null : (bool)$value; } public function _isFavorite($value) { $this->is_favorite = $value; @@ -120,6 +148,7 @@ class FreshRSS_Entry extends Minz_Model { $this->feed = $value; } public function _tags($value) { + $this->hash = null; if (!is_array($value)) { $value = array($value); } @@ -168,6 +197,7 @@ class FreshRSS_Entry extends Minz_Model { ); } catch (Exception $e) { // rien à faire, on garde l'ancien contenu(requête a échoué) + Minz_Log::warning($e->getMessage()); } } } @@ -182,6 +212,7 @@ class FreshRSS_Entry extends Minz_Model { 'content' => $this->content(), 'link' => $this->link(), 'date' => $this->date(true), + 'hash' => $this->hash(), 'is_read' => $this->isRead(), 'is_favorite' => $this->isFavorite(), 'id_feed' => $this->feed(), diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 61beeea13..e8b6dcdae 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1,83 +1,284 @@ <?php -class FreshRSS_EntryDAO extends Minz_ModelPdo { +class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function isCompressed() { + return parent::$sharedDbType === 'mysql'; + } + + public function hasNativeHex() { return parent::$sharedDbType !== 'sqlite'; } - public function addEntryPrepare() { - $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, ' - . ($this->isCompressed() ? 'content_bin' : 'content') - . ', link, date, is_read, is_favorite, id_feed, tags) ' - . 'VALUES(?, ?, ?, ?, ' - . ($this->isCompressed() ? 'COMPRESS(?)' : '?') - . ', ?, ?, ?, ?, ?, ?)'; - return $this->bd->prepare($sql); + public function sqlHexDecode($x) { + return 'unhex(' . $x . ')'; } - public function addEntry($valuesTmp, $preparedStatement = null) { - $stm = $preparedStatement === null ? - FreshRSS_EntryDAO::addEntryPrepare() : - $preparedStatement; + public function sqlHexEncode($x) { + return 'hex(' . $x . ')'; + } - $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), - ); + protected function addColumn($name) { + Minz_Log::warning('FreshRSS_EntryDAO::addColumn: ' . $name); + $hasTransaction = false; + try { + $stm = null; + if ($name === 'lastSeen') { //v1.1.1 + if (!$this->bd->inTransaction()) { + $this->bd->beginTransaction(); + $hasTransaction = true; + } + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN `lastSeen` INT(11) DEFAULT 0'); + if ($stm && $stm->execute()) { + $stm = $this->bd->prepare('CREATE INDEX entry_lastSeen_index ON `' . $this->prefix . 'entry`(`lastSeen`);'); //"IF NOT EXISTS" does not exist in MySQL 5.7 + if ($stm && $stm->execute()) { + if ($hasTransaction) { + $this->bd->commit(); + } + return true; + } + } + if ($hasTransaction) { + $this->bd->rollBack(); + } + } elseif ($name === 'hash') { //v1.1.1 + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)'); + return $stm && $stm->execute(); + } + } catch (Exception $e) { + Minz_Log::error('FreshRSS_EntryDAO::addColumn error: ' . $e->getMessage()); + if ($hasTransaction) { + $this->bd->rollBack(); + } + } + return false; + } - if ($stm && $stm->execute($values)) { - return $this->bd->lastInsertId(); - } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - if ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries - Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); - } /*else { - Minz_Log::debug('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); - }*/ + private $triedUpdateToUtf8mb4 = false; + + protected function updateToUtf8mb4() { + if ($this->triedUpdateToUtf8mb4) { return false; } + $this->triedUpdateToUtf8mb4 = true; + $db = FreshRSS_Context::$system_conf->db; + if ($db['type'] === 'mysql') { + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + if (defined('SQL_UPDATE_UTF8MB4')) { + Minz_Log::warning('Updating MySQL to UTF8MB4...'); + $hadTransaction = $this->bd->inTransaction(); + if ($hadTransaction) { + $this->bd->commit(); + } + $ok = false; + try { + $sql = sprintf(SQL_UPDATE_UTF8MB4, $this->prefix, $db['base']); + $stm = $this->bd->prepare($sql); + $ok = $stm->execute(); + } catch (Exception $e) { + Minz_Log::error('FreshRSS_EntryDAO::updateToUtf8mb4 error: ' . $e->getMessage()); + } + if ($hadTransaction) { + $this->bd->beginTransaction(); + //NB: Transaction not starting. Why? (tested on PHP 7.0.8-0ubuntu and MySQL 5.7.13-0ubuntu) + } + return $ok; + } + } + return false; } - public function addEntryObject($entry, $conf, $feedHistory) { - $existingGuids = array_fill_keys( - $this->listLastGuidsByFeed($entry->feed(), 20), 1 - ); - - $nb_month_old = max($conf->old_entries, 1); - $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + protected function createEntryTempTable() { + $ok = false; + $hadTransaction = $this->bd->inTransaction(); + if ($hadTransaction) { + $this->bd->commit(); + } + try { + $db = FreshRSS_Context::$system_conf->db; + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + Minz_Log::warning('SQL CREATE TABLE entrytmp...'); + if (defined('SQL_CREATE_TABLE_ENTRYTMP')) { + $sql = sprintf(SQL_CREATE_TABLE_ENTRYTMP, $this->prefix); + $stm = $this->bd->prepare($sql); + $ok = $stm && $stm->execute(); + } else { + global $SQL_CREATE_TABLE_ENTRYTMP; + $ok = !empty($SQL_CREATE_TABLE_ENTRYTMP); + foreach ($SQL_CREATE_TABLE_ENTRYTMP as $instruction) { + $sql = sprintf($instruction, $this->prefix); + $stm = $this->bd->prepare($sql); + $ok &= $stm && $stm->execute(); + } + } + } catch (Exception $e) { + Minz_Log::error('FreshRSS_EntryDAO::createEntryTempTable error: ' . $e->getMessage()); + } + if ($hadTransaction) { + $this->bd->beginTransaction(); + } + return $ok; + } - $eDate = $entry->date(true); + protected function autoUpdateDb($errorInfo) { + if (isset($errorInfo[0])) { + if ($errorInfo[0] === '42S22') { //ER_BAD_FIELD_ERROR + //autoAddColumn + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($errorInfo[2], $column) !== false) { + return $this->addColumn($column); + } + } + } elseif ($errorInfo[0] === '42S02' && stripos($errorInfo[2], 'entrytmp') !== false) { //ER_BAD_TABLE_ERROR + return $this->createEntryTempTable(); //v1.7 + } + } + if (isset($errorInfo[1])) { + if ($errorInfo[1] == '1366') { //ER_TRUNCATED_WRONG_VALUE_FOR_FIELD + return $this->updateToUtf8mb4(); + } + } + return false; + } - if ($feedHistory == -2) { - $feedHistory = $conf->keep_history_default; + private $addEntryPrepared = null; + + public function addEntry($valuesTmp) { + if ($this->addEntryPrepared == null) { + $sql = 'INSERT INTO `' . $this->prefix . 'entrytmp` (id, guid, title, author, ' + . ($this->isCompressed() ? 'content_bin' : 'content') + . ', link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) ' + . 'VALUES(:id, :guid, :title, :author, ' + . ($this->isCompressed() ? 'COMPRESS(:content)' : ':content') + . ', :link, :date, :last_seen, ' + . $this->sqlHexDecode(':hash') + . ', :is_read, :is_favorite, :id_feed, :tags)'; + $this->addEntryPrepared = $this->bd->prepare($sql); + } + if ($this->addEntryPrepared) { + $this->addEntryPrepared->bindParam(':id', $valuesTmp['id']); + $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); + $valuesTmp['guid'] = safe_ascii($valuesTmp['guid']); + $this->addEntryPrepared->bindParam(':guid', $valuesTmp['guid']); + $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $this->addEntryPrepared->bindParam(':title', $valuesTmp['title']); + $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $this->addEntryPrepared->bindParam(':author', $valuesTmp['author']); + $this->addEntryPrepared->bindParam(':content', $valuesTmp['content']); + $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); + $valuesTmp['link'] = safe_ascii($valuesTmp['link']); + $this->addEntryPrepared->bindParam(':link', $valuesTmp['link']); + $this->addEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT); + $valuesTmp['lastSeen'] = time(); + $this->addEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT); + $valuesTmp['is_read'] = $valuesTmp['is_read'] ? 1 : 0; + $this->addEntryPrepared->bindParam(':is_read', $valuesTmp['is_read'], PDO::PARAM_INT); + $valuesTmp['is_favorite'] = $valuesTmp['is_favorite'] ? 1 : 0; + $this->addEntryPrepared->bindParam(':is_favorite', $valuesTmp['is_favorite'], PDO::PARAM_INT); + $this->addEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); + $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $this->addEntryPrepared->bindParam(':tags', $valuesTmp['tags']); + + if ($this->hasNativeHex()) { + $this->addEntryPrepared->bindParam(':hash', $valuesTmp['hash']); + } else { + $valuesTmp['hashBin'] = pack('H*', $valuesTmp['hash']); //hex2bin() is PHP5.4+ + $this->addEntryPrepared->bindParam(':hash', $valuesTmp['hashBin']); + } } + if ($this->addEntryPrepared && $this->addEntryPrepared->execute()) { + return true; + } else { + $info = $this->addEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->addEntryPrepared->errorInfo(); + if ($this->autoUpdateDb($info)) { + $this->addEntryPrepared = null; + return $this->addEntry($valuesTmp); + } elseif ((int)((int)$info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries + Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); + } + return false; + } + } - if (!isset($existingGuids[$entry->guid()]) && - ($feedHistory != 0 || $eDate >= $date_min || $entry->isFavorite())) { - $values = $entry->toArray(); + public function commitNewEntries() { + $sql = 'SET @rank=(SELECT MAX(id) - COUNT(*) FROM `' . $this->prefix . 'entrytmp`); ' . //MySQL-specific + 'INSERT IGNORE INTO `' . $this->prefix . 'entry` + ( + id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags + ) ' . + 'SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags + FROM `' . $this->prefix . 'entrytmp` + ORDER BY date; ' . + 'DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= @rank;'; + $hadTransaction = $this->bd->inTransaction(); + if (!$hadTransaction) { + $this->bd->beginTransaction(); + } + $result = $this->bd->exec($sql) !== false; + if (!$hadTransaction) { + $this->bd->commit(); + } + return $result; + } + + private $updateEntryPrepared = null; - $useDeclaredDate = empty($existingGuids); - $values['id'] = ($useDeclaredDate || $eDate < $date_min) ? - min(time(), $eDate) . uSecString() : - uTimeString(); + public function updateEntry($valuesTmp) { + if (!isset($valuesTmp['is_read'])) { + $valuesTmp['is_read'] = null; + } - return $this->addEntry($values); + if ($this->updateEntryPrepared === null) { + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET title=:title, author=:author, ' + . ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content') + . ', link=:link, date=:date, `lastSeen`=:last_seen, ' + . 'hash=' . $this->sqlHexDecode(':hash') + . ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ') + . 'tags=:tags ' + . 'WHERE id_feed=:id_feed AND guid=:guid'; + $this->updateEntryPrepared = $this->bd->prepare($sql); + } + + $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); + $this->updateEntryPrepared->bindParam(':guid', $valuesTmp['guid']); + $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $this->updateEntryPrepared->bindParam(':title', $valuesTmp['title']); + $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $this->updateEntryPrepared->bindParam(':author', $valuesTmp['author']); + $this->updateEntryPrepared->bindParam(':content', $valuesTmp['content']); + $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); + $valuesTmp['link'] = safe_ascii($valuesTmp['link']); + $this->updateEntryPrepared->bindParam(':link', $valuesTmp['link']); + $this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT); + $valuesTmp['lastSeen'] = time(); + $this->updateEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT); + if ($valuesTmp['is_read'] !== null) { + $this->updateEntryPrepared->bindValue(':is_read', $valuesTmp['is_read'] ? 1 : 0, PDO::PARAM_INT); + } + $this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); + $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $this->updateEntryPrepared->bindParam(':tags', $valuesTmp['tags']); + + if ($this->hasNativeHex()) { + $this->updateEntryPrepared->bindParam(':hash', $valuesTmp['hash']); + } else { + $valuesTmp['hashBin'] = pack('H*', $valuesTmp['hash']); //hex2bin() is PHP5.4+ + $this->updateEntryPrepared->bindParam(':hash', $valuesTmp['hashBin']); } - // We don't return Entry object to avoid a research in DB - return -1; + if ($this->updateEntryPrepared && $this->updateEntryPrepared->execute()) { + return true; + } else { + $info = $this->updateEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->updateEntryPrepared->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->updateEntry($valuesTmp); + } + Minz_Log::error('SQL error updateEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating entry with GUID ' . $valuesTmp['guid'] . ' in feed ' . $valuesTmp['id_feed']); + return false; + } } /** @@ -94,9 +295,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { if (!is_array($ids)) { $ids = array($ids); } + if (count($ids) < 1) { + return 0; + } + FreshRSS_UserDAO::touch(); $sql = 'UPDATE `' . $this->prefix . 'entry` ' - . 'SET is_favorite=? ' - . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; + . 'SET is_favorite=? ' + . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; $values = array($is_favorite ? 1 : 0); $values = array_merge($values, $ids); $stm = $this->bd->prepare($sql); @@ -122,22 +327,26 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { */ protected function updateCacheUnreads($catId = false, $feedId = false) { $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 1'; + . '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)'; + $hasWhere = false; $values = array(); if ($feedId !== false) { - $sql .= ' AND f.id=?'; + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' f.id=?'; $values[] = $id; } if ($catId !== false) { - $sql .= ' AND f.category=?'; + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' f.category=?'; $values[] = $catId; } $stm = $this->bd->prepare($sql); @@ -164,6 +373,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { * @return integer affected rows */ public function markRead($ids, $is_read = true) { + FreshRSS_UserDAO::touch(); if (is_array($ids)) { //Many IDs at once (used by API) if (count($ids) < 6) { //Speed heuristics $affected = 0; @@ -192,7 +402,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } else { $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 ' + . 'f.`cache_nbUnreads`=f.`cache_nbUnreads`' . ($is_read ? '-' : '+') . '1 ' . 'WHERE e.id=? AND e.is_read=?'; $values = array($is_read ? 1 : 0, $ids, $is_read ? 0 : 1); $stm = $this->bd->prepare($sql); @@ -227,7 +437,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { * @param integer $priorityMin * @return integer affected rows */ - public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) { + public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadEntries(0) is deprecated!'); @@ -242,8 +453,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $sql .= ' AND f.priority > ' . intval($priorityMin); } $values = array($idMax); - $stm = $this->bd->prepare($sql); - if (!($stm && $stm->execute($values))) { + + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); Minz_Log::error('SQL error markReadEntries: ' . $info[2]); return false; @@ -266,7 +480,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { * @param integer $idMax fail safe article ID * @return integer affected rows */ - public function markReadCat($id, $idMax = 0) { + public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadCat(0) is deprecated!'); @@ -276,8 +491,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { . '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))) { + + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); Minz_Log::error('SQL error markReadCat: ' . $info[2]); return false; @@ -296,11 +514,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { * * If $idMax equals 0, a deprecated debug message is logged * - * @param integer $id feed ID + * @param integer $id_feed feed ID * @param integer $idMax fail safe article ID * @return integer affected rows */ - public function markReadFeed($id, $idMax = 0) { + public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadFeed(0) is deprecated!'); @@ -310,11 +529,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET is_read=1 ' . 'WHERE id_feed=? AND is_read=0 AND id <= ?'; - $values = array($id, $idMax); - $stm = $this->bd->prepare($sql); - if (!($stm && $stm->execute($values))) { + $values = array($id_feed, $idMax); + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error markReadFeed: ' . $info[2]); + Minz_Log::error('SQL error markReadFeed: ' . $info[2] . ' with SQL: ' . $sql . $search); $this->bd->rollBack(); return false; } @@ -322,13 +544,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { if ($affected > 0) { $sql = 'UPDATE `' . $this->prefix . 'feed` ' - . 'SET cache_nbUnreads=cache_nbUnreads-' . $affected + . 'SET `cache_nbUnreads`=`cache_nbUnreads`-' . $affected . ' WHERE id=?'; - $values = array($id); + $values = array($id_feed); $stm = $this->bd->prepare($sql); if (!($stm && $stm->execute($values))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error markReadFeed: ' . $info[2]); + Minz_Log::error('SQL error markReadFeed cache: ' . $info[2]); $this->bd->rollBack(); return false; } @@ -338,37 +560,37 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return $affected; } - public function searchByGuid($feed_id, $id) { + public function searchByGuid($id_feed, $guid) { // un guid est unique pour un flux donné $sql = 'SELECT id, guid, title, author, ' - . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') - . ', link, date, is_read, is_favorite, id_feed, tags ' - . 'FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?'; + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : '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 + $id_feed, + $guid, ); $stm->execute($values); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - $entries = self::daoToEntry($res); + $entries = self::daoToEntries($res); return isset($entries[0]) ? $entries[0] : null; } public function searchById($id) { $sql = 'SELECT id, guid, title, author, ' - . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') - . ', link, date, is_read, is_favorite, id_feed, tags ' - . 'FROM `' . $this->prefix . 'entry` WHERE id=?'; + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : '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); + $entries = self::daoToEntries($res); return isset($entries[0]) ? $entries[0] : null; } @@ -376,6 +598,125 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL } + protected function sqlListEntriesWhere($alias = '', $filter = null, $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $firstId = '', $date_min = 0) { + $search = ' '; + $values = array(); + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { + $search .= 'AND ' . $alias . 'is_read=0 '; + } + } elseif ($state & FreshRSS_Entry::STATE_READ) { + $search .= 'AND ' . $alias . 'is_read=1 '; + } + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { + $search .= 'AND ' . $alias . 'is_favorite=1 '; + } + } elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + $search .= 'AND ' . $alias . 'is_favorite=0 '; + } + + switch ($order) { + case 'DESC': + case 'ASC': + break; + default: + throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!'); + } + /*if ($firstId === '' && parent::$sharedDbType === 'mysql') { + //MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev + $firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; + }*/ + if ($firstId !== '') { + $search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; + } + if ($date_min > 0) { + $search .= 'AND ' . $alias . 'id >= ' . $date_min . '000000 '; + } + if ($filter) { + if ($filter->getMinDate()) { + $search .= 'AND ' . $alias . 'id >= ? '; + $values[] = "{$filter->getMinDate()}000000"; + } + if ($filter->getMaxDate()) { + $search .= 'AND ' . $alias . 'id <= ? '; + $values[] = "{$filter->getMaxDate()}000000"; + } + if ($filter->getMinPubdate()) { + $search .= 'AND ' . $alias . 'date >= ? '; + $values[] = $filter->getMinPubdate(); + } + if ($filter->getMaxPubdate()) { + $search .= 'AND ' . $alias . 'date <= ? '; + $values[] = $filter->getMaxPubdate(); + } + + if ($filter->getAuthor()) { + foreach ($filter->getAuthor() as $author) { + $search .= 'AND ' . $alias . 'author LIKE ? '; + $values[] = "%{$author}%"; + } + } + if ($filter->getIntitle()) { + foreach ($filter->getIntitle() as $title) { + $search .= 'AND ' . $alias . 'title LIKE ? '; + $values[] = "%{$title}%"; + } + } + if ($filter->getTags()) { + foreach ($filter->getTags() as $tag) { + $search .= 'AND ' . $alias . 'tags LIKE ? '; + $values[] = "%{$tag}%"; + } + } + if ($filter->getInurl()) { + foreach ($filter->getInurl() as $url) { + $search .= 'AND CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ? '; + $values[] = "%{$url}%"; + } + } + + if ($filter->getNotAuthor()) { + foreach ($filter->getNotAuthor() as $author) { + $search .= 'AND (NOT ' . $alias . 'author LIKE ?) '; + $values[] = "%{$author}%"; + } + } + if ($filter->getNotIntitle()) { + foreach ($filter->getNotIntitle() as $title) { + $search .= 'AND (NOT ' . $alias . 'title LIKE ?) '; + $values[] = "%{$title}%"; + } + } + if ($filter->getNotTags()) { + foreach ($filter->getNotTags() as $tag) { + $search .= 'AND (NOT ' . $alias . 'tags LIKE ?) '; + $values[] = "%{$tag}%"; + } + } + if ($filter->getNotInurl()) { + foreach ($filter->getNotInurl() as $url) { + $search .= 'AND (NOT CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ?) '; + $values[] = "%{$url}%"; + } + } + + if ($filter->getSearch()) { + foreach ($filter->getSearch() as $search_value) { + $search .= 'AND ' . $this->sqlconcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; + $values[] = "%{$search_value}%"; + } + } + if ($filter->getNotSearch()) { + foreach ($filter->getNotSearch() as $search_value) { + $search .= 'AND (NOT ' . $this->sqlconcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ?) '; + $values[] = "%{$search_value}%"; + } + } + } + return array($values, $search); + } + private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { if (!$state) { $state = FreshRSS_Entry::STATE_ALL; @@ -389,7 +730,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $joinFeed = true; break; case 's': //Deprecated: use $state instead - $where .= 'e1.is_favorite=1 '; + $where .= 'e.is_favorite=1 '; break; case 'c': $where .= 'f.category=? '; @@ -397,125 +738,47 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $joinFeed = true; break; case 'f': - $where .= 'e1.id_feed=? '; + $where .= 'e.id_feed=? '; $values[] = intval($id); break; case 'A': - $where .= '1 '; + $where .= '1=1 '; break; default: throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!'); } - if ($state & FreshRSS_Entry::STATE_NOT_READ) { - if (!($state & FreshRSS_Entry::STATE_READ)) { - $where .= 'AND e1.is_read=0 '; - } - } - elseif ($state & FreshRSS_Entry::STATE_READ) { - $where .= 'AND e1.is_read=1 '; - } - if ($state & FreshRSS_Entry::STATE_FAVORITE) { - if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { - $where .= 'AND e1.is_favorite=1 '; - } - } - elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { - $where .= 'AND e1.is_favorite=0 '; - } - - switch ($order) { - case 'DESC': - case 'ASC': - break; - default: - throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!'); - } - /*if ($firstId === '' && parent::$sharedDbType === 'mysql') { - $firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; //MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev - }*/ - if ($firstId !== '') { - $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; - } - if ($date_min > 0) { - $where .= 'AND e1.id >= ' . $date_min . '000000 '; - } - $search = ''; - if ($filter !== '') { - require_once(LIB_PATH . '/lib_date.php'); - $filter = trim($filter); - $filter = addcslashes($filter, '\\%_'); - $terms = array_unique(explode(' ', $filter)); - //sort($terms); //Put #tags first //TODO: Put the cheapest filters first - foreach ($terms as $word) { - $word = trim($word); - if (stripos($word, 'intitle:') === 0) { - $word = substr($word, strlen('intitle:')); - $search .= 'AND e1.title LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'inurl:') === 0) { - $word = substr($word, strlen('inurl:')); - $search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'author:') === 0) { - $word = substr($word, strlen('author:')); - $search .= 'AND e1.author LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'date:') === 0) { - $word = substr($word, strlen('date:')); - list($minDate, $maxDate) = parseDateInterval($word); - if ($minDate) { - $search .= 'AND e1.id >= ' . $minDate . '000000 '; - } - if ($maxDate) { - $search .= 'AND e1.id <= ' . $maxDate . '000000 '; - } - } elseif (stripos($word, 'pubdate:') === 0) { - $word = substr($word, strlen('pubdate:')); - list($minDate, $maxDate) = parseDateInterval($word); - if ($minDate) { - $search .= 'AND e1.date >= ' . $minDate . ' '; - } - if ($maxDate) { - $search .= 'AND e1.date <= ' . $maxDate . ' '; - } - } else { - if ($word[0] === '#' && isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; - $values[] = '%' . $word .'%'; - } else { - $search .= 'AND ' . $this->sqlconcat('e1.title', $this->isCompressed() ? 'UNCOMPRESS(content_bin)' : 'content') . ' LIKE ? '; - $values[] = '%' . $word .'%'; - } - } - } - } + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state, $order, $firstId, $date_min); - return array($values, - 'SELECT e1.id FROM `' . $this->prefix . 'entry` e1 ' - . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed=f.id ' : '') + return array(array_merge($values, $searchValues), + 'SELECT e.id FROM `' . $this->prefix . 'entry` e ' + . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' : '') . 'WHERE ' . $where . $search - . 'ORDER BY e1.id ' . $order + . 'ORDER BY e.id ' . $order . ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ } - public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); - $sql = 'SELECT e.id, e.guid, e.title, e.author, ' - . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') - . ', e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags ' - . 'FROM `' . $this->prefix . 'entry` e ' - . 'INNER JOIN (' - . $sql - . ') e2 ON e2.id=e.id ' - . 'ORDER BY e.id ' . $order; + $sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, ' + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') + . ', e0.link, e0.date, e0.is_read, e0.is_favorite, e0.id_feed, e0.tags ' + . 'FROM `' . $this->prefix . 'entry` e0 ' + . 'INNER JOIN (' + . $sql + . ') e2 ON e2.id=e0.id ' + . 'ORDER BY e0.id ' . $order; $stm = $this->bd->prepare($sql); $stm->execute($values); + return $stm; + } - return self::daoToEntry($stm->fetchAll(PDO::FETCH_ASSOC)); + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); + return self::daoToEntries($stm->fetchAll(PDO::FETCH_ASSOC)); } public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API @@ -527,17 +790,60 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return $stm->fetchAll(PDO::FETCH_COLUMN, 0); } - public function listLastGuidsByFeed($id, $n) { - $sql = 'SELECT guid FROM `' . $this->prefix . 'entry` WHERE id_feed=? ORDER BY id DESC LIMIT ' . intval($n); + public function listHashForFeedGuids($id_feed, $guids) { + if (count($guids) < 1) { + return array(); + } + $guids = array_unique($guids); + $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . ' AS hex_hash FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; $stm = $this->bd->prepare($sql); - $values = array($id); - $stm->execute($values); - return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + $values = array($id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + $result = array(); + $rows = $stm->fetchAll(PDO::FETCH_ASSOC); + foreach ($rows as $row) { + $result[$row['guid']] = $row['hex_hash']; + } + return $result; + } else { + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->listHashForFeedGuids($id_feed, $guids); + } + Minz_Log::error('SQL error listHashForFeedGuids: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while querying feed ' . $id_feed); + return false; + } + } + + public function updateLastSeen($id_feed, $guids, $mtime = 0) { + if (count($guids) < 1) { + return 0; + } + $sql = 'UPDATE `' . $this->prefix . 'entry` SET `lastSeen`=? WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $stm = $this->bd->prepare($sql); + if ($mtime <= 0) { + $mtime = time(); + } + $values = array($mtime, $id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->updateLastSeen($id_feed, $guids); + } + Minz_Log::error('SQL error updateLastSeen: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating feed ' . $id_feed); + return false; + } } 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'; + . ' 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); @@ -568,9 +874,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { public function countUnreadReadFavorites() { $sql = 'SELECT c FROM (' - . 'SELECT COUNT(id) AS c, 1 as o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 ' - . 'UNION SELECT COUNT(id) AS c, 2 AS o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read=0' - . ') u ORDER BY o'; + . 'SELECT COUNT(id) AS c, 1 as o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 ' + . 'UNION SELECT COUNT(id) AS c, 2 AS o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read=0' + . ') u ORDER BY o'; $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); @@ -579,35 +885,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread); } - public function optimizeTable() { - $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'entry`'; //MySQL - $stm = $this->bd->prepare($sql); - $stm->execute(); - } - - public function size($all = false) { - $db = FreshRSS_Context::$system_conf->db; - $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema=?'; //MySQL - $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 daoToEntry($listDAO) { - $list = array(); - - if (!is_array($listDAO)) { - $listDAO = array($listDAO); - } - - foreach ($listDAO as $key => $dao) { - $entry = new FreshRSS_Entry( + public static function daoToEntry($dao) { + $entry = new FreshRSS_Entry( $dao['id_feed'], $dao['guid'], $dao['title'], @@ -619,10 +898,21 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $dao['is_favorite'], $dao['tags'] ); - if (isset($dao['id'])) { - $entry->_id($dao['id']); - } - $list[] = $entry; + if (isset($dao['id'])) { + $entry->_id($dao['id']); + } + return $entry; + } + + private static function daoToEntries($listDAO) { + $list = array(); + + if (!is_array($listDAO)) { + $listDAO = array($listDAO); + } + + foreach ($listDAO as $key => $dao) { + $list[] = self::daoToEntry($dao); } unset($listDAO); diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php new file mode 100644 index 000000000..f09fe8e75 --- /dev/null +++ b/app/Models/EntryDAOPGSQL.php @@ -0,0 +1,49 @@ +<?php + +class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite { + + public function sqlHexDecode($x) { + return 'decode(' . $x . ", 'hex')"; + } + + public function sqlHexEncode($x) { + return 'encode(' . $x . ", 'hex')"; + } + + protected function autoUpdateDb($errorInfo) { + if (isset($errorInfo[0])) { + if ($errorInfo[0] === '42P01' && stripos($errorInfo[2], 'entrytmp') !== false) { //undefined_table + return $this->createEntryTempTable(); + } + } + return false; + } + + protected function addColumn($name) { + return false; + } + + public function commitNewEntries() { + $sql = 'DO $$ +DECLARE +maxrank bigint := (SELECT MAX(id) FROM `' . $this->prefix . 'entrytmp`); +rank bigint := (SELECT maxrank - COUNT(*) FROM `' . $this->prefix . 'entrytmp`); +BEGIN + INSERT INTO `' . $this->prefix . 'entry` (id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) + (SELECT rank + row_number() OVER(ORDER BY date) AS id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags + FROM `' . $this->prefix . 'entrytmp` AS etmp + WHERE NOT EXISTS (SELECT 1 FROM `' . $this->prefix . 'entry` AS ereal WHERE etmp.id_feed = ereal.id_feed AND etmp.guid = ereal.guid) + ORDER BY date); + DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= maxrank; +END $$;'; + $hadTransaction = $this->bd->inTransaction(); + if (!$hadTransaction) { + $this->bd->beginTransaction(); + } + $result = $this->bd->exec($sql) !== false; + if (!$hadTransaction) { + $this->bd->commit(); + } + return $result; + } +} diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index ffe0f037c..0f57dc1ba 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -2,23 +2,115 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { + public function sqlHexDecode($x) { + return $x; + } + + protected function autoUpdateDb($errorInfo) { + Minz_Log::error('FreshRSS_EntryDAO::autoUpdateDb error: ' . print_r($errorInfo, true)); + if ($tableInfo = $this->bd->query("SELECT sql FROM sqlite_master where name='entrytmp'")) { + $showCreate = $tableInfo->fetchColumn(); + if (stripos($showCreate, 'entrytmp') === false) { + return $this->createEntryTempTable(); + } + } + if ($tableInfo = $this->bd->query("SELECT sql FROM sqlite_master where name='entry'")) { + $showCreate = $tableInfo->fetchColumn(); + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($showCreate, $column) === false) { + return $this->addColumn($column); + } + } + } + return false; + } + + public function commitNewEntries() { + $sql = ' + CREATE TEMP TABLE `tmp` AS + SELECT + id, + guid, + title, + author, + content, + link, + date, + `lastSeen`, + hash, is_read, + is_favorite, + id_feed, + tags + FROM `' . $this->prefix . 'entrytmp` + ORDER BY date; + INSERT OR IGNORE INTO `' . $this->prefix . 'entry` + ( + id, + guid, + title, + author, + content, + link, + date, + `lastSeen`, + hash, + is_read, + is_favorite, + id_feed, + tags + ) + SELECT rowid + (SELECT MAX(id) - COUNT(*) FROM `tmp`) AS + id, + guid, + title, + author, + content, + link, + date, + `lastSeen`, + hash, + is_read, + is_favorite, + id_feed, + tags + FROM `tmp` + ORDER BY date; + DELETE FROM `' . $this->prefix . 'entrytmp` + WHERE id <= (SELECT MAX(id) + FROM `tmp`); + DROP TABLE `tmp`;'; + $hadTransaction = $this->bd->inTransaction(); + if (!$hadTransaction) { + $this->bd->beginTransaction(); + } + $result = $this->bd->exec($sql) !== false; + if (!$hadTransaction) { + $this->bd->commit(); + } + return $result; + } + protected function sqlConcat($s1, $s2) { return $s1 . '||' . $s2; } protected function updateCacheUnreads($catId = false, $feedId = false) { $sql = 'UPDATE `' . $this->prefix . 'feed` ' - . 'SET cache_nbUnreads=(' + . 'SET `cache_nbUnreads`=(' . 'SELECT COUNT(*) AS nbUnreads FROM `' . $this->prefix . 'entry` e ' - . 'WHERE e.id_feed=`' . $this->prefix . 'feed`.id AND e.is_read=0) ' - . 'WHERE 1'; + . 'WHERE e.id_feed=`' . $this->prefix . 'feed`.id AND e.is_read=0)'; + $hasWhere = false; $values = array(); if ($feedId !== false) { - $sql .= ' AND id=?'; + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' id=?'; $values[] = $feedId; } if ($catId !== false) { - $sql .= ' AND category=?'; + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' category=?'; $values[] = $catId; } $stm = $this->bd->prepare($sql); @@ -66,7 +158,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { } $affected = $stm->rowCount(); if ($affected > 0) { - $sql = 'UPDATE `' . $this->prefix . 'feed` SET cache_nbUnreads=cache_nbUnreads' . ($is_read ? '-' : '+') . '1 ' + $sql = 'UPDATE `' . $this->prefix . 'feed` SET `cache_nbUnreads`=`cache_nbUnreads`' . ($is_read ? '-' : '+') . '1 ' . 'WHERE id=(SELECT e.id_feed FROM `' . $this->prefix . 'entry` e WHERE e.id=?)'; $values = array($ids); $stm = $this->bd->prepare($sql); @@ -103,7 +195,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { * @param integer $priorityMin * @return integer affected rows */ - public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) { + public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) { if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadEntries(0) is deprecated!'); @@ -116,8 +208,11 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { $sql .= ' AND id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.priority > ' . intval($priorityMin) . ')'; } $values = array($idMax); - $stm = $this->bd->prepare($sql); - if (!($stm && $stm->execute($values))) { + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); Minz_Log::error('SQL error markReadEntries: ' . $info[2]); return false; @@ -140,7 +235,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { * @param integer $idMax fail safe article ID * @return integer affected rows */ - public function markReadCat($id, $idMax = 0) { + public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) { if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadCat(0) is deprecated!'); @@ -151,8 +246,11 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { . 'WHERE is_read=0 AND id <= ? AND ' . 'id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.category=?)'; $values = array($idMax, $id); - $stm = $this->bd->prepare($sql); - if (!($stm && $stm->execute($values))) { + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); Minz_Log::error('SQL error markReadCat: ' . $info[2]); return false; @@ -163,12 +261,4 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { } return $affected; } - - public function optimizeTable() { - //TODO: Search for an equivalent in SQLite - } - - public function size($all = false) { - return @filesize(join_path(DATA_PATH, 'users', $this->current_user, 'db.sqlite')); - } } diff --git a/app/Models/Factory.php b/app/Models/Factory.php index db09d155d..dfccc883e 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -3,38 +3,42 @@ class FreshRSS_Factory { public static function createFeedDao($username = null) { - $conf = Minz_Configuration::get('system'); - if ($conf->db['type'] === 'sqlite') { - return new FreshRSS_FeedDAOSQLite($username); - } else { - return new FreshRSS_FeedDAO($username); - } + return new FreshRSS_FeedDAO($username); } public static function createEntryDao($username = null) { $conf = Minz_Configuration::get('system'); - if ($conf->db['type'] === 'sqlite') { - return new FreshRSS_EntryDAOSQLite($username); - } else { - return new FreshRSS_EntryDAO($username); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_EntryDAOSQLite($username); + case 'pgsql': + return new FreshRSS_EntryDAOPGSQL($username); + default: + return new FreshRSS_EntryDAO($username); } } public static function createStatsDAO($username = null) { $conf = Minz_Configuration::get('system'); - if ($conf->db['type'] === 'sqlite') { - return new FreshRSS_StatsDAOSQLite($username); - } else { - return new FreshRSS_StatsDAO($username); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_StatsDAOSQLite($username); + case 'pgsql': + return new FreshRSS_StatsDAOPGSQL($username); + default: + return new FreshRSS_StatsDAO($username); } } public static function createDatabaseDAO($username = null) { $conf = Minz_Configuration::get('system'); - if ($conf->db['type'] === 'sqlite') { - return new FreshRSS_DatabaseDAOSQLite($username); - } else { - return new FreshRSS_DatabaseDAO($username); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_DatabaseDAOSQLite($username); + case 'pgsql': + return new FreshRSS_DatabaseDAOPGSQL($username); + default: + return new FreshRSS_DatabaseDAO($username); } } diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5ce03be5d..75d9f6d6f 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -19,8 +19,10 @@ class FreshRSS_Feed extends Minz_Model { private $ttl = -2; private $hash = null; private $lockPath = ''; + private $hubUrl = ''; + private $selfUrl = ''; - public function __construct($url, $validate=true) { + public function __construct($url, $validate = true) { if ($validate) { $this->_url($url); } else { @@ -49,6 +51,12 @@ class FreshRSS_Feed extends Minz_Model { public function url() { return $this->url; } + public function selfUrl() { + return $this->selfUrl; + } + public function hubUrl() { + return $this->hubUrl; + } public function category() { return $this->category; } @@ -96,6 +104,16 @@ class FreshRSS_Feed extends Minz_Model { public function ttl() { return $this->ttl; } + // public function ttlExpire() { + // $ttl = $this->ttl; + // if ($ttl == -2) { //Default + // $ttl = FreshRSS_Context::$user_conf->ttl_default; + // } + // if ($ttl == -1) { //Never + // $ttl = 64000000; //~2 years. Good enough for PubSubHubbub logic + // } + // return $this->lastUpdate + $ttl; + // } public function nbEntries() { if ($this->nbEntries < 0) { $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -113,13 +131,26 @@ class FreshRSS_Feed extends Minz_Model { return $this->nbNotRead; } public function faviconPrepare() { - $file = DATA_PATH . '/favicons/' . $this->hash() . '.txt'; - if (!file_exists($file)) { - $t = $this->website; - if ($t == '') { - $t = $this->url; + global $favicons_dir; + require_once(LIB_PATH . '/favicons.php'); + $url = $this->website; + if ($url == '') { + $url = $this->url; + } + $txt = $favicons_dir . $this->hash() . '.txt'; + if (!file_exists($txt)) { + file_put_contents($txt, $url); + } + if (FreshRSS_Context::$isCli) { + $ico = $favicons_dir . $this->hash() . '.ico'; + $ico_mtime = @filemtime($ico); + $txt_mtime = @filemtime($txt); + if ($txt_mtime != false && + ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (14 * 86400)))) { + // no ico file or we should download a new one. + $url = file_get_contents($txt); + download_favicon($url, $ico) || touch($ico); } - file_put_contents($file, $t); } } public static function faviconDelete($hash) { @@ -134,7 +165,7 @@ class FreshRSS_Feed extends Minz_Model { public function _id($value) { $this->id = $value; } - public function _url($value, $validate=true) { + public function _url($value, $validate = true) { $this->hash = null; if ($validate) { $value = checkUrl($value); @@ -151,7 +182,7 @@ class FreshRSS_Feed extends Minz_Model { public function _name($value) { $this->name = $value === null ? '' : $value; } - public function _website($value, $validate=true) { + public function _website($value, $validate = true) { if ($validate) { $value = checkUrl($value); } @@ -198,7 +229,7 @@ class FreshRSS_Feed extends Minz_Model { $this->nbEntries = intval($value); } - public function load($loadDetails = false) { + public function load($loadDetails = false, $noCache = false) { if ($this->url !== null) { if (CACHE_PATH === false) { throw new Minz_FileNotExistException( @@ -223,9 +254,16 @@ class FreshRSS_Feed extends Minz_Model { if ((!$mtime) || $feed->error()) { $errorMessage = $feed->error(); - throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Feed error' : $errorMessage) . ' [' . $url . ']'); + throw new FreshRSS_Feed_Exception( + ($errorMessage == '' ? 'Unknown error for feed' : $errorMessage) . ' [' . $url . ']' + ); } + $links = $feed->get_links('self'); + $this->selfUrl = isset($links[0]) ? $links[0] : null; + $links = $feed->get_links('hub'); + $this->hubUrl = isset($links[0]) ? $links[0] : null; + if ($loadDetails) { // si on a utilisé l'auto-discover, notre url va avoir changé $subscribe_url = $feed->subscribe_url(false); @@ -240,16 +278,16 @@ class FreshRSS_Feed extends Minz_Model { $subscribe_url = $feed->subscribe_url(true); } - $clean_url = url_remove_credentials($subscribe_url); + $clean_url = SimplePie_Misc::url_remove_credentials($subscribe_url); if ($subscribe_url !== null && $subscribe_url !== $url) { $this->_url($clean_url); } - if (($mtime === true) ||($mtime > $this->lastUpdate)) { - Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); + if (($mtime === true) || ($mtime > $this->lastUpdate) || $noCache) { + //Minz_Log::debug('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); $this->loadEntries($feed); // et on charge les articles du flux } else { - Minz_Log::notice('FreshRSS use cache for ' . $clean_url); + //Minz_Log::debug('FreshRSS use cache for ' . $clean_url); $this->entries = array(); } @@ -259,7 +297,7 @@ class FreshRSS_Feed extends Minz_Model { } } - private function loadEntries($feed) { + public function loadEntries($feed) { $entries = array(); foreach ($feed->get_items() as $item) { @@ -282,15 +320,19 @@ class FreshRSS_Feed extends Minz_Model { $elinks = array(); foreach ($item->get_enclosures() as $enclosure) { $elink = $enclosure->get_link(); - if (empty($elinks[$elink])) { + if ($elink != '' && empty($elinks[$elink])) { $elinks[$elink] = '1'; $mime = strtolower($enclosure->get_type()); if (strpos($mime, 'image/') === 0) { - $content .= '<br /><img lazyload="" postpone="" src="' . $elink . '" alt="" />'; + $content .= '<p class="enclosure"><img src="' . $elink . '" alt="" /></p>'; } elseif (strpos($mime, 'audio/') === 0) { - $content .= '<br /><audio lazyload="" postpone="" preload="none" src="' . $elink . '" controls="controls" />'; + $content .= '<p class="enclosure"><audio preload="none" src="' . $elink + . '" controls="controls"></audio> <a download="" href="' . $elink . '">💾</a></p>'; } elseif (strpos($mime, 'video/') === 0) { - $content .= '<br /><video lazyload="" postpone="" preload="none" src="' . $elink . '" controls="controls" />'; + $content .= '<p class="enclosure"><video preload="none" src="' . $elink + . '" controls="controls"></video> <a download="" href="' . $elink . '">💾</a></p>'; + } elseif (strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) { + $content .= '<p class="enclosure"><a download="" href="' . $elink . '">💾</a></p>'; } else { unset($elinks[$elink]); } @@ -299,9 +341,9 @@ class FreshRSS_Feed extends Minz_Model { $entry = new FreshRSS_Entry( $this->id(), - $item->get_id(), + $item->get_id(false, false), $title === null ? '' : $title, - $author === null ? '' : html_only_entity_decode($author->name), + $author === null ? '' : html_only_entity_decode(strip_tags($author->name)), $content === null ? '' : $content, $link === null ? '' : $link, $date ? $date : time() @@ -317,6 +359,10 @@ class FreshRSS_Feed extends Minz_Model { $this->entries = $entries; } + function cacheModifiedTime() { + return @filemtime(CACHE_PATH . '/' . md5($this->url) . '.spc'); + } + function lock() { $this->lockPath = TMP_PATH . '/' . $this->hash() . '.freshrss.lock'; if (file_exists($this->lockPath) && ((time() - @filemtime($this->lockPath)) > 3600)) { @@ -333,4 +379,139 @@ class FreshRSS_Feed extends Minz_Model { function unlock() { @unlink($this->lockPath); } + + //<PubSubHubbub> + + function pubSubHubbubEnabled() { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { + $hubJson = json_decode($hubFile, true); + if ($hubJson && empty($hubJson['error']) && + (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { + return true; + } + } + return false; + } + + function pubSubHubbubError($error = true) { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); + $hubJson = $hubFile ? json_decode($hubFile, true) : array(); + if (!isset($hubJson['error']) || $hubJson['error'] !== (bool)$error) { + $hubJson['error'] = (bool)$error; + file_put_contents($hubFilename, json_encode($hubJson)); + Minz_Log::warning('Set error to ' . ($error ? 1 : 0) . ' for ' . $url, PSHB_LOG); + } + return false; + } + + function pubSubHubbubPrepare() { + $key = ''; + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { + $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); + $hubFilename = $path . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { + $text = 'Invalid JSON for PubSubHubbub: ' . $this->url; + Minz_Log::warning($text); + Minz_Log::warning($text, PSHB_LOG); + return false; + } + if ((!empty($hubJson['lease_end'])) && ($hubJson['lease_end'] < (time() + (3600 * 23)))) { //TODO: Make a better policy + $text = 'PubSubHubbub lease ends at ' + . date('c', empty($hubJson['lease_end']) ? time() : $hubJson['lease_end']) + . ' and needs renewal: ' . $this->url; + Minz_Log::warning($text); + Minz_Log::warning($text, PSHB_LOG); + $key = $hubJson['key']; //To renew our lease + } elseif (((!empty($hubJson['error'])) || empty($hubJson['lease_end'])) && + (empty($hubJson['lease_start']) || $hubJson['lease_start'] < time() - (3600 * 23))) { //Do not renew too often + $key = $hubJson['key']; //To renew our lease + } + } else { + @mkdir($path, 0777, true); + $key = sha1($path . FreshRSS_Context::$system_conf->salt); + $hubJson = array( + 'hub' => $this->hubUrl, + 'key' => $key, + ); + file_put_contents($hubFilename, json_encode($hubJson)); + @mkdir(PSHB_PATH . '/keys/'); + file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl)); + $text = 'PubSubHubbub prepared for ' . $this->url; + Minz_Log::debug($text); + Minz_Log::debug($text, PSHB_LOG); + } + $currentUser = Minz_Session::param('currentUser'); + if (FreshRSS_user_Controller::checkUsername($currentUser) && !file_exists($path . '/' . $currentUser . '.txt')) { + touch($path . '/' . $currentUser . '.txt'); + } + } + return $key; + } + + //Parameter true to subscribe, false to unsubscribe. + function pubSubHubbubSubscribe($state) { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + if (FreshRSS_Context::$system_conf->base_url && $url) { + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); + if ($hubFile === false) { + Minz_Log::warning('JSON not found for PubSubHubbub: ' . $this->url); + return false; + } + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key']) || empty($hubJson['hub'])) { + Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url); + return false; + } + $callbackUrl = checkUrl(Minz_Request::getBaseUrl() . '/api/pshb.php?k=' . $hubJson['key']); + if ($callbackUrl == '') { + Minz_Log::warning('Invalid callback for PubSubHubbub: ' . $this->url); + return false; + } + if (!$state) { //unsubscribe + $hubJson['lease_end'] = time() - 60; + file_put_contents($hubFilename, json_encode($hubJson)); + } + $ch = curl_init(); + curl_setopt_array($ch, array( + CURLOPT_URL => $hubJson['hub'], + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POSTFIELDS => http_build_query(array( + 'hub.verify' => 'sync', + 'hub.mode' => $state ? 'subscribe' : 'unsubscribe', + 'hub.topic' => $url, + 'hub.callback' => $callbackUrl, + )), + CURLOPT_USERAGENT => FRESHRSS_USERAGENT, + CURLOPT_MAXREDIRS => 10, + )); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //Keep option separated for open_basedir bug + if (defined('CURLOPT_ENCODING')) { + curl_setopt($ch, CURLOPT_ENCODING, ''); //Enable all encodings + } + $response = curl_exec($ch); + $info = curl_getinfo($ch); + + Minz_Log::warning('PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $url . + ' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response, PSHB_LOG); + + if (substr($info['http_code'], 0, 1) == '2') { + return true; + } else { + $hubJson['lease_start'] = time(); //Prevent trying again too soon + $hubJson['error'] = true; + file_put_contents($hubFilename, json_encode($hubJson)); + return false; + } + } + return false; + } + + //</PubSubHubbub> } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 74597c730..0de6d98be 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -1,10 +1,29 @@ <?php -class FreshRSS_FeedDAO extends Minz_ModelPdo { +class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function addFeed($valuesTmp) { - $sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history, ttl) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)'; + $sql = ' + INSERT INTO `' . $this->prefix . 'feed` + ( + url, + category, + name, + website, + description, + `lastUpdate`, + priority, + `httpAuth`, + error, + keep_history, + ttl + ) + VALUES + (?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)'; $stm = $this->bd->prepare($sql); + $valuesTmp['url'] = safe_ascii($valuesTmp['url']); + $valuesTmp['website'] = safe_ascii($valuesTmp['website']); + $values = array( substr($valuesTmp['url'], 0, 511), $valuesTmp['category'], @@ -16,7 +35,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { ); if ($stm && $stm->execute($values)) { - return $this->bd->lastInsertId(); + return $this->bd->lastInsertId('"' . $this->prefix . 'feed_id_seq"'); } else { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); Minz_Log::error('SQL error addFeed: ' . $info[2]); @@ -55,9 +74,16 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } public function updateFeed($id, $valuesTmp) { + if (isset($valuesTmp['url'])) { + $valuesTmp['url'] = safe_ascii($valuesTmp['url']); + } + if (isset($valuesTmp['website'])) { + $valuesTmp['website'] = safe_ascii($valuesTmp['website']); + } + $set = ''; foreach ($valuesTmp as $key => $v) { - $set .= $key . '=?, '; + $set .= '`' . $key . '`=?, '; if ($key == 'httpAuth') { $valuesTmp[$key] = base64_encode($v); @@ -82,25 +108,15 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } } - public function updateLastUpdate($id, $inError = 0, $updateCache = true) { - if ($updateCache) { - $sql = 'UPDATE `' . $this->prefix . 'feed` ' //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE - . 'SET cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' - . 'cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0),' - . 'lastUpdate=?, error=? ' - . 'WHERE id=?'; - } else { - $sql = 'UPDATE `' . $this->prefix . 'feed` ' - . 'SET lastUpdate=?, error=? ' - . 'WHERE id=?'; - } - + public function updateLastUpdate($id, $inError = false, $mtime = 0) { //See also updateCachedValue() + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `lastUpdate`=?, error=? ' + . 'WHERE id=?'; $values = array( - time(), - $inError, + $mtime <= 0 ? time() : $mtime, + $inError ? 1 : 0, $id, ); - $stm = $this->bd->prepare($sql); if ($stm && $stm->execute($values)) { @@ -198,6 +214,13 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { } } + public function listFeedsIds() { + $sql = 'SELECT id FROM `' . $this->prefix . 'feed`'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + } + public function listFeeds() { $sql = 'SELECT * FROM `' . $this->prefix . 'feed` ORDER BY name'; $stm = $this->bd->prepare($sql); @@ -222,14 +245,14 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { return $feedCategoryNames; } + /** + * Use $defaultCacheDuration == -1 to return all feeds, without filtering them by TTL. + */ public function listFeedsOrderUpdate($defaultCacheDuration = 3600) { - if ($defaultCacheDuration < 0) { - $defaultCacheDuration = 2147483647; - } - $sql = 'SELECT id, url, name, website, lastUpdate, pathEntries, httpAuth, keep_history, ttl ' + $sql = 'SELECT id, url, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, keep_history, ttl ' . 'FROM `' . $this->prefix . 'feed` ' - . 'WHERE ttl <> -1 AND lastUpdate < (' . (time() + 60) . '-(CASE WHEN ttl=-2 THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ' - . 'ORDER BY lastUpdate'; + . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl <> -1 AND `lastUpdate` < (' . (time() + 60) . '-(CASE WHEN ttl=-2 THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') + . 'ORDER BY `lastUpdate`'; $stm = $this->bd->prepare($sql); if (!($stm && $stm->execute())) { $sql2 = 'ALTER TABLE `' . $this->prefix . 'feed` ADD COLUMN ttl INT NOT NULL DEFAULT -2'; //v0.7.3 @@ -273,18 +296,28 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { 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'; + public function updateCachedValue($id) { //For multiple feeds, call updateCachedValues() + $sql = 'UPDATE `' . $this->prefix . 'feed` ' //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0) ' + . 'WHERE id=?'; + $values = array($id); $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute($values)) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCachedValue: ' . $info[2]); + return false; + } + } + + public function updateCachedValues() { //For one single feed, call updateCachedValue($id) + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)'; + $stm = $this->bd->prepare($sql); if ($stm && $stm->execute()) { return $stm->rowCount(); } else { @@ -308,7 +341,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $affected = $stm->rowCount(); $sql = 'UPDATE `' . $this->prefix . 'feed` ' - . 'SET cache_nbEntries=0, cache_nbUnreads=0 WHERE id=?'; + . 'SET `cache_nbEntries`=0, `cache_nbUnreads`=0 WHERE id=?'; $values = array($id); $stm = $this->bd->prepare($sql); if (!($stm && $stm->execute($values))) { @@ -322,17 +355,20 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { return $affected; } - public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) just after + public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateCachedValue($id) or updateCachedValues() just after $sql = 'DELETE FROM `' . $this->prefix . 'entry` ' - . 'WHERE id_feed = :id_feed AND id <= :id_max AND is_favorite=0 AND 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 MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' + . 'WHERE id_feed=:id_feed AND id<=:id_max ' + . 'AND is_favorite=0 ' //Do not remove favourites + . 'AND `lastSeen` < (SELECT maxLastSeen FROM (SELECT (MAX(e3.`lastSeen`)-99) AS maxLastSeen FROM `' . $this->prefix . 'entry` e3 WHERE e3.id_feed=:id_feed) recent) ' //Do not remove the most newly seen articles, plus a few seconds of tolerance + . 'AND 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: MySQL doesn't 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_STR); - $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + if ($stm) { + $id_max = intval($date_min) . '000000'; + $stm->bindParam(':id_feed', $id, PDO::PARAM_INT); + $stm->bindParam(':id_max', $id_max, PDO::PARAM_STR); + $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + } if ($stm && $stm->execute()) { return $stm->rowCount(); @@ -360,7 +396,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { if ($catID === null) { $category = isset($dao['category']) ? $dao['category'] : 0; } else { - $category = $catID ; + $category = $catID; } $myFeed = new FreshRSS_Feed(isset($dao['url']) ? $dao['url'] : '', false); diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php deleted file mode 100644 index 7599fda53..000000000 --- a/app/Models/FeedDAOSQLite.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO { - - public function updateCachedValues() { //For one single feed, call updateLastUpdate($id) - $sql = 'UPDATE `' . $this->prefix . 'feed` ' - . 'SET cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' - . 'cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)'; - $stm = $this->bd->prepare($sql); - if ($stm && $stm->execute()) { - return $stm->rowCount(); - } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error updateCachedValues: ' . $info[2]); - return false; - } - } - -} diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php index 4c56e3150..5bce466d5 100644 --- a/app/Models/LogDAO.php +++ b/app/Models/LogDAO.php @@ -21,5 +21,10 @@ class FreshRSS_LogDAO { public static function truncate() { file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), ''); + if (FreshRSS_Auth::hasAccess('admin')) { + file_put_contents(ADMIN_LOG, ''); + file_put_contents(API_LOG, ''); + file_put_contents(PSHB_LOG, ''); + } } } diff --git a/app/Models/Search.php b/app/Models/Search.php new file mode 100644 index 000000000..5cc7f8e8d --- /dev/null +++ b/app/Models/Search.php @@ -0,0 +1,339 @@ +<?php + +require_once(LIB_PATH . '/lib_date.php'); + +/** + * Contains a search from the search form. + * + * It allows to extract meaningful bits of the search and store them in a + * convenient object + */ +class FreshRSS_Search { + + // This contains the user input string + private $raw_input = ''; + // The following properties are extracted from the raw input + private $intitle; + private $min_date; + private $max_date; + private $min_pubdate; + private $max_pubdate; + private $inurl; + private $author; + private $tags; + private $search; + + private $not_intitle; + private $not_inurl; + private $not_author; + private $not_tags; + private $not_search; + + public function __construct($input) { + if ($input == '') { + return; + } + $this->raw_input = $input; + + $input = preg_replace('/:"(.*?)"/', ':"\1"', $input); + + $input = $this->parseNotIntitleSearch($input); + $input = $this->parseNotAuthorSearch($input); + $input = $this->parseNotInurlSearch($input); + $input = $this->parseNotTagsSeach($input); + + $input = $this->parsePubdateSearch($input); + $input = $this->parseDateSearch($input); + + $input = $this->parseIntitleSearch($input); + $input = $this->parseAuthorSearch($input); + $input = $this->parseInurlSearch($input); + $input = $this->parseTagsSeach($input); + + $input = $this->parseNotSearch($input); + $input = $this->parseSearch($input); + } + + public function __toString() { + return $this->getRawInput(); + } + + public function getRawInput() { + return $this->raw_input; + } + + public function getIntitle() { + return $this->intitle; + } + public function getNotIntitle() { + return $this->not_intitle; + } + + public function getMinDate() { + return $this->min_date; + } + + public function getMaxDate() { + return $this->max_date; + } + + public function getMinPubdate() { + return $this->min_pubdate; + } + + public function getMaxPubdate() { + return $this->max_pubdate; + } + + public function getInurl() { + return $this->inurl; + } + public function getNotInurl() { + return $this->not_inurl; + } + + public function getAuthor() { + return $this->author; + } + public function getNotAuthor() { + return $this->not_author; + } + + public function getTags() { + return $this->tags; + } + public function getNotTags() { + return $this->not_tags; + } + + public function getSearch() { + return $this->search; + } + public function getNotSearch() { + return $this->not_search; + } + + private static function removeEmptyValues($anArray) { + return is_array($anArray) ? array_filter($anArray, function($value) { return $value !== ''; }) : array(); + } + + /** + * Parse the search string to find intitle keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseIntitleSearch($input) { + if (preg_match_all('/\bintitle:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->intitle = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + if (preg_match_all('/\bintitle:(?P<search>\w*)/', $input, $matches)) { + $this->intitle = array_merge($this->intitle ? $this->intitle : array(), $matches['search']); + $input = str_replace($matches[0], '', $input); + } + $this->intitle = self::removeEmptyValues($this->intitle); + return $input; + } + + private function parseNotIntitleSearch($input) { + if (preg_match_all('/[!-]intitle:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->not_intitle = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + if (preg_match_all('/[!-]intitle:(?P<search>\w*)/', $input, $matches)) { + $this->not_intitle = array_merge($this->not_intitle ? $this->not_intitle : array(), $matches['search']); + $input = str_replace($matches[0], '', $input); + } + $this->not_intitle = self::removeEmptyValues($this->not_intitle); + return $input; + } + + /** + * Parse the search string to find author keyword and the search related + * to it. + * The search is the first word following the keyword except when using + * a delimiter. Supported delimiters are single quote (') and double + * quotes ("). + * + * @param string $input + * @return string + */ + private function parseAuthorSearch($input) { + if (preg_match_all('/\bauthor:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->author = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + if (preg_match_all('/\bauthor:(?P<search>\w*)/', $input, $matches)) { + $this->author = array_merge($this->author ? $this->author : array(), $matches['search']); + $input = str_replace($matches[0], '', $input); + } + $this->author = self::removeEmptyValues($this->author); + return $input; + } + + private function parseNotAuthorSearch($input) { + if (preg_match_all('/[!-]author:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->not_author = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + if (preg_match_all('/[!-]author:(?P<search>\w*)/', $input, $matches)) { + $this->not_author = array_merge($this->not_author ? $this->not_author : array(), $matches['search']); + $input = str_replace($matches[0], '', $input); + } + $this->not_author = self::removeEmptyValues($this->not_author); + return $input; + } + + /** + * Parse the search string to find inurl keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseInurlSearch($input) { + if (preg_match_all('/\binurl:(?P<search>[^\s]*)/', $input, $matches)) { + $this->inurl = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $this->inurl = self::removeEmptyValues($this->inurl); + return $input; + } + + private function parseNotInurlSearch($input) { + if (preg_match_all('/[!-]inurl:(?P<search>[^\s]*)/', $input, $matches)) { + $this->not_inurl = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $this->not_inurl = self::removeEmptyValues($this->not_inurl); + return $input; + } + + /** + * Parse the search string to find date keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseDateSearch($input) { + if (preg_match_all('/\bdate:(?P<search>[^\s]*)/', $input, $matches)) { + $input = str_replace($matches[0], '', $input); + $dates = self::removeEmptyValues($matches['search']); + if (!empty($dates[0])) { + list($this->min_date, $this->max_date) = parseDateInterval($dates[0]); + } + } + return $input; + } + + /** + * Parse the search string to find pubdate keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parsePubdateSearch($input) { + if (preg_match_all('/\bpubdate:(?P<search>[^\s]*)/', $input, $matches)) { + $input = str_replace($matches[0], '', $input); + $dates = self::removeEmptyValues($matches['search']); + if (!empty($dates[0])) { + list($this->min_pubdate, $this->max_pubdate) = parseDateInterval($dates[0]); + } + } + return $input; + } + + /** + * Parse the search string to find tags keyword (# followed by a word) + * and the search related to it. + * The search is the first word following the #. + * + * @param string $input + * @return string + */ + private function parseTagsSeach($input) { + if (preg_match_all('/#(?P<search>[^\s]+)/', $input, $matches)) { + $this->tags = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $this->tags = self::removeEmptyValues($this->tags); + return $input; + } + + private function parseNotTagsSeach($input) { + if (preg_match_all('/[!-]#(?P<search>[^\s]+)/', $input, $matches)) { + $this->not_tags = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $this->not_tags = self::removeEmptyValues($this->not_tags); + return $input; + } + + /** + * Parse the search string to find search values. + * Every word is a distinct search value, except when using a delimiter. + * Supported delimiters are single quote (') and double quotes ("). + * + * @param string $input + * @return string + */ + private function parseSearch($input) { + $input = self::cleanSearch($input); + if ($input == '') { + return; + } + if (preg_match_all('/(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->search = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $input = self::cleanSearch($input); + if ($input == '') { + return; + } + if (is_array($this->search)) { + $this->search = array_merge($this->search, explode(' ', $input)); + } else { + $this->search = explode(' ', $input); + } + } + + private function parseNotSearch($input) { + $input = self::cleanSearch($input); + if ($input == '') { + return; + } + if (preg_match_all('/[!-](?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->not_search = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + if ($input == '') { + return; + } + if (preg_match_all('/[!-](?P<search>[^\s]+)/', $input, $matches)) { + $this->not_search = array_merge(is_array($this->not_search) ? $this->not_search : array(), $matches['search']); + $input = str_replace($matches[0], '', $input); + } + $this->not_search = self::removeEmptyValues($this->not_search); + return $input; + } + + /** + * Remove all unnecessary spaces in the search + * + * @param string $input + * @return string + */ + private static function cleanSearch($input) { + $input = preg_replace('/\s+/', ' ', $input); + return trim($input); + } + +} diff --git a/app/Models/Searchable.php b/app/Models/Searchable.php new file mode 100644 index 000000000..d5bcea49d --- /dev/null +++ b/app/Models/Searchable.php @@ -0,0 +1,6 @@ +<?php + +interface FreshRSS_Searchable { + + public function searchById($id); +} diff --git a/app/Models/Share.php b/app/Models/Share.php index db6feda19..7378b30df 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -21,9 +21,11 @@ class FreshRSS_Share { } $help_url = isset($share_options['help']) ? $share_options['help'] : ''; + $field = isset($share_options['field']) ? $share_options['field'] : null; self::$list_sharing[$type] = new FreshRSS_Share( $type, $share_options['url'], $share_options['transform'], - $share_options['form'], $help_url + $share_options['form'], $help_url, $share_options['method'], + $field ); } @@ -76,6 +78,8 @@ class FreshRSS_Share { private $base_url = null; private $title = null; private $link = null; + private $method = 'GET'; + private $field; /** * Create a FreshRSS_Share object. @@ -86,9 +90,10 @@ class FreshRSS_Share { * is typically for a centralized service while "advanced" is for * decentralized ones. * @param $help_url is an optional url to give help on this option. + * @param $method defines the sharing method (GET or POST) */ - private function __construct($type, $url_transform, $transform = array(), - $form_type, $help_url = '') { + private function __construct($type, $url_transform, $transform, + $form_type, $help_url, $method, $field) { $this->type = $type; $this->name = _t('gen.share.' . $type); $this->url_transform = $url_transform; @@ -103,6 +108,11 @@ class FreshRSS_Share { $form_type = 'simple'; } $this->form_type = $form_type; + if (!in_array($method, array('GET', 'POST'))) { + $method = 'GET'; + } + $this->method = $method; + $this->field = $field; } /** @@ -116,14 +126,14 @@ class FreshRSS_Share { 'url' => 'base_url', 'title' => 'title', 'link' => 'link', + 'method' => 'method', + 'field' => 'field', ); foreach ($options as $key => $value) { - if (!isset($available_options[$key])) { - continue; + if (isset($available_options[$key])) { + $this->{$available_options[$key]} = $value; } - - $this->$available_options[$key] = $value; } } @@ -135,6 +145,21 @@ class FreshRSS_Share { } /** + * Return the current method of the share option. + */ + public function method() { + return $this->method; + } + + /** + * Return the current field of the share option. It's null for shares + * using the GET method. + */ + public function field() { + return $this->field; + } + + /** * Return the current form type of the share option. */ public function formType() { @@ -152,7 +177,7 @@ class FreshRSS_Share { * Return the current name of the share option. */ public function name($real = false) { - if ($real || is_null($this->custom_name)) { + if ($real || is_null($this->custom_name) || empty($this->custom_name)) { return $this->name; } else { return $this->custom_name; diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 80caccc49..67ada73f7 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -4,6 +4,10 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { const ENTRY_COUNT_PERIOD = 30; + protected function sqlFloor($s) { + return "FLOOR($s)"; + } + /** * Calculates entry repartition for all feeds and for main stream. * @@ -37,12 +41,12 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { $filter .= "AND e.id_feed = {$feed}"; } $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 +SELECT COUNT(1) AS total, +COUNT(1) - SUM(e.is_read) AS count_unreads, +SUM(e.is_read) AS count_reads, +SUM(e.is_favorite) AS count_favorites +FROM `{$this->prefix}entry` AS e +, `{$this->prefix}feed` AS f WHERE e.id_feed = f.id {$filter} SQL; @@ -55,20 +59,22 @@ SQL; /** * Calculates entry count per day on a 30 days period. - * Returns the result as a JSON string. + * Returns the result as a JSON object. * - * @return string + * @return JSON object */ public function calculateEntryCount() { $count = $this->initEntryCountArray(); - $period = self::ENTRY_COUNT_PERIOD; + $midnight = mktime(0, 0, 0); + $oldest = $midnight - (self::ENTRY_COUNT_PERIOD * 86400); // Get stats per day for the last 30 days + $sqlDay = $this->sqlFloor("(date - $midnight) / 86400"); $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 -{$period} DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d') +SELECT {$sqlDay} AS day, +COUNT(*) as count +FROM `{$this->prefix}entry` +WHERE date >= {$oldest} AND date < {$midnight} GROUP BY day ORDER BY day ASC SQL; @@ -80,28 +86,7 @@ SQL; $count[$value['day']] = (int) $value['count']; } - return $this->convertToSerie($count); - } - - /** - * Calculates entry average per day on a 30 days period. - * - * @return integer - */ - public function calculateEntryAverage() { - $period = self::ENTRY_COUNT_PERIOD; - - // Get stats per day for the last 30 days - $sql = <<<SQL -SELECT COUNT(1) / {$period} AS average -FROM {$this->prefix}entry AS e -WHERE FROM_UNIXTIME(e.date, '%Y%m%d') BETWEEN DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -{$period} DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d') -SQL; - $stm = $this->bd->prepare($sql); - $stm->execute(); - $res = $stm->fetch(PDO::FETCH_NAMED); - - return round($res['average'], 2); + return $count; } /** @@ -158,7 +143,7 @@ SQL; $sql = <<<SQL SELECT DATE_FORMAT(FROM_UNIXTIME(e.date), '{$period}') AS period , COUNT(1) AS count -FROM {$this->prefix}entry AS e +FROM `{$this->prefix}entry` AS e {$restrict} GROUP BY period ORDER BY period ASC @@ -168,11 +153,12 @@ SQL; $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_NAMED); + $repartition = array(); foreach ($res as $value) { $repartition[(int) $value['period']] = (int) $value['count']; } - return $this->convertToSerie($repartition); + return $repartition; } /** @@ -221,7 +207,7 @@ SQL; SELECT COUNT(1) AS count , MIN(date) AS date_min , MAX(date) AS date_max -FROM {$this->prefix}entry AS e +FROM `{$this->prefix}entry` AS e {$restrict} SQL; $stm = $this->bd->prepare($sql); @@ -257,16 +243,16 @@ SQL; /** * Calculates feed count per category. - * Returns the result as a JSON string. + * Returns the result as a JSON object. * - * @return string + * @return JSON object */ 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 +FROM `{$this->prefix}category` AS c, +`{$this->prefix}feed` AS f WHERE c.id = f.category GROUP BY label ORDER BY data DESC @@ -275,22 +261,22 @@ SQL; $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - return $this->convertToPieSerie($res); + return $res; } /** * Calculates entry count per category. * Returns the result as a JSON string. * - * @return string + * @return JSON object */ 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 +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 @@ -300,7 +286,7 @@ SQL; $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - return $this->convertToPieSerie($res); + return $res; } /** @@ -314,9 +300,9 @@ 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 +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 f.id @@ -339,8 +325,8 @@ SELECT MAX(f.id) as id , MAX(f.name) AS name , MAX(date) AS last_date , COUNT(*) AS nb_articles -FROM {$this->prefix}feed AS f, -{$this->prefix}entry AS e +FROM `{$this->prefix}feed` AS f, +`{$this->prefix}entry` AS e WHERE f.id = e.id_feed GROUP BY f.id ORDER BY name @@ -350,27 +336,6 @@ SQL; return $stm->fetchAll(PDO::FETCH_ASSOC); } - protected function convertToSerie($data) { - $serie = array(); - - foreach ($data as $key => $value) { - $serie[] = array($key, $value); - } - - return json_encode($serie); - } - - protected function convertToPieSerie($data) { - $serie = array(); - - foreach ($data as $value) { - $value['data'] = array(array(0, (int) $value['data'])); - $serie[] = $value; - } - - return json_encode($serie); - } - /** * Gets days ready for graphs * @@ -399,7 +364,7 @@ SQL; 'feb', 'mar', 'apr', - 'may', + 'may_', 'jun', 'jul', 'aug', @@ -411,17 +376,17 @@ SQL; } /** - * Translates array content and encode it as JSON + * Translates array content * * @param array $data - * @return string + * @return JSON object */ private function convertToTranslatedJson($data = array()) { $translated = array_map(function($a) { return _t('gen.date.' . $a); }, $data); - return json_encode($translated); + return $translated; } } diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php new file mode 100644 index 000000000..1effbb64b --- /dev/null +++ b/app/Models/StatsDAOPGSQL.php @@ -0,0 +1,67 @@ +<?php + +class FreshRSS_StatsDAOPGSQL extends FreshRSS_StatsDAO { + + /** + * Calculates the number of article per hour of the day per feed + * + * @param integer $feed id + * @return string + */ + public function calculateEntryRepartitionPerFeedPerHour($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('hour', $feed); + } + + /** + * Calculates the number of article per day of week per feed + * + * @param integer $feed id + * @return string + */ + public function calculateEntryRepartitionPerFeedPerDayOfWeek($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('day', $feed); + } + + /** + * Calculates the number of article per month per feed + * + * @param integer $feed + * @return string + */ + public function calculateEntryRepartitionPerFeedPerMonth($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('month', $feed); + } + + /** + * Calculates the number of article per period per feed + * + * @param string $period format string to use for grouping + * @param integer $feed id + * @return string + */ + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + $restrict = ''; + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } + $sql = <<<SQL +SELECT extract( {$period} from to_timestamp(e.date)) AS period +, COUNT(1) AS count +FROM "{$this->prefix}entry" AS e +{$restrict} +GROUP BY period +ORDER BY period ASC +SQL; + + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_NAMED); + + foreach ($res as $value) { + $repartition[(int) $value['period']] = (int) $value['count']; + } + + return $repartition; + } + +} diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php index bb2336532..6cfc20463 100644 --- a/app/Models/StatsDAOSQLite.php +++ b/app/Models/StatsDAOSQLite.php @@ -2,59 +2,8 @@ class FreshRSS_StatsDAOSQLite extends FreshRSS_StatsDAO { - /** - * Calculates entry count per day on a 30 days period. - * Returns the result as a JSON string. - * - * @return string - */ - public function calculateEntryCount() { - $count = $this->initEntryCountArray(); - $period = parent::ENTRY_COUNT_PERIOD; - - // Get stats per day for the last 30 days - $sql = <<<SQL -SELECT round(julianday(e.date, 'unixepoch') - julianday('now')) AS day, -COUNT(1) AS count -FROM {$this->prefix}entry AS e -WHERE strftime('%Y%m%d', e.date, 'unixepoch') - BETWEEN strftime('%Y%m%d', 'now', '-{$period} days') - AND strftime('%Y%m%d', 'now', '-1 day') -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[(int) $value['day']] = (int) $value['count']; - } - - return $this->convertToSerie($count); - } - - /** - * Calculates entry average per day on a 30 days period. - * - * @return integer - */ - public function calculateEntryAverage() { - $period = self::ENTRY_COUNT_PERIOD; - - // Get stats per day for the last 30 days - $sql = <<<SQL -SELECT COUNT(1) / {$period} AS average -FROM {$this->prefix}entry AS e -WHERE strftime('%Y%m%d', e.date, 'unixepoch') - BETWEEN strftime('%Y%m%d', 'now', '-{$period} days') - AND strftime('%Y%m%d', 'now', '-1 day') -SQL; - $stm = $this->bd->prepare($sql); - $stm->execute(); - $res = $stm->fetch(PDO::FETCH_NAMED); - - return round($res['average'], 2); + protected function sqlFloor($s) { + return "CAST(($s) AS INT)"; } protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { @@ -66,7 +15,7 @@ SQL; $sql = <<<SQL SELECT strftime('{$period}', e.date, 'unixepoch') AS period , COUNT(1) AS count -FROM {$this->prefix}entry AS e +FROM `{$this->prefix}entry` AS e {$restrict} GROUP BY period ORDER BY period ASC @@ -81,7 +30,7 @@ SQL; $repartition[(int) $value['period']] = (int) $value['count']; } - return $this->convertToSerie($repartition); + return $repartition; } } diff --git a/app/Models/Themes.php b/app/Models/Themes.php index e3b260261..8920fbf7e 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -25,7 +25,7 @@ class FreshRSS_Themes extends Minz_Model { } public static function get_infos($theme_id) { - $theme_dir = PUBLIC_PATH . self::$themesUrl . $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)) { @@ -109,14 +109,8 @@ class FreshRSS_Themes extends Minz_Model { } $url = $name . '.svg'; - $url = isset(self::$themeIcons[$url]) ? (self::$themeIconsUrl . $url) : - (self::$defaultIconsUrl . $url); + $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] . '" />'; + return $urlOnly ? Minz_Url::display($url) : '<img class="icon" src="' . Minz_Url::display($url) . '" alt="' . $alts[$name] . '" />'; } } - -function _i($icon, $url_only = false) { - return FreshRSS_Themes::icon($icon, $url_only); -} diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index b55766ab4..c921d54c9 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -1,34 +1,62 @@ <?php class FreshRSS_UserDAO extends Minz_ModelPdo { - public function createUser($username) { + public function createUser($username, $new_user_language, $insertDefaultFeeds = true) { $db = FreshRSS_Context::$system_conf->db; require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); $userPDO = new Minz_ModelPdo($username); - $ok = false; - if (defined('SQL_CREATE_TABLES')) { //E.g. MySQL - $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_', _t('gen.short.default_category')); - $stm = $userPDO->bd->prepare($sql); - $ok = $stm && $stm->execute(); - } else { //E.g. SQLite - global $SQL_CREATE_TABLES; - if (is_array($SQL_CREATE_TABLES)) { - $ok = true; - foreach ($SQL_CREATE_TABLES as $instruction) { - $sql = sprintf($instruction, '', _t('gen.short.default_category')); + $currentLanguage = Minz_Translate::language(); + + try { + Minz_Translate::reset($new_user_language); + $ok = false; + $bd_prefix_user = $db['prefix'] . $username . '_'; + if (defined('SQL_CREATE_TABLES')) { //E.g. MySQL + $sql = sprintf(SQL_CREATE_TABLES . SQL_CREATE_TABLE_ENTRYTMP, $bd_prefix_user, _t('gen.short.default_category')); + $stm = $userPDO->bd->prepare($sql); + $ok = $stm && $stm->execute(); + } else { //E.g. SQLite + global $SQL_CREATE_TABLES; + global $SQL_CREATE_TABLE_ENTRYTMP; + if (is_array($SQL_CREATE_TABLES)) { + $instructions = array_merge($SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP); + $ok = !empty($instructions); + foreach ($instructions as $instruction) { + $sql = sprintf($instruction, $bd_prefix_user, _t('gen.short.default_category')); + $stm = $userPDO->bd->prepare($sql); + $ok &= ($stm && $stm->execute()); + } + } + } + if ($ok && $insertDefaultFeeds) { + if (defined('SQL_INSERT_FEEDS')) { //E.g. MySQL + $sql = sprintf(SQL_INSERT_FEEDS, $bd_prefix_user); $stm = $userPDO->bd->prepare($sql); - $ok &= ($stm && $stm->execute()); + $ok &= $stm && $stm->execute(); + } else { //E.g. SQLite + global $SQL_INSERT_FEEDS; + if (is_array($SQL_INSERT_FEEDS)) { + foreach ($SQL_INSERT_FEEDS as $instruction) { + $sql = sprintf($instruction, $bd_prefix_user); + $stm = $userPDO->bd->prepare($sql); + $ok &= ($stm && $stm->execute()); + } + } } } + } catch (Exception $e) { + Minz_Log::error('Error while creating user: ' . $e->getMessage()); } + Minz_Translate::reset($currentLanguage); + if ($ok) { return true; } else { $info = empty($stm) ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error : ' . $info[2]); + Minz_Log::error('SQL error: ' . $info[2]); return false; } } @@ -55,14 +83,17 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } public static function exist($username) { - return is_dir(join_path(DATA_PATH , 'users', $username)); + return is_dir(join_path(DATA_PATH, 'users', $username)); } - public static function touch($username) { - return touch(join_path(DATA_PATH , 'users', $username, 'config.php')); + public static function touch($username = '') { + if (!FreshRSS_user_Controller::checkUsername($username)) { + $username = Minz_Session::param('currentUser', '_'); + } + return touch(join_path(DATA_PATH, 'users', $username, 'config.php')); } public static function mtime($username) { - return @filemtime(join_path(DATA_PATH , 'users', $username, 'config.php')); + return @filemtime(join_path(DATA_PATH, 'users', $username, 'config.php')); } } diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php new file mode 100644 index 000000000..52747f538 --- /dev/null +++ b/app/Models/UserQuery.php @@ -0,0 +1,226 @@ +<?php + +/** + * Contains the description of a user query + * + * It allows to extract the meaningful bits of the query to be manipulated in an + * easy way. + */ +class FreshRSS_UserQuery { + + private $deprecated = false; + private $get; + private $get_name; + private $get_type; + private $name; + private $order; + private $search; + private $state; + private $url; + private $feed_dao; + private $category_dao; + + /** + * @param array $query + * @param FreshRSS_Searchable $feed_dao + * @param FreshRSS_Searchable $category_dao + */ + public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null) { + $this->category_dao = $category_dao; + $this->feed_dao = $feed_dao; + if (isset($query['get'])) { + $this->parseGet($query['get']); + } + if (isset($query['name'])) { + $this->name = $query['name']; + } + if (isset($query['order'])) { + $this->order = $query['order']; + } + if (!isset($query['search'])) { + $query['search'] = ''; + } + // linked to deeply with the search object, need to use dependency injection + $this->search = new FreshRSS_Search($query['search']); + if (isset($query['state'])) { + $this->state = $query['state']; + } + if (isset($query['url'])) { + $this->url = $query['url']; + } + } + + /** + * Convert the current object to an array. + * + * @return array + */ + public function toArray() { + return array_filter(array( + 'get' => $this->get, + 'name' => $this->name, + 'order' => $this->order, + 'search' => $this->search->__toString(), + 'state' => $this->state, + 'url' => $this->url, + )); + } + + /** + * Parse the get parameter in the query string to extract its name and + * type + * + * @param string $get + */ + private function parseGet($get) { + $this->get = $get; + if (preg_match('/(?P<type>[acfs])(_(?P<id>\d+))?/', $get, $matches)) { + switch ($matches['type']) { + case 'a': + $this->parseAll(); + break; + case 'c': + $this->parseCategory($matches['id']); + break; + case 'f': + $this->parseFeed($matches['id']); + break; + case 's': + $this->parseFavorite(); + break; + } + } + } + + /** + * Parse the query string when it is an "all" query + */ + private function parseAll() { + $this->get_name = 'all'; + $this->get_type = 'all'; + } + + /** + * Parse the query string when it is a "category" query + * + * @param integer $id + * @throws FreshRSS_DAO_Exception + */ + private function parseCategory($id) { + if (is_null($this->category_dao)) { + throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery'); + } + $category = $this->category_dao->searchById($id); + if ($category) { + $this->get_name = $category->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'category'; + } + + /** + * Parse the query string when it is a "feed" query + * + * @param integer $id + * @throws FreshRSS_DAO_Exception + */ + private function parseFeed($id) { + if (is_null($this->feed_dao)) { + throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery'); + } + $feed = $this->feed_dao->searchById($id); + if ($feed) { + $this->get_name = $feed->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'feed'; + } + + /** + * Parse the query string when it is a "favorite" query + */ + private function parseFavorite() { + $this->get_name = 'favorite'; + $this->get_type = 'favorite'; + } + + /** + * Check if the current user query is deprecated. + * It is deprecated if the category or the feed used in the query are + * not existing. + * + * @return boolean + */ + public function isDeprecated() { + return $this->deprecated; + } + + /** + * Check if the user query has parameters. + * If the type is 'all', it is considered equal to no parameters + * + * @return boolean + */ + public function hasParameters() { + if ($this->get_type === 'all') { + return false; + } + if ($this->hasSearch()) { + return true; + } + if ($this->state) { + return true; + } + if ($this->order) { + return true; + } + if ($this->get) { + return true; + } + return false; + } + + /** + * Check if there is a search in the search object + * + * @return boolean + */ + public function hasSearch() { + return $this->search->getRawInput() != ""; + } + + public function getGet() { + return $this->get; + } + + public function getGetName() { + return $this->get_name; + } + + public function getGetType() { + return $this->get_type; + } + + public function getName() { + return $this->name; + } + + public function getOrder() { + return $this->order; + } + + public function getSearch() { + return $this->search; + } + + public function getState() { + return $this->state; + } + + public function getUrl() { + return $this->url; + } + +} diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index cf0159199..09defd452 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -1,21 +1,23 @@ <?php +define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + define('SQL_CREATE_TABLES', ' CREATE TABLE IF NOT EXISTS `%1$scategory` ( `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `name` varchar(255) NOT NULL, + `name` varchar(191) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`name`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_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, + `name` varchar(191) NOT NULL, `website` varchar(255) CHARACTER SET latin1, `description` text, - `lastUpdate` int(11) DEFAULT 0, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 `priority` tinyint(2) NOT NULL DEFAULT 10, `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, @@ -30,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `%1$sfeed` ( INDEX (`name`), -- v0.7 INDEX (`priority`), -- v0.7 INDEX (`keep_history`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = INNODB; CREATE TABLE IF NOT EXISTS `%1$sentry` ( @@ -40,7 +42,9 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( `author` varchar(255), `content_bin` blob, -- v0.7 `link` varchar(1023) CHARACTER SET latin1 NOT NULL, - `date` int(11), + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, -- v0.7 @@ -49,11 +53,64 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( 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 + INDEX (`is_read`), -- v0.7 + INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1 + -- INDEX `entry_feed_read_index` (`id_feed`,`is_read`) -- v1.7 Located futher down +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = INNODB; INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s"); '); -define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); +define('SQL_CREATE_TABLE_ENTRYTMP', ' +CREATE TABLE IF NOT EXISTS `%1$sentrytmp` ( -- v1.7 + `id` bigint NOT NULL, + `guid` varchar(760) CHARACTER SET latin1 NOT NULL, + `title` varchar(255) NOT NULL, + `author` varchar(255), + `content_bin` blob, + `link` varchar(1023) CHARACTER SET latin1 NOT NULL, + `date` int(11), + `lastSeen` INT(11) DEFAULT 0, + `hash` BINARY(16), + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, + `id_feed` SMALLINT, + `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`), + INDEX (`date`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci +ENGINE = INNODB; + +CREATE INDEX `entry_feed_read_index` ON `%1$sentry`(`id_feed`,`is_read`); -- v1.7 Located here to be auto-added +'); + +define('SQL_INSERT_FEEDS', ' +INSERT IGNORE INTO `%1$sfeed` (url, category, name, website, description, ttl) VALUES("http://freshrss.org/feeds/all.atom.xml", 1, "FreshRSS.org", "http://freshrss.org/", "FreshRSS, a free, self-hostable aggregator…", 86400); +INSERT IGNORE INTO `%1$sfeed` (url, category, name, website, description, ttl) VALUES("https://github.com/FreshRSS/FreshRSS/releases.atom", 1, "FreshRSS @ GitHub", "https://github.com/FreshRSS/FreshRSS/", "FreshRSS releases @ GitHub", 86400); +'); + +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS `%1$sentrytmp`, `%1$sentry`, `%1$sfeed`, `%1$scategory`'); + +define('SQL_UPDATE_UTF8MB4', ' +ALTER DATABASE `%2$s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +ALTER TABLE `%1$scategory` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +UPDATE `%1$scategory` SET name=SUBSTRING(name,1,190) WHERE LENGTH(name) > 191; +ALTER TABLE `%1$scategory` MODIFY `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +OPTIMIZE TABLE `%1$scategory`; + +ALTER TABLE `%1$sfeed` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +UPDATE `%1$sfeed` SET name=SUBSTRING(name,1,190) WHERE LENGTH(name) > 191; +ALTER TABLE `%1$sfeed` MODIFY `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `%1$sfeed` MODIFY `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +OPTIMIZE TABLE `%1$sfeed`; + +ALTER TABLE `%1$sentry` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `%1$sentry` MODIFY `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `%1$sentry` MODIFY `author` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `%1$sentry` MODIFY `tags` VARCHAR(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +OPTIMIZE TABLE `%1$sentry`; +'); diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php new file mode 100644 index 000000000..4cfeb2517 --- /dev/null +++ b/app/SQL/install.sql.pgsql.php @@ -0,0 +1,87 @@ +<?php +define('SQL_CREATE_DB', 'CREATE DATABASE %1$s ENCODING \'UTF8\';'); + +global $SQL_CREATE_TABLES; +$SQL_CREATE_TABLES = array( +'CREATE TABLE IF NOT EXISTS "%1$scategory" ( + "id" SERIAL PRIMARY KEY, + "name" VARCHAR(255) UNIQUE NOT NULL +);', + +'CREATE TABLE IF NOT EXISTS "%1$sfeed" ( + "id" SERIAL PRIMARY KEY, + "url" varchar(511) UNIQUE NOT NULL, + "category" SMALLINT DEFAULT 0, + "name" VARCHAR(255) NOT NULL, + "website" VARCHAR(255), + "description" text, + "lastUpdate" INT DEFAULT 0, + "priority" SMALLINT NOT NULL DEFAULT 10, + "pathEntries" VARCHAR(511) DEFAULT NULL, + "httpAuth" VARCHAR(511) DEFAULT NULL, + "error" smallint DEFAULT 0, + "keep_history" INT NOT NULL DEFAULT -2, + "ttl" INT NOT NULL DEFAULT -2, + "cache_nbEntries" INT DEFAULT 0, + "cache_nbUnreads" INT DEFAULT 0, + FOREIGN KEY ("category") REFERENCES "%1$scategory" ("id") ON DELETE SET NULL ON UPDATE CASCADE +);', +'CREATE INDEX %1$sname_index ON "%1$sfeed" ("name");', +'CREATE INDEX %1$spriority_index ON "%1$sfeed" ("priority");', +'CREATE INDEX %1$skeep_history_index ON "%1$sfeed" ("keep_history");', + +'CREATE TABLE IF NOT EXISTS "%1$sentry" ( + "id" BIGINT NOT NULL PRIMARY KEY, + "guid" VARCHAR(760) NOT NULL, + "title" VARCHAR(255) NOT NULL, + "author" VARCHAR(255), + "content" TEXT, + "link" VARCHAR(1023) NOT NULL, + "date" INT, + "lastSeen" INT DEFAULT 0, + "hash" BYTEA, + "is_read" SMALLINT NOT NULL DEFAULT 0, + "is_favorite" SMALLINT NOT NULL DEFAULT 0, + "id_feed" SMALLINT, + "tags" VARCHAR(1023), + FOREIGN KEY ("id_feed") REFERENCES "%1$sfeed" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE ("id_feed","guid") +);', +'CREATE INDEX %1$sis_favorite_index ON "%1$sentry" ("is_favorite");', +'CREATE INDEX %1$sis_read_index ON "%1$sentry" ("is_read");', +'CREATE INDEX %1$sentry_lastSeen_index ON "%1$sentry" ("lastSeen");', + +'INSERT INTO "%1$scategory" (name) SELECT \'%2$s\' WHERE NOT EXISTS (SELECT id FROM "%1$scategory" WHERE id = 1);', +); + +global $SQL_CREATE_TABLE_ENTRYTMP; +$SQL_CREATE_TABLE_ENTRYTMP = array( +'CREATE TABLE IF NOT EXISTS "%1$sentrytmp" ( -- v1.7 + "id" BIGINT NOT NULL PRIMARY KEY, + "guid" VARCHAR(760) NOT NULL, + "title" VARCHAR(255) NOT NULL, + "author" VARCHAR(255), + "content" TEXT, + "link" VARCHAR(1023) NOT NULL, + "date" INT, + "lastSeen" INT DEFAULT 0, + "hash" BYTEA, + "is_read" SMALLINT NOT NULL DEFAULT 0, + "is_favorite" SMALLINT NOT NULL DEFAULT 0, + "id_feed" SMALLINT, + "tags" VARCHAR(1023), + FOREIGN KEY ("id_feed") REFERENCES "%1$sfeed" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE ("id_feed","guid") +);', +'CREATE INDEX %1$sentrytmp_date_index ON "%1$sentrytmp" ("date");', + +'CREATE INDEX %1$sentry_feed_read_index ON "%1$sentry" ("id_feed","is_read");', //v1.7 +); + +global $SQL_INSERT_FEEDS; +$SQL_INSERT_FEEDS = array( +'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) SELECT \'http://freshrss.org/feeds/all.atom.xml\', 1, \'FreshRSS.org\', \'http://freshrss.org/\', \'FreshRSS, a free, self-hostable aggregator…\', 86400 WHERE NOT EXISTS (SELECT id FROM "%1$sfeed" WHERE url = \'http://freshrss.org/feeds/all.atom.xml\');', +'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) SELECT \'https://github.com/FreshRSS/FreshRSS/releases.atom\', 1, \'FreshRSS @ GitHub\', \'https://github.com/FreshRSS/FreshRSS/\', \'FreshRSS releases @ GitHub\', 86400 WHERE NOT EXISTS (SELECT id FROM "%1$sfeed" WHERE url = \'https://github.com/FreshRSS/FreshRSS/releases.atom\');', +); + +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS "%1$sentrytmp", "%1$sentry", "%1$sfeed", "%1$scategory"'); diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 30bca2810..d485e2120 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -1,20 +1,20 @@ <?php global $SQL_CREATE_TABLES; $SQL_CREATE_TABLES = array( -'CREATE TABLE IF NOT EXISTS `%1$scategory` ( +'CREATE TABLE IF NOT EXISTS `category` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` varchar(255) NOT NULL, UNIQUE (`name`) );', -'CREATE TABLE IF NOT EXISTS `%1$sfeed` ( +'CREATE TABLE IF NOT EXISTS `feed` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `url` varchar(511) NOT NULL, - `%1$scategory` SMALLINT DEFAULT 0, + `category` SMALLINT DEFAULT 0, `name` varchar(255) NOT NULL, `website` varchar(255), `description` text, - `lastUpdate` int(11) DEFAULT 0, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 `priority` tinyint(2) NOT NULL DEFAULT 10, `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, @@ -23,15 +23,41 @@ $SQL_CREATE_TABLES = array( `ttl` INT NOT NULL DEFAULT -2, `cache_nbEntries` int DEFAULT 0, `cache_nbUnreads` int DEFAULT 0, - FOREIGN KEY (`%1$scategory`) REFERENCES `%1$scategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, + FOREIGN KEY (`category`) REFERENCES `category`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, UNIQUE (`url`) );', +'CREATE INDEX IF NOT EXISTS feed_name_index ON `feed`(`name`);', +'CREATE INDEX IF NOT EXISTS feed_priority_index ON `feed`(`priority`);', +'CREATE INDEX IF NOT EXISTS feed_keep_history_index ON `feed`(`keep_history`);', -'CREATE INDEX IF NOT EXISTS feed_name_index ON `%1$sfeed`(`name`);', -'CREATE INDEX IF NOT EXISTS feed_priority_index ON `%1$sfeed`(`priority`);', -'CREATE INDEX IF NOT EXISTS feed_keep_history_index ON `%1$sfeed`(`keep_history`);', +'CREATE TABLE IF NOT EXISTS `entry` ( + `id` bigint NOT NULL, + `guid` varchar(760) NOT NULL, + `title` varchar(255) NOT NULL, + `author` varchar(255), + `content` text, + `link` varchar(1023) NOT NULL, + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, + `id_feed` SMALLINT, + `tags` varchar(1023), + PRIMARY KEY (`id`), + FOREIGN KEY (`id_feed`) REFERENCES `feed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE (`id_feed`,`guid`) +);', +'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `entry`(`is_favorite`);', +'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `entry`(`is_read`);', +'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `entry`(`lastSeen`);', //v1.1.1 + +'INSERT OR IGNORE INTO `category` (id, name) VALUES(1, "%2$s");', +); -'CREATE TABLE IF NOT EXISTS `%1$sentry` ( +global $SQL_CREATE_TABLE_ENTRYTMP; +$SQL_CREATE_TABLE_ENTRYTMP = array( +'CREATE TABLE IF NOT EXISTS `entrytmp` ( -- v1.7 `id` bigint NOT NULL, `guid` varchar(760) NOT NULL, `title` varchar(255) NOT NULL, @@ -39,19 +65,59 @@ $SQL_CREATE_TABLES = array( `content` text, `link` varchar(1023) NOT NULL, `date` int(11), + `lastSeen` INT(11) DEFAULT 0, + `hash` BINARY(16), `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, `tags` varchar(1023), PRIMARY KEY (`id`), - FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (`id_feed`) REFERENCES `feed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, UNIQUE (`id_feed`,`guid`) );', +'CREATE INDEX IF NOT EXISTS entrytmp_date_index ON `entrytmp`(`date`);', -'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `%1$sentry`(`is_favorite`);', -'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `%1$sentry`(`is_read`);', +'CREATE INDEX IF NOT EXISTS `entry_feed_read_index` ON `entry`(`id_feed`,`is_read`);', //v1.7 +); -'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', +global $SQL_INSERT_FEEDS; +$SQL_INSERT_FEEDS = array( +'INSERT OR IGNORE INTO `feed` + ( + url, + category, + name, + website, + description, + ttl + ) + VALUES + ( + "http://freshrss.org/feeds/all.atom.xml", + 1, + "FreshRSS.org", + "http://freshrss.org/", + "FreshRSS, a free, self-hostable aggregator…", + 86400 + );', +'INSERT OR IGNORE INTO `feed` + ( + url, + category, + name, + website, + description, + ttl + ) + VALUES + ( + "https://github.com/FreshRSS/FreshRSS/releases.atom", + 1, + "FreshRSS releases", + "https://github.com/FreshRSS/FreshRSS/", + "FreshRSS releases @ GitHub", + 86400 + );', ); -define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS `entrytmp`, `entry`, `feed`, `category`'); diff --git a/app/actualize_script.php b/app/actualize_script.php index fc4f9bfbb..6f48220a6 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -1,6 +1,5 @@ <?php -require(dirname(__FILE__) . '/../constants.php'); -require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader +require(__DIR__ . '/../cli/_cli.php'); session_cache_limiter(''); ob_implicit_flush(false); @@ -12,7 +11,6 @@ if (defined('STDOUT')) { fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered } - // Set the header params ($_GET) to call the FRSS application. $_GET['c'] = 'feed'; $_GET['a'] = 'actualize'; @@ -20,37 +18,35 @@ $_GET['ajax'] = 1; $_GET['force'] = true; $_SERVER['HTTP_HOST'] = ''; - -$log_file = join_path(USERS_PATH, '_', 'log.txt'); - - $app = new FreshRSS(); $system_conf = Minz_Configuration::get('system'); $system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) +// make sure the PHP setup of the CLI environment is compatible with FreshRSS as well +performRequirementCheck($system_conf->db['type']); + // Create the list of users to actualize. // Users are processed in a random order but always start with admin $users = listUsers(); shuffle($users); -if ($system_conf->default_user !== ''){ +if ($system_conf->default_user !== '') { array_unshift($users, $system_conf->default_user); $users = array_unique($users); } - $limits = $system_conf->limits; $min_last_activity = time() - $limits['max_inactivity']; foreach ($users as $user) { if (($user !== $system_conf->default_user) && (FreshRSS_UserDAO::mtime($user) < $min_last_activity)) { - Minz_Log::notice('FreshRSS skip inactive user ' . $user, $log_file); + Minz_Log::notice('FreshRSS skip inactive user ' . $user, ADMIN_LOG); if (defined('STDOUT')) { fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n"); //Unbuffered } continue; } - Minz_Log::notice('FreshRSS actualize ' . $user, $log_file); + Minz_Log::notice('FreshRSS actualize ' . $user, ADMIN_LOG); if (defined('STDOUT')) { fwrite(STDOUT, 'Actualize ' . $user . "...\n"); //Unbuffered } @@ -65,16 +61,14 @@ foreach ($users as $user) { if (!invalidateHttpCache()) { - Minz_Log::notice('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), - $log_file); + Minz_Log::warning('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), ADMIN_LOG); if (defined('STDERR')) { fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); } } } - -Minz_Log::notice('FreshRSS actualize done.', $log_file); +Minz_Log::notice('FreshRSS actualize done.', ADMIN_LOG); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); $end_date = date_create('now'); diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php new file mode 100644 index 000000000..dbfebd4c9 --- /dev/null +++ b/app/i18n/cz/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Umožnit anonymně číst články výchozího uživatele (%s)', + 'allow_anonymous_refresh' => 'Umožnit anonymní obnovení článků', + 'api_enabled' => 'Povolit přístup k <abbr>API</abbr> <small>(vyžadováno mobilními aplikacemi)</small>', + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'title' => 'Přihlášení', + 'title_reset' => 'Reset přihlášení', + 'token' => 'Authentizační token', + 'token_help' => 'Umožňuje přístup k RSS kanálu článků výchozího uživatele bez přihlášení:', + 'type' => 'Způsob přihlášení', + 'unsafe_autologin' => 'Povolit nebezpečné automatické přihlášení přes: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/cache</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'categories' => array( + 'nok' => 'Tabulka kategorií je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'connection' => array( + 'nok' => 'Nelze navázat spojení s databází.', + 'ok' => 'Připojení k databázi je v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro ověřování znaků (php-ctype).', + 'ok' => 'Máte požadovanou knihovnu pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'database' => 'Instalace databáze', + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM (balíček php-xml).', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'entries' => array( + 'nok' => 'Tabulka článků je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/favicons</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'feeds' => array( + 'nok' => 'Tabulka kanálů je nastavena špatně.', + 'ok' => 'Tabulka kanálů je v pořádku.', + ), + 'fileinfo' => array( + 'nok' => 'Nemáte PHP fileinfo (balíček fileinfo).', + 'ok' => 'Máte rozšíření fileinfo.', + ), + 'files' => 'Instalace souborů', + 'json' => array( + 'nok' => 'Nemáte JSON (balíček php5-json).', + 'ok' => 'Máte rozšíření JSON.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP instalace', + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'tables' => array( + 'nok' => 'V databázi chybí jedna nevo více tabulek.', + 'ok' => 'V databázi jsou všechny tabulky.', + ), + 'title' => 'Kontrola instalace', + 'tokens' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/tokens</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře tokens jsou v pořádku.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/users</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + 'zip' => array( + 'nok' => 'Nemáte rozšíření ZIP (balíček php-zip).', + 'ok' => 'Máte rozšíření ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Vypnuto', + 'empty_list' => 'Není naistalováno žádné rozšíření', + 'enabled' => 'Zapnuto', + 'no_configure_view' => 'Toto rozšíření nemá žádné možnosti nastavení.', + 'system' => array( + '_' => 'Systémová rozšíření', + 'no_rights' => 'Systémová rozšíření (na ně nemáte oprávnění)', + ), + 'title' => 'Rozšíření', + 'user' => 'Uživatelská rozšíření', + ), + 'stats' => array( + '_' => 'Statistika', + 'all_feeds' => 'Všechny kanály', + 'category' => 'Kategorie', + 'entry_count' => 'Počet článků', + 'entry_per_category' => 'Článků na kategorii', + 'entry_per_day' => 'Článků za den (posledních 30 dní)', + 'entry_per_day_of_week' => 'Za den v týdnu (průměr: %.2f zprávy)', + 'entry_per_hour' => 'Za hodinu (průměr: %.2f zprávy)', + 'entry_per_month' => 'Za měsíc (průměr: %.2f zprávy)', + 'entry_repartition' => 'Rozdělení článků', + 'feed' => 'Kanál', + 'feed_per_category' => 'Článků na kategorii', + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'menu' => array( + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'repartition' => 'Rozdělení článků', + ), + 'no_idle' => 'Žádné neaktivní kanály!', + 'number_entries' => '%d článků', + 'percent_of_total' => '%% ze všech', + 'repartition' => 'Rozdělení článků', + 'status_favorites' => 'Oblíbené', + 'status_read' => 'Přečtené', + 'status_total' => 'Celkem', + 'status_unread' => 'Nepřečtené', + 'title' => 'Statistika', + 'top_feed' => 'Top ten kanálů', + ), + 'system' => array( + '_' => 'System configuration', // @todo translate + 'auto-update-url' => 'Auto-update server URL', // @todo translate + 'instance-name' => 'Instance name', // @todo translate + 'max-categories' => 'Categories per user limit', // @todo translate + 'max-feeds' => 'Feeds per user limit', // @todo translate + 'registration' => array( + 'help' => '0 znamená žádná omezení účtu', + 'number' => 'Maximální počet účtů', + ), + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'update' => array( + '_' => 'Aktualizace systému', + 'apply' => 'Použít', + 'check' => 'Zkontrolovat aktualizace', + 'current_version' => 'Vaše instalace FreshRSS je verze %s.', + 'last' => 'Poslední kontrola: %s', + 'none' => 'Žádné nové aktualizace', + 'title' => 'Aktualizovat systém', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'create' => 'Vytvořit nového uživatele', + 'language' => 'Jazyk', + 'number' => 'Zatím je vytvořen %d účet', + 'numbers' => 'Zatím je vytvořeno %d účtů', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Správa uživatelů', + 'user_list' => 'Seznam uživatelů', + 'username' => 'Přihlašovací jméno', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php new file mode 100644 index 000000000..9a4410679 --- /dev/null +++ b/app/i18n/cz/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archivace', + 'advanced' => 'Pokročilé', + 'delete_after' => 'Smazat články starší než', + 'help' => 'Více možností je dostupných v nastavení jednotlivých kanálů', + 'keep_history_by_feed' => 'Zachovat tento minimální počet článků v každém kanálu', + 'optimize' => 'Optimalizovat databázi', + 'optimize_help' => 'Občasná údržba zmenší velikost databáze', + 'purge_now' => 'Vyčistit nyní', + 'title' => 'Archivace', + 'ttl' => 'Neaktualizovat častěji než', + ), + 'display' => array( + '_' => 'Zobrazení', + 'icon' => array( + 'bottom_line' => 'Spodní řádek', + 'entry' => 'Ikony článků', + 'publication_date' => 'Datum vydání', + 'related_tags' => 'Související tagy', + 'sharing' => 'Sdílení', + 'top_line' => 'Horní řádek', + ), + 'language' => 'Jazyk', + 'notif_html5' => array( + 'seconds' => 'sekund (0 znamená žádný timeout)', + 'timeout' => 'Timeout HTML5 notifikací', + ), + 'theme' => 'Vzhled', + 'title' => 'Zobrazení', + 'width' => array( + 'content' => 'Šířka obsahu', + 'large' => 'Velká', + 'medium' => 'Střední', + 'no_limit' => 'Bez limitu', + 'thin' => 'Tenká', + ), + ), + 'query' => array( + '_' => 'Uživatelské dotazy', + 'deprecated' => 'Tento dotaz již není platný. Odkazovaná kategorie nebo kanál byly smazány.', + 'filter' => 'Filtr aplikován:', + 'get_all' => 'Zobrazit všechny články', + 'get_category' => 'Zobrazit "%s" kategorii', + 'get_favorite' => 'Zobrazit oblíbené články', + 'get_feed' => 'Zobrazit "%s" článkek', + 'no_filter' => 'Zrušit filtr', + 'none' => 'Ještě jste nevytvořil žádný uživatelský dotaz.', + 'number' => 'Dotaz n°%d', + 'order_asc' => 'Zobrazit nejdříve nejstarší články', + 'order_desc' => 'Zobrazit nejdříve nejnovější články', + 'search' => 'Hledat "%s"', + 'state_0' => 'Zobrazit všechny články', + 'state_1' => 'Zobrazit přečtené články', + 'state_2' => 'Zobrazit nepřečtené články', + 'state_3' => 'Zobrazit všechny články', + 'state_4' => 'Zobrazit oblíbené články', + 'state_5' => 'Zobrazit oblíbené přečtené články', + 'state_6' => 'Zobrazit oblíbené nepřečtené články', + 'state_7' => 'Zobrazit oblíbené články', + 'state_8' => 'Zobrazit všechny články vyjma oblíbených', + 'state_9' => 'Zobrazit všechny přečtené články vyjma oblíbených', + 'state_10' => 'Zobrazit všechny nepřečtené články vyjma oblíbených', + 'state_11' => 'Zobrazit všechny články vyjma oblíbených', + 'state_12' => 'Zobrazit všechny články', + 'state_13' => 'Zobrazit přečtené články', + 'state_14' => 'Zobrazit nepřečtené články', + 'state_15' => 'Zobrazit všechny články', + 'title' => 'Uživatelské dotazy', + ), + 'profile' => array( + '_' => 'Správa profilu', + 'delete' => array( + '_' => 'Smazání účtu', + 'warn' => 'Váš účet bude smazán spolu se všemi souvisejícími daty', + ), + 'password_api' => 'Password API<br /><small>(tzn. pro mobilní aplikace)</small>', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Čtení', + 'after_onread' => 'Po “označit vše jako přečtené”,', + 'articles_per_page' => 'Počet článků na stranu', + 'auto_load_more' => 'Načítat další články dole na stránce', + 'auto_remove_article' => 'Po přečtení články schovat', + 'mark_updated_article_unread' => 'Označte aktualizované položky jako nepřečtené', + 'confirm_enabled' => 'Vyžadovat potvrzení pro akci “označit vše jako přečtené”', + 'display_articles_unfolded' => 'Ve výchozím stavu zobrazovat články otevřené', + 'display_categories_unfolded' => 'Ve výchozím stavu zobrazovat kategorie zavřené', + 'hide_read_feeds' => 'Schovat kategorie a kanály s nulovým počtem nepřečtených článků (nefunguje s nastavením “Zobrazit všechny články”)', + 'img_with_lazyload' => 'Použít "lazy load" mód pro načítaní obrázků', + 'sides_close_article' => 'Clicking outside of article text area closes the article', //TODO + 'jump_next' => 'skočit na další nepřečtený (kanál nebo kategorii)', + 'number_divided_when_reader' => 'V režimu “Čtení” děleno dvěma.', + 'read' => array( + 'article_open_on_website' => 'když je otevřen původní web s článkem', + 'article_viewed' => 'během čtení článku', + 'scroll' => 'během skrolování', + 'upon_reception' => 'po načtení článku', + 'when' => 'Označit článek jako přečtený…', + ), + 'show' => array( + '_' => 'Počet zobrazených článků', + 'adaptive' => 'Vyberte zobrazení', + 'all_articles' => 'Zobrazit všechny články', + 'unread' => 'Zobrazit jen nepřečtené', + ), + 'sort' => array( + '_' => 'Řazení', + 'newer_first' => 'Nejdříve nejnovější', + 'older_first' => 'Nejdříve nejstarší', + ), + 'sticky_post' => 'Při otevření posunout článek nahoru', + 'title' => 'Čtení', + 'view' => array( + 'default' => 'Výchozí', + 'global' => 'Přehled', + 'normal' => 'Normální', + 'reader' => 'Čtení', + ), + ), + 'sharing' => array( + '_' => 'Sdílení', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Více informací', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'share_name' => 'Jméno pro zobrazení', + 'share_url' => 'Jakou URL použít pro sdílení', + 'title' => 'Sdílení', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Zkratky', + 'article_action' => 'Články - akce', + 'auto_share' => 'Sdílet', + 'auto_share_help' => 'Je-li nastavena pouze jedna možnost sdílení, bude použita. Další možnosti jsou dostupné pomocí jejich čísla.', + 'close_dropdown' => 'Zavřít menu', + 'collapse_article' => 'Srolovat', + 'first_article' => 'Skočit na první článek', + 'focus_search' => 'Hledání', + 'help' => 'Zobrazit documentaci', + 'javascript' => 'Pro použití zkratek musí být povolen JavaScript', + 'last_article' => 'Skočit na poslední článek', + 'load_more' => 'Načíst více článků', + 'mark_read' => 'Označit jako přečtené', + 'mark_favorite' => 'Označit jako oblíbené', + 'navigation' => 'Navigace', + 'navigation_help' => 'Pomocí přepínače "Shift" fungují navigační zkratky v rámci kanálů.<br/>Pomocí přepínače "Alt" fungují v rámci kategorií.', + 'next_article' => 'Skočit na další článek', + 'other_action' => 'Ostatní akce', + 'previous_article' => 'Skočit na předchozí článek', + 'see_on_website' => 'Navštívit původní webovou stránku', + 'shift_for_all_read' => '+ <code>shift</code> označí vše jako přečtené', + 'title' => 'Zkratky', + 'user_filter' => 'Aplikovat uživatelské filtry', + 'user_filter_help' => 'Je-li nastaven pouze jeden filtr, bude použit. Další filtry jsou dostupné pomocí jejich čísla.', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'current' => 'Aktuální uživatel', + 'is_admin' => 'je administrátor', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php new file mode 100644 index 000000000..f7b8d8c73 --- /dev/null +++ b/app/i18n/cz/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimalizace dokončena', + ), + 'access' => array( + 'denied' => 'Nemáte oprávnění přistupovat na tuto stránku', + 'not_found' => 'Tato stránka neexistuje', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Nastal problém s konfigurací přihlašovacího systému. Zkuste to prosím později.', + 'set' => 'Webový formulář je nyní výchozí přihlašovací systém.', + ), + 'login' => array( + 'invalid' => 'Login není platný', + 'success' => 'Jste přihlášen', + ), + 'logout' => array( + 'success' => 'Jste odhlášen', + ), + 'no_password_set' => 'Heslo administrátora nebylo nastaveno. Tato funkce není k dispozici.', + ), + 'conf' => array( + 'error' => 'Během ukládání nastavení došlo k chybě', + 'query_created' => 'Dotaz "%s" byl vytvořen.', + 'shortcuts_updated' => 'Zkratky byly aktualizovány', + 'updated' => 'Nastavení bylo aktualizováno', + ), + 'extensions' => array( + 'already_enabled' => '%s je již zapnut', + 'disable' => array( + 'ko' => '%s nelze vypnout. Pro více detailů <a href="%s">zkontrolujte logy FressRSS</a>.', + 'ok' => '%s je nyní vypnut', + ), + 'enable' => array( + 'ko' => '%s nelze zapnout. Pro více detailů <a href="%s">zkontrolujte logy FressRSS</a>.', + 'ok' => '%s je nyní zapnut', + ), + 'no_access' => 'Nemáte přístup k %s', + 'not_enabled' => '%s není ještě zapnut', + 'not_found' => '%s neexistuje', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Na serveru není naistalována podpora ZIP. Zkuste prosím exportovat soubory jeden po druhém.', + 'feeds_imported' => 'Vaše kanály byly naimportovány a nyní budou aktualizovány', + 'feeds_imported_with_errors' => 'Vaše kanály byly naimportovány, došlo ale k nějakým chybám', + 'file_cannot_be_uploaded' => 'Soubor nelze nahrát!', + 'no_zip_extension' => 'Na serveru není naistalována podpora ZIP.', + 'zip_error' => 'Během importu ZIP souboru došlo k chybě.', + ), + 'sub' => array( + 'actualize' => 'Aktualizovat', + 'category' => array( + 'created' => 'Kategorie %s byla vytvořena.', + 'deleted' => 'Kategorie byla smazána.', + 'emptied' => 'Kategorie byla vyprázdněna', + 'error' => 'Kategorii nelze aktualizovat', + 'name_exists' => 'Název kategorie již existuje.', + 'no_id' => 'Musíte upřesnit id kategorie.', + 'no_name' => 'Název kategorie nemůže být prázdný.', + 'not_delete_default' => 'Nelze smazat výchozí kategorii!', + 'not_exist' => 'Tato kategorie neexistuje!', + 'over_max' => 'Dosáhl jste maximálního počtu kategorií (%d)', + 'updated' => 'Kategorie byla aktualizována.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> bylo aktualizováno', + 'actualizeds' => 'RSS kanály byly aktualizovány', + 'added' => 'RSS kanál <em>%s</em> byl přidán', + 'already_subscribed' => 'Již jste přihlášen k odběru <em>%s</em>', + 'deleted' => 'Kanál byl smazán', + 'error' => 'Kanál nelze aktualizovat', + 'internal_problem' => 'RSS kanál nelze přidat. Pro detaily <a href="%s">zkontrolujte logy FressRSS</a>.', + 'invalid_url' => 'URL <em>%s</em> není platné', + 'marked_read' => 'Kanály byly označeny jako přečtené', + 'n_actualized' => '%d kanálů bylo aktualizováno', + 'n_entries_deleted' => '%d článků bylo smazáno', + 'no_refresh' => 'Nelze obnovit žádné kanály…', + 'not_added' => '<em>%s</em> nemůže být přidán', + 'over_max' => 'Dosáhl jste maximálního počtu kanálů (%d)', + 'updated' => 'Kanál byl aktualizován', + ), + 'purge_completed' => 'Vyprázdněno (smazáno %d článků)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS bude nyní upgradováno na <strong>verzi %s</strong>.', + 'error' => 'Během upgrade došlo k chybě: %s', + 'file_is_nok' => '<strong>Verzi %s</strong>. Zkontrolujte oprávnění adresáře <em>%s</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'finished' => 'Upgrade hotov!', + 'none' => 'Novější verze není k dispozici', + 'server_not_found' => 'Nelze nalézt server s instalačním souborem. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Uživatel %s byl vytvořen', + 'error' => 'Uživatele %s nelze vytvořit', + ), + 'deleted' => array( + '_' => 'Uživatel %s byl smazán', + 'error' => 'Uživatele %s nelze smazat', + ), + ), + 'profile' => array( + 'error' => 'Váš profil nelze změnit', + 'updated' => 'Váš profil byl změněn', + ), +); diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php new file mode 100644 index 000000000..e43355f64 --- /dev/null +++ b/app/i18n/cz/gen.php @@ -0,0 +1,189 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Aktualizovat', + 'back_to_rss_feeds' => '← Zpět na seznam RSS kanálů', + 'cancel' => 'Zrušit', + 'create' => 'Vytvořit', + 'disable' => 'Zakázat', + 'empty' => 'Vyprázdnit', + 'enable' => 'Povolit', + 'export' => 'Export', + 'filter' => 'Filtrovat', + 'import' => 'Import', + 'manage' => 'Spravovat', + 'mark_favorite' => 'Označit jako oblíbené', + 'mark_read' => 'Označit jako přečtené', + 'remove' => 'Odstranit', + 'see_website' => 'Navštívit WWW stránku', + 'submit' => 'Odeslat', + 'truncate' => 'Smazat všechny články', + ), + 'auth' => array( + 'email' => 'Email', + 'keep_logged_in' => 'Zapamatovat přihlášení <small>(%s dny)</small>', + 'login' => 'Login', + 'logout' => 'Odhlášení', + 'password' => array( + '_' => 'Heslo', + 'format' => '<small>Alespoň 7 znaků</small>', + ), + 'registration' => array( + '_' => 'Nový účet', + 'ask' => 'Vytvořit účet?', + 'title' => 'Vytvoření účtu', + ), + 'reset' => 'Reset přihlášení', + 'username' => array( + '_' => 'Uživatel', + 'admin' => 'Název administrátorského účtu', + 'format' => '<small>maximálně 16 alfanumerických znaků</small>', + ), + ), + 'date' => array( + 'Apr' => '\\D\\u\\b\\e\\n', + 'Aug' => '\\S\\r\\p\\e\\n', + 'Dec' => '\\P\\r\\o\\s\\i\\n\\e\\c', + 'Feb' => '\\Ú\\n\\o\\r', + 'Jan' => '\\L\\e\\d\\e\\n', + 'Jul' => '\\Č\\e\\r\\v\\e\\n\\e\\c', + 'Jun' => '\\Č\\e\\r\\v\\e\\n', + 'Mar' => '\\B\\ř\\e\\z\\e\\n', + 'May' => '\\K\\v\\ě\\t\\e\\n', + 'Nov' => '\\L\\i\\s\\t\\o\\p\\a\\d', + 'Oct' => '\\Ř\\í\\j\\e\\n', + 'Sep' => '\\Z\\á\\ř\\í', + 'apr' => 'dub', + 'april' => 'Dub', + 'aug' => 'srp', + 'august' => 'Srp', + 'before_yesterday' => 'Předevčírem', + 'dec' => 'pro', + 'december' => 'Pro', + 'feb' => 'úno', + 'february' => 'Úno', + 'format_date' => 'j\\. %s Y', + 'format_date_hour' => 'j\\. %s Y \\v H\\:i', + 'fri' => 'Pá', + 'jan' => 'led', + 'january' => 'Led', + 'jul' => 'čvn', + 'july' => 'Čvn', + 'jun' => 'čer', + 'june' => 'Čer', + 'last_3_month' => 'Minulé tři měsíce', + 'last_6_month' => 'Minulých šest měsíců', + 'last_month' => 'Minulý měsíc', + 'last_week' => 'Minulý týden', + 'last_year' => 'Minulý rok', + 'mar' => 'bře', + 'march' => 'Bře', + 'may' => 'Květen', + 'may_' => 'Kvě', + 'mon' => 'Po', + 'month' => 'měsíce', + 'nov' => 'lis', + 'november' => 'Lis', + 'oct' => 'říj', + 'october' => 'Říj', + 'sat' => 'So', + 'sep' => 'zář', + 'september' => 'Zář', + 'sun' => 'Ne', + 'thu' => 'Čt', + 'today' => 'Dnes', + 'tue' => 'Út', + 'wed' => 'St', + 'yesterday' => 'Včera', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'O FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Prázdná kategorie', + 'confirm_action' => 'Jste si jist, že chcete provést tuto akci? Změny nelze vrátit zpět!', + 'confirm_action_feed_cat' => 'Jste si jist, že chcete provést tuto akci? Přijdete o související oblíbené položky a uživatelské dotazy. Změny nelze vrátit zpět!', + 'feedback' => array( + 'body_new_articles' => 'Je %%d nových článků k přečtení v FreshRSS.', + 'request_failed' => 'Požadavek selhal, což může být způsobeno problémy s připojení k internetu.', + 'title_new_articles' => 'FreshRSS: nové články!', + ), + 'new_article' => 'Jsou k dispozici nové články, stránku obnovíte kliknutím zde.', + 'should_be_activated' => 'JavaScript musí být povolen', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'O aplikaci', + 'admin' => 'Administrace', + 'archiving' => 'Archivace', + 'authentication' => 'Přihlášení', + 'check_install' => 'Ověření instalace', + 'configuration' => 'Nastavení', + 'display' => 'Zobrazení', + 'extensions' => 'Rozšíření', + 'logs' => 'Logy', + 'queries' => 'Uživatelské dotazy', + 'reading' => 'Čtení', + 'search' => 'Hledat výraz nebo #tagy', + 'sharing' => 'Sdílení', + 'shortcuts' => 'Zkratky', + 'stats' => 'Statistika', + 'system' => 'System configuration', // @todo translate + 'update' => 'Aktualizace', + 'user_management' => 'Správa uživatelů', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'První', + 'last' => 'Poslední', + 'load_more' => 'Načíst více článků', + 'mark_all_read' => 'Označit vše jako přečtené', + 'next' => 'Další', + 'nothing_to_load' => 'Žádné nové články', + 'previous' => 'Předchozí', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Upozornění!', + 'blank_to_disable' => 'Zakázat - ponechte prázdné', + 'by_author' => 'Od <em>%s</em>', + 'by_default' => 'Výchozí', + 'damn' => 'Sakra!', + 'default_category' => 'Nezařazeno', + 'no' => 'Ne', + 'ok' => 'Ok!', + 'or' => 'nebo', + 'yes' => 'Ano', + ), +); diff --git a/app/i18n/cz/index.php b/app/i18n/cz/index.php new file mode 100644 index 000000000..cb0e5955d --- /dev/null +++ b/app/i18n/cz/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'O FreshRSS', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Hlášení chyb', + 'credits' => 'Poděkování', + 'credits_content' => 'Některé designové prvky pocházejí z <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>, FreshRSS ale tuto platformu nevyužívá. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Ikony</a> pocházejí z <a href="https://www.gnome.org/">GNOME projektu</a>. Font <em>Open Sans</em> vytvořil <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS je založen na PHP framework <a href="https://github.com/marienfressinaud/MINZ">Minz</a>.', + 'freshrss_description' => 'FreshRSS je čtečka RSS kanálů určená k provozu na vlastním serveru, podobná <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> nebo <a href="http://projet.idleman.fr/leed/">Leed</a>. Je to nenáročný a jednoduchý, zároveň ale mocný a konfigurovatelný nástroj.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">na Github</a>', + 'license' => 'Licence', + 'project_website' => 'Stránka projektu', + 'title' => 'O FreshRSS', + 'version' => 'Verze', + 'website' => 'Webové stránka', + ), + 'feed' => array( + 'add' => 'Můžete přidat kanály.', + 'empty' => 'Žádné články k zobrazení.', + 'rss_of' => 'RSS kanál %s', + 'title' => 'RSS kanály', + 'title_global' => 'Přehled', + 'title_fav' => 'Oblíbené', + ), + 'log' => array( + '_' => 'Logy', + 'clear' => 'Vymazat logy', + 'empty' => 'Log je prázdný', + 'title' => 'Logy', + ), + 'menu' => array( + 'about' => 'O FreshRSS', + 'add_query' => 'Vytvořit dotaz', + 'before_one_day' => 'Den nazpět', + 'before_one_week' => 'Před týdnem', + 'favorites' => 'Oblíbené (%s)', + 'global_view' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'mark_all_read' => 'Označit vše jako přečtené', + 'mark_cat_read' => 'Označit kategorii jako přečtenou', + 'mark_feed_read' => 'Označit kanál jako přečtený', + 'newer_first' => 'Nové nejdříve', + 'non-starred' => 'Zobrazit vše vyjma oblíbených', + 'normal_view' => 'Normální', + 'older_first' => 'Nejstarší nejdříve', + 'queries' => 'Uživatelské dotazy', + 'read' => 'Zobrazovat přečtené', + 'reader_view' => 'Čtení', + 'rss_view' => 'RSS kanál', + 'search_short' => 'Hledat', + 'starred' => 'Zobrazit oblíbené', + 'stats' => 'Statistika', + 'subscription' => 'Správa subskripcí', + 'unread' => 'Zobrazovat nepřečtené', + ), + 'share' => 'Sdílet', + 'tag' => array( + 'related' => 'Související tagy', + ), +); diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php new file mode 100644 index 000000000..ea4812ea5 --- /dev/null +++ b/app/i18n/cz/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Dokončit instalaci', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'keep_install' => 'Zachovat předchozí instalaci', + 'next_step' => 'Přejít na další krok', + 'reinstall' => 'Reinstalovat FreshRSS', + ), + 'auth' => array( + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'type' => 'Způsob přihlášení', + ), + 'bdd' => array( + '_' => 'Databáze', + 'conf' => array( + '_' => 'Nastavení databáze', + 'ko' => 'Ověřte informace o databázi.', + 'ok' => 'Nastavení databáze bylo uloženo.', + ), + 'host' => 'Hostitel', + 'prefix' => 'Prefix tabulky', + 'password' => 'Heslo', + 'type' => 'Typ databáze', + 'username' => 'Uživatel', + ), + 'check' => array( + '_' => 'Kontrola', + 'already_installed' => 'Zjistili jsme, že FreshRSS je již nainstalován!', + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/cache</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Není nainstalována požadovaná knihovna pro ověřování znaků (php-ctype).', + 'ok' => 'Je nainstalována požadovaná knihovna pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM.', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/favicons</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'fileinfo' => array( + 'nok' => 'Nemáte PHP fileinfo (balíček fileinfo).', + 'ok' => 'Máte rozšíření fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Zkontrolujte prosím že neměníte HTTP REFERER.', + 'ok' => 'Váš HTTP REFERER je znám a odpovídá Vašemu serveru.', + ), + 'json' => array( + 'nok' => 'Pro parsování JSON chybí doporučená knihovna.', + 'ok' => 'Máte doporučenou knihovnu pro parsování JSON.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/users</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + 'xml' => array( + 'nok' => 'Pro parsování XML chybí požadovaná knihovna.', + 'ok' => 'Máte požadovanou knihovnu pro parsování XML.', + ), + ), + 'conf' => array( + '_' => 'Obecná nastavení', + 'ok' => 'Nastavení bylo uloženo.', + ), + 'congratulations' => 'Gratulujeme!', + 'default_user' => 'Jméno výchozího uživatele <small>(maximálně 16 alfanumerických znaků)</small>', + 'delete_articles_after' => 'Smazat články starší než', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'javascript_is_better' => 'Práce s FreshRSS je příjemnější se zapnutým JavaScriptem', + 'js' => array( + 'confirm_reinstall' => 'Reinstalací FreshRSS ztratíte předchozí konfiguraci. Opravdu chcete pokračovat?', + ), + 'language' => array( + '_' => 'Jazyk', + 'choose' => 'Vyberte jazyk FreshRSS', + 'defined' => 'Jazyk byl nastaven.', + ), + 'not_deleted' => 'Nastala chyba, soubor <em>%s</em> musíte smazat ručně.', + 'ok' => 'Instalace byla úspěšná.', + 'step' => 'krok %d', + 'steps' => 'Kroky', + 'title' => 'Instalace · FreshRSS', + 'this_is_the_end' => 'Konec', +); diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php new file mode 100644 index 000000000..807c249d3 --- /dev/null +++ b/app/i18n/cz/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), + 'category' => array( + '_' => 'Kategorie', + 'add' => 'Přidat kategorii', + 'empty' => 'Vyprázdit kategorii', + 'new' => 'Nová kategorie', + ), + 'feed' => array( + 'add' => 'Přidat RSS kanál', + 'advanced' => 'Pokročilé', + 'archiving' => 'Archivace', + 'auth' => array( + 'configuration' => 'Přihlášení', + 'help' => 'Umožní přístup k RSS kanálům chráneným HTTP autentizací', + 'http' => 'HTTP přihlášení', + 'password' => 'Heslo', + 'username' => 'Přihlašovací jméno', + ), + 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', + 'css_path' => 'Původní CSS soubor článku z webových stránek', + 'description' => 'Popis', + 'empty' => 'Kanál je prázdný. Ověřte prosím zda je ještě autorem udržován.', + 'error' => 'Vyskytl se problém s kanálem. Ověřte že je vždy dostupný, prosím, a poté jej aktualizujte.', + 'in_main_stream' => 'Zobrazit ve “Všechny kanály”', + 'informations' => 'Informace', + 'keep_history' => 'Zachovat tento minimální počet článků', + 'moved_category_deleted' => 'Po smazání kategorie budou v ní obsažené kanály automaticky přesunuty do <em>%s</em>.', + 'no_selected' => 'Nejsou označeny žádné kanály.', + 'number_entries' => '%d článků', + 'stats' => 'Statistika', + 'think_to_add' => 'Můžete přidat kanály.', + 'title' => 'Název', + 'title_add' => 'Přidat RSS kanál', + 'ttl' => 'Neobnovovat častěji než', + 'url' => 'URL kanálu', + 'validator' => 'Zkontrolovat platnost kanálu', + 'website' => 'URL webové stránky', + 'pubsubhubbub' => 'Okamžité oznámení s PubSubHubbub', + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.',// TODO + 'title' => 'Firefox feed reader',// TODO + ), + 'import_export' => array( + 'export' => 'Export', + 'export_opml' => 'Exportovat seznam kanálů (OPML)', + 'export_starred' => 'Exportovat oblíbené', + 'feed_list' => 'Seznam %s článků', + 'file_to_import' => 'Soubor k importu<br />(OPML, JSON nebo ZIP)', + 'file_to_import_no_zip' => 'Soubor k importu<br />(OPML nebo JSON)', + 'import' => 'Import', + 'starred_list' => 'Seznam oblíbených článků', + 'title' => 'Import / export', + ), + 'menu' => array( + 'bookmark' => 'Přihlásit (FreshRSS bookmark)', + 'import_export' => 'Import / export', + 'subscription_management' => 'Správa subskripcí', + 'subscription_tools' => 'Subscription tools',// TODO + ), + 'title' => array( + '_' => 'Správa subskripcí', + 'feed_management' => 'Správa RSS kanálů', + 'subscription_tools' => 'Subscription tools',// TODO + ), +); diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index bcd0fcc61..bb2c9352d 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -8,7 +8,6 @@ return array( 'form' => 'Webformular (traditionell, benötigt JavaScript)', 'http' => 'HTTP (HTTPS für erfahrene Benutzer)', 'none' => 'Keine (gefährlich)', - 'persona' => 'Mozilla Persona (modern, benötigt JavaScript)', 'title' => 'Authentifizierung', 'title_reset' => 'Zurücksetzen der Authentifizierung', 'token' => 'Authentifizierungs-Token', @@ -19,27 +18,27 @@ return array( 'check_install' => array( 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/cache</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', ), 'categories' => array( 'nok' => 'Die Tabelle <em>category</em> ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle <em>category</em> ist in Ordnung.', + 'ok' => 'Die Tabelle <em>category</em> ist korrekt konfiguriert.', ), 'connection' => array( 'nok' => 'Verbindung zur Datenbank kann nicht aufgebaut werden.', - 'ok' => 'Verbindung zur Datenbank ist in Ordnung.', + 'ok' => 'Verbindung zur Datenbank konnte aufgebaut werden.', ), 'ctype' => array( 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', 'ok' => 'Sie haben die benötigte Bibliothek für die Überprüfung von Zeichentypen (ctype).', ), 'curl' => array( - 'nok' => 'Ihnen fehlt cURL (Paket php5-curl).', + 'nok' => 'Ihnen fehlt cURL (Paket php-curl).', 'ok' => 'Sie haben die cURL-Erweiterung.', ), 'data' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', ), 'database' => 'Datenbank-Installation', 'dom' => array( @@ -48,19 +47,23 @@ return array( ), 'entries' => array( 'nok' => 'Die Tabelle <em>entry</em> ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle <em>entry</em> ist in Ordnung.', + 'ok' => 'Die Tabelle <em>entry</em> ist korrekt konfiguriert.', ), 'favicons' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/favicons</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', ), 'feeds' => array( 'nok' => 'Die Tabelle <em>feed</em> ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle <em>feed</em> ist in Ordnung.', + 'ok' => 'Die Tabelle <em>feed</em> ist korrekt konfiguriert.', + ), + 'fileinfo' => array( + 'nok' => 'Ihnen fehlt PHP fileinfo (Paket fileinfo).', + 'ok' => 'Sie haben die fileinfo-Erweiterung.', ), 'files' => 'Datei-Installation', 'json' => array( - 'nok' => 'Ihnen fehlt JSON (Paket php5-json).', + 'nok' => 'Ihnen fehlt die JSON-Erweiterung (Paket php5-json).', 'ok' => 'Sie haben die JSON-Erweiterung.', ), 'minz' => array( @@ -72,12 +75,8 @@ return array( 'ok' => 'Sie haben die benötigte Bibliothek für reguläre Ausdrücke (PCRE).', ), 'pdo' => array( - 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite).', - 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/persona</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/persona</em> sind in Ordnung.', + 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( '_' => 'PHP-Installation', @@ -91,14 +90,14 @@ return array( 'title' => 'Installationsüberprüfung', 'tokens' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/tokens</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/tokens</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/tokens</em> sind in Ordnung.', ), 'users' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/users</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', ), 'zip' => array( - 'nok' => 'Ihnen fehlt die ZIP-Erweiterung (Paket php5-zip).', + 'nok' => 'Ihnen fehlt die ZIP-Erweiterung (Paket php-zip).', 'ok' => 'Sie haben die ZIP-Erweiterung.', ), ), @@ -113,6 +112,13 @@ return array( ), 'title' => 'Erweiterungen', 'user' => 'Benutzer-Erweiterungen', + 'community' => 'Verfügbare Community Erweiterungen', + 'name' => 'Name', + 'version' => 'Version', + 'description' => 'Beschreibungen', + 'author' => 'Autor', + 'latest' => 'Installiert', + 'update' => 'Update verfügbar', ), 'stats' => array( '_' => 'Statistiken', @@ -120,22 +126,22 @@ return array( 'category' => 'Kategorie', 'entry_count' => 'Anzahl der Einträge', 'entry_per_category' => 'Einträge pro Kategorie', - 'entry_per_day' => 'Einträge pro Tag (letzte 30 Tage)', + 'entry_per_day' => 'Einträge pro Tag (letzten 30 Tage)', 'entry_per_day_of_week' => 'Pro Wochentag (Durchschnitt: %.2f Nachrichten)', 'entry_per_hour' => 'Pro Stunde (Durchschnitt: %.2f Nachrichten)', 'entry_per_month' => 'Pro Monat (Durchschnitt: %.2f Nachrichten)', 'entry_repartition' => 'Einträge-Verteilung', 'feed' => 'Feed', 'feed_per_category' => 'Feeds pro Kategorie', - 'idle' => 'Untätige Feeds', + 'idle' => 'Inaktive Feeds', 'main' => 'Haupt-Statistiken', 'main_stream' => 'Haupt-Feeds', 'menu' => array( - 'idle' => 'Untätige Feeds', + 'idle' => 'Inaktive Feeds', 'main' => 'Haupt-Statistiken', 'repartition' => 'Artikel-Verteilung', ), - 'no_idle' => 'Es gibt keinen untätigen Feed!', + 'no_idle' => 'Es gibt keinen inaktiven Feed!', 'number_entries' => '%d Artikel', 'percent_of_total' => '%% Gesamt', 'repartition' => 'Artikel-Verteilung', @@ -146,20 +152,32 @@ return array( 'title' => 'Statistiken', 'top_feed' => 'Top 10-Feeds', ), + 'system' => array( + '_' => 'Systemeinstellungen', + 'auto-update-url' => 'Auto-update URL', + 'instance-name' => 'Dein Reader Name', + 'max-categories' => 'Anzahl erlaubter Kategorien pro Benutzer', + 'max-feeds' => 'Anzahl erlaubter Feeds pro Benutzer', + 'registration' => array( + 'help' => '0 meint, dass es kein Account Limit gibt', + 'number' => 'Maximale Anzahl von Accounts', + ), + ), 'update' => array( '_' => 'System aktualisieren', 'apply' => 'Anwenden', 'check' => 'Auf neue Aktualisierungen prüfen', 'current_version' => 'Ihre aktuelle Version von FreshRSS ist %s.', 'last' => 'Letzte Überprüfung: %s', - 'none' => 'Keine Aktualisierung zum Anwenden', + 'none' => 'Keine ausstehende Aktualisierung', 'title' => 'System aktualisieren', ), 'user' => array( 'articles_and_size' => '%s Artikel (%s)', 'create' => 'Neuen Benutzer erstellen', - 'email_persona' => 'Anmelde-E-Mail-Adresse<br /><small>(für <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'language' => 'Sprache', + 'number' => 'Es wurde bis jetzt %d Account erstellt', + 'numbers' => 'Es wurden bis jetzt %d Accounts erstellt', 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', 'password_format' => 'mindestens 7 Zeichen', 'title' => 'Benutzer verwalten', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 64c2c0945..ac7c08e98 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -5,8 +5,8 @@ return array( '_' => 'Archivierung', 'advanced' => 'Erweitert', 'delete_after' => 'Entferne Artikel nach', - 'help' => 'Weitere Optionen sind in den Einstellungen der individuellen Nachrichten-Feeds vorhanden.', - 'keep_history_by_feed' => 'Minimale Anzahl an Artikeln, die pro Feed behalten wird', + 'help' => 'Weitere Optionen sind in den Einstellungen der individuellen Feeds verfügbar.', + 'keep_history_by_feed' => 'Minimale Anzahl an Artikeln, die pro Feed behalten werden', 'optimize' => 'Datenbank optimieren', 'optimize_help' => 'Sollte gelegentlich durchgeführt werden, um die Größe der Datenbank zu reduzieren.', 'purge_now' => 'Jetzt bereinigen', @@ -32,10 +32,10 @@ return array( 'title' => 'Anzeige', 'width' => array( 'content' => 'Inhaltsbreite', - 'large' => 'Weit', + 'large' => 'Gross', 'medium' => 'Mittel', 'no_limit' => 'Keine Begrenzung', - 'thin' => 'Schmal', + 'thin' => 'Klein', ), ), 'query' => array( @@ -72,7 +72,10 @@ return array( ), 'profile' => array( '_' => 'Profil-Verwaltung', - 'email_persona' => 'Anmelde-E-Mail-Adresse<br /><small>(für <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', + 'delete' => array( + '_' => 'Accountlöschung', + 'warn' => 'Dein Account und alle damit bezogenen Daten werden gelöscht.', + ), 'password_api' => 'Passwort-API<br /><small>(z. B. für mobile Anwendungen)</small>', 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', 'password_format' => 'mindestens 7 Zeichen', @@ -84,11 +87,13 @@ return array( 'articles_per_page' => 'Anzahl der Artikel pro Seite', 'auto_load_more' => 'Die nächsten Artikel am Seitenende laden', 'auto_remove_article' => 'Artikel nach dem Lesen verstecken', + 'mark_updated_article_unread' => 'Markieren Sie aktualisierte Artikel als ungelesen', 'confirm_enabled' => 'Bei der Aktion „Alle als gelesen markieren“ einen Bestätigungsdialog anzeigen', 'display_articles_unfolded' => 'Artikel standardmäßig ausgeklappt zeigen', 'display_categories_unfolded' => 'Kategorien standardmäßig eingeklappt zeigen', 'hide_read_feeds' => 'Kategorien & Feeds ohne ungelesene Artikel verstecken (funktioniert nicht mit der Einstellung „Alle Artikel zeigen“)', 'img_with_lazyload' => 'Verwende die "träges Laden"-Methode zum Laden von Bildern', + 'sides_close_article' => 'Clicking outside of article text area closes the article', //TODO 'jump_next' => 'springe zum nächsten ungelesenen Geschwisterelement (Feed oder Kategorie)', 'number_divided_when_reader' => 'Geteilt durch 2 in der Lese-Ansicht.', 'read' => array( @@ -99,7 +104,7 @@ return array( 'when' => 'Artikel als gelesen markieren…', ), 'show' => array( - '_' => 'Artikel zum Anzeigen', + '_' => 'Artikel zum Anzeigen', 'adaptive' => 'Anzeige anpassen', 'all_articles' => 'Alle Artikel zeigen', 'unread' => 'Nur ungelesene zeigen', @@ -135,14 +140,14 @@ return array( 'wallabag' => 'wallabag', ), 'shortcut' => array( - '_' => 'Tastaturkürzel', + '_' => 'Tastenkombination', 'article_action' => 'Artikelaktionen', 'auto_share' => 'Teilen', 'auto_share_help' => 'Wenn es nur eine Option zum Teilen gibt, wird diese verwendet. Ansonsten sind die Optionen über ihre Nummer erreichbar.', 'close_dropdown' => 'Menüs schließen', - 'collapse_article' => 'Zusammenfalten', + 'collapse_article' => 'Einklappen', 'first_article' => 'Zum ersten Artikel springen', - 'focus_search' => 'Auf Suchfeld zugreifen', + 'focus_search' => 'Auf das Suchfeld zugreifen', 'help' => 'Dokumentation anzeigen', 'javascript' => 'JavaScript muss aktiviert sein, um Tastaturkürzel benutzen zu können', 'last_article' => 'Zum letzten Artikel springen', @@ -150,13 +155,13 @@ return array( 'mark_read' => 'Als gelesen markieren', 'mark_favorite' => 'Als Favorit markieren', 'navigation' => 'Navigation', - 'navigation_help' => 'Mit der "Umschalttaste" finden die Tastaturkürzel auf Feeds Anwendung.<br/>Mit der "Alt-Taste" finden die Tastaturkürzel auf Kategorien Anwendung.', + 'navigation_help' => 'Mit der "Umschalttaste" finden die Tastenkombination auf Feeds Anwendung.<br/>Mit der "Alt-Taste" finden die Tastenkombination auf Kategorien Anwendung.', 'next_article' => 'Zum nächsten Artikel springen', 'other_action' => 'Andere Aktionen', 'previous_article' => 'Zum vorherigen Artikel springen', 'see_on_website' => 'Auf der Original-Webseite ansehen', 'shift_for_all_read' => '+ <code>Umschalttaste</code>, um alle Artikel als gelesen zu markieren.', - 'title' => 'Tastaturkürzel', + 'title' => 'Tastenkombination', 'user_filter' => 'Auf Benutzerfilter zugreifen', 'user_filter_help' => 'Wenn es nur einen Benutzerfilter gibt, wird dieser verwendet. Ansonsten sind die Filter über ihre Nummer erreichbar.', ), diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index 48f8b74f5..e2e9a71ba 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -15,19 +15,18 @@ return array( ), 'login' => array( 'invalid' => 'Anmeldung ist ungültig', - 'success' => 'Sie sind verbunden', + 'success' => 'Sie sind angemeldet', ), 'logout' => array( - 'success' => 'Sie sind getrennt', + 'success' => 'Sie sind abgemeldet', ), 'no_password_set' => 'Administrator-Passwort ist nicht gesetzt worden. Dieses Feature ist nicht verfügbar.', - 'not_persona' => 'Nur das Persona-System kann zurückgesetzt werden.', ), 'conf' => array( - 'error' => 'Während des Speicherung der Konfiguration trat ein Fehler auf', + 'error' => 'Während der Speicherung der Konfiguration trat ein Fehler auf', 'query_created' => 'Abfrage "%s" ist erstellt worden.', - 'shortcuts_updated' => 'Tastaturkürzel sind aktualisiert worden', - 'updated' => 'Konfiguration ist aktualisiert worden', + 'shortcuts_updated' => 'Die Tastenkombinationen sind aktualisiert worden', + 'updated' => 'Die Konfiguration ist aktualisiert worden', ), 'extensions' => array( 'already_enabled' => '%s ist bereits aktiviert', @@ -44,63 +43,63 @@ return array( 'not_found' => '%s existiert nicht', ), 'import_export' => array( - 'export_no_zip_extension' => 'Die Zip-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie, Dateien eine nach der anderen zu exportieren.', + 'export_no_zip_extension' => 'Die ZIP-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie die Dateien eine nach der anderen zu exportieren.', 'feeds_imported' => 'Ihre Feeds sind importiert worden und werden jetzt aktualisiert', 'feeds_imported_with_errors' => 'Ihre Feeds sind importiert worden, aber es traten einige Fehler auf', - 'file_cannot_be_uploaded' => 'Datei kann nicht hochgeladen werden!', - 'no_zip_extension' => 'Die Zip-Erweiterung ist auf Ihrem Server nicht vorhanden.', - 'zip_error' => 'Ein Fehler trat während des Zip-Imports auf.', + 'file_cannot_be_uploaded' => 'Die Datei kann nicht hochgeladen werden!', + 'no_zip_extension' => 'Die ZIP-Erweiterung ist auf Ihrem Server nicht vorhanden.', + 'zip_error' => 'Ein Fehler trat während des ZIP-Imports auf.', ), 'sub' => array( 'actualize' => 'Aktualisieren', 'category' => array( - 'created' => 'Kategorie %s ist erstellt worden.', - 'deleted' => 'Kategorie ist gelöscht worden.', - 'emptied' => 'Kategorie ist geleert worden.', - 'error' => 'Kategorie kann nicht aktualisiert werden', - 'name_exists' => 'Kategorie-Name existiert bereits.', + 'created' => 'Die Kategorie %s ist erstellt worden.', + 'deleted' => 'Die Kategorie ist gelöscht worden.', + 'emptied' => 'Die Kategorie ist geleert worden.', + 'error' => 'Die Kategorie kann nicht aktualisiert werden', + 'name_exists' => 'Der Kategorie-Name existiert bereits.', 'no_id' => 'Sie müssen die ID der Kategorie präzisieren.', - 'no_name' => 'Kategorie-Name kann nicht leer sein.', + 'no_name' => 'Der Kategorie-Name kann nicht leer sein.', 'not_delete_default' => 'Sie können die Vorgabe-Kategorie nicht löschen!', 'not_exist' => 'Die Kategorie existiert nicht!', - 'over_max' => 'Sie haben Ihr Kategorien-Limit erreicht (%d)', - 'updated' => 'Kategorie ist aktualisiert worden.', + 'over_max' => 'Sie haben Ihre Kategorien-Limite erreicht (%d)', + 'updated' => 'Die Kategorie ist aktualisiert worden.', ), 'feed' => array( 'actualized' => '<em>%s</em> ist aktualisiert worden', - 'actualizeds' => 'RSS-Feeds sind aktualisiert worden', - 'added' => 'RSS-Feed <em>%s</em> ist hinzugefügt worden', + 'actualizeds' => 'Die RSS-Feeds sind aktualisiert worden', + 'added' => 'Der RSS-Feed <em>%s</em> ist hinzugefügt worden', 'already_subscribed' => 'Sie haben <em>%s</em> bereits abonniert', - 'deleted' => 'Feed ist gelöscht worden', - 'error' => 'Feed kann nicht aktualisiert werden', + 'deleted' => 'Der Feed ist gelöscht worden', + 'error' => 'Der Feed kann nicht aktualisiert werden', 'internal_problem' => 'Der RSS-Feed konnte nicht hinzugefügt werden. Für Details <a href="%s">prüfen Sie die FressRSS-Protokolle</a>.', - 'invalid_url' => 'URL <em>%s</em> ist ungültig', - 'marked_read' => 'Feeds sind als gelesen markiert worden', - 'n_actualized' => '%d Feeds sind aktualisiert worden', - 'n_entries_deleted' => '%d Artikel sind gelöscht worden', + 'invalid_url' => 'Die URL <em>%s</em> ist ungültig', + 'marked_read' => 'Die Feeds sind als gelesen markiert worden', + 'n_actualized' => 'Die %d Feeds sind aktualisiert worden', + 'n_entries_deleted' => 'Die %d Artikel sind gelöscht worden', 'no_refresh' => 'Es gibt keinen Feed zum Aktualisieren…', 'not_added' => '<em>%s</em> konnte nicht hinzugefügt werden', - 'over_max' => 'Sie haben Ihr Feeds-Limit erreicht (%d)', - 'updated' => 'Feed ist aktualisiert worden', + 'over_max' => 'Sie haben Ihre Feeds-Limite erreicht (%d)', + 'updated' => 'Der Feed ist aktualisiert worden', ), 'purge_completed' => 'Bereinigung abgeschlossen (%d Artikel gelöscht)', ), 'update' => array( 'can_apply' => 'FreshRSS wird nun auf die <strong>Version %s</strong> aktualisiert.', 'error' => 'Der Aktualisierungsvorgang stieß auf einen Fehler: %s', - 'file_is_nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>%s</em>. Der HTTP-Server muss Schreibrechte besitzen', + 'file_is_nok' => '<strong>Version %s</strong>. Überprüfen Sie die Berechtigungen des Verzeichnisses <em>%s</em>. Der HTTP-Server muss Schreibrechte besitzen', 'finished' => 'Aktualisierung abgeschlossen!', 'none' => 'Keine Aktualisierung zum Anwenden', - 'server_not_found' => 'Aktualisierungs-Server kann nicht gefunden werden. [%s]', + 'server_not_found' => 'Der Aktualisierungs-Server kann nicht gefunden werden. [%s]', ), 'user' => array( 'created' => array( - '_' => 'Benutzer %s ist erstellt worden', - 'error' => 'Benutzer %s kann nicht erstellt werden', + '_' => 'Der Benutzer %s ist erstellt worden', + 'error' => 'Der Benutzer %s kann nicht erstellt werden', ), 'deleted' => array( - '_' => 'Benutzer %s ist gelöscht worden', - 'error' => 'Benutzer %s kann nicht gelöscht werden', + '_' => 'Der Benutzer %s ist gelöscht worden', + 'error' => 'Der Benutzer %s kann nicht gelöscht werden', ), ), 'profile' => array( diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index bdc10d77a..bed49a4a4 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -13,24 +13,33 @@ return array( 'filter' => 'Filtern', 'import' => 'Importieren', 'manage' => 'Verwalten', - 'mark_read' => 'Als gelesen markieren', 'mark_favorite' => 'Als Favorit markieren', + 'mark_read' => 'Als gelesen markieren', 'remove' => 'Entfernen', 'see_website' => 'Webseite ansehen', 'submit' => 'Abschicken', 'truncate' => 'Alle Artikel löschen', ), 'auth' => array( - 'keep_logged_in' => 'Eingeloggt bleiben <small>(1 Monat)</small>', + 'email' => 'E-Mail-Adresse', + 'keep_logged_in' => 'Eingeloggt bleiben <small>(%s Tage)</small>', 'login' => 'Anmelden', - 'login_persona' => 'Anmelden mit Persona', - 'login_persona_problem' => 'Verbindungsproblem mit Persona?', 'logout' => 'Abmelden', - 'password' => 'Passwort', + 'password' => array( + '_' => 'Passwort', + 'format' => '<small>mindestens 7 Zeichen</small>', + ), + 'registration' => array( + '_' => 'Neuer Account', + 'ask' => 'Erstelle einen Account?', + 'title' => 'Accounterstellung', + ), 'reset' => 'Zurücksetzen der Authentifizierung', - 'username' => 'Nutzername', - 'username_admin' => 'Administrator-Nutzername', - 'will_reset' => 'Authentifikationssystem wird zurückgesetzt: ein Formular wird anstelle von Persona benutzt.', + 'username' => array( + '_' => 'Nutzername', + 'admin' => 'Administrator-Nutzername', + 'format' => '<small>maximal 16 alphanumerische Zeichen</small>', + ), ), 'date' => array( 'Apr' => '\\A\\p\\r\\i\\l', @@ -49,7 +58,7 @@ return array( 'april' => 'April', 'aug' => 'Aug', 'august' => 'August', - 'before_yesterday' => 'Vor gestern', + 'before_yesterday' => 'Vor vorgestern', 'dec' => 'Dez', 'december' => 'Dezember', 'feb' => 'Feb', @@ -71,6 +80,7 @@ return array( 'mar' => 'Mär', 'march' => 'März', 'may' => 'Mai', + 'may_' => 'Mai', 'mon' => 'Mo', 'month' => 'Monat(en)', 'nov' => 'Nov', @@ -93,10 +103,10 @@ return array( ), 'js' => array( 'category_empty' => 'Kategorie leeren', - 'confirm_action' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Dies kann nicht abgebrochen werden!', + 'confirm_action' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Diese Aktion kann nicht abgebrochen werden!', 'confirm_action_feed_cat' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Sie werden zugehörige Favoriten und Benutzerabfragen verlieren. Dies kann nicht abgebrochen werden!', 'feedback' => array( - 'body_new_articles' => 'Es gibt \\d neue Artikel zum Lesen auf FreshRSS.', + 'body_new_articles' => 'Es gibt %%d neue Artikel zum Lesen auf FreshRSS.', 'request_failed' => 'Eine Anfrage ist fehlgeschlagen, dies könnte durch Probleme mit der Internetverbindung verursacht worden sein.', 'title_new_articles' => 'FreshRSS: neue Artikel!', ), @@ -104,10 +114,19 @@ return array( 'should_be_activated' => 'JavaScript muss aktiviert sein', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', + 'es' => 'Español', 'fr' => 'Français', 'he' => 'עברית', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', ), 'menu' => array( 'about' => 'Über', @@ -125,6 +144,7 @@ return array( 'sharing' => 'Teilen', 'shortcuts' => 'Tastaturkürzel', 'stats' => 'Statistiken', + 'system' => 'Systemeinstellungen', 'update' => 'Aktualisieren', 'user_management' => 'Benutzer verwalten', 'user_profile' => 'Profil', @@ -144,10 +164,15 @@ return array( 'email' => 'E-Mail', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', 'print' => 'Drucken', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', - 'wallabag' => 'wallabag', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', ), 'short' => array( 'attention' => 'Achtung!', @@ -157,6 +182,7 @@ return array( 'damn' => 'Verdammt!', 'default_category' => 'Unkategorisiert', 'no' => 'Nein', + 'not_applicable' => 'Nicht verfügbar', 'ok' => 'OK!', 'or' => 'oder', 'yes' => 'Ja', diff --git a/app/i18n/de/index.php b/app/i18n/de/index.php index 3449de87d..df92d8085 100644 --- a/app/i18n/de/index.php +++ b/app/i18n/de/index.php @@ -6,7 +6,7 @@ return array( 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', 'bugs_reports' => 'Fehlerberichte', 'credits' => 'Credits', - 'credits_content' => 'Einige Designelemente stammen von <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>, obwohl FreshRSS dieses Framework nicht nutzt. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> stammen vom <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> Font wurde von <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a> erstellt. Favicons werden mit <a href="https://getfavicon.appspot.com/">getFavicon API</a> gesammelt. FreshRSS basiert auf <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, einem PHP-Framework.', + 'credits_content' => 'Einige Designelemente stammen von <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>, obwohl FreshRSS dieses Framework nicht nutzt. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> stammen vom <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> Font wurde von <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a> erstellt. FreshRSS basiert auf <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, einem PHP-Framework.', 'freshrss_description' => 'FreshRSS ist ein RSS-Feedsaggregator zum selbst hosten wie zum Beispiel <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> oder <a href="http://projet.idleman.fr/leed/">Leed</a>. Er ist leicht und einfach zu handhaben und gleichzeitig ein leistungsstarkes und konfigurierbares Werkzeug.', 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', 'license' => 'Lizenz', @@ -17,7 +17,7 @@ return array( ), 'feed' => array( 'add' => 'Sie können Feeds hinzufügen.', - 'empty' => 'Es gibt keinen Artikel zum Zeigen.', + 'empty' => 'Es gibt keinen Artikel zum Anzeigen.', 'rss_of' => 'RSS-Feed von %s', 'title' => 'Ihre RSS-Feeds', 'title_global' => 'Globale Ansicht', diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index e9267bbbd..b747d1551 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -3,17 +3,17 @@ return array( 'action' => array( 'finish' => 'Installation fertigstellen', - 'fix_errors_before' => 'Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', - 'next_step' => 'Zum nächsten Schritt gehen', + 'fix_errors_before' => 'Bitte Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'keep_install' => 'Vorherige Konfiguration beibehalten', + 'next_step' => 'Zum nächsten Schritt springen', + 'reinstall' => 'Neuinstallation von FreshRSS', ), 'auth' => array( - 'email_persona' => 'Anmelde-E-Mail-Adresse<br /><small>(für <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'form' => 'Webformular (traditionell, benötigt JavaScript)', 'http' => 'HTTP (HTTPS für erfahrene Benutzer)', 'none' => 'Keine (gefährlich)', 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', 'password_format' => 'mindestens 7 Zeichen', - 'persona' => 'Mozilla Persona (modern, benötigt JavaScript)', 'type' => 'Authentifizierungsmethode', ), 'bdd' => array( @@ -25,40 +25,49 @@ return array( ), 'host' => 'Host', 'prefix' => 'Tabellen-Präfix', - 'password' => 'HTTP-Password', + 'password' => 'SQL-Password', 'type' => 'Datenbank-Typ', - 'username' => 'HTTP-Nutzername', + 'username' => 'SQL-Nutzername', ), 'check' => array( '_' => 'Überprüfungen', + 'already_installed' => 'Wir haben festgestellt, dass FreshRSS bereits installiert wurde!', 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/cache</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', ), 'ctype' => array( 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', 'ok' => 'Sie haben die benötigte Bibliothek für die Überprüfung von Zeichentypen (ctype).', ), 'curl' => array( - 'nok' => 'Ihnen fehlt cURL (Paket php5-curl).', + 'nok' => 'Ihnen fehlt cURL (Paket php-curl).', 'ok' => 'Sie haben die cURL-Erweiterung.', ), 'data' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', ), 'dom' => array( - 'nok' => 'Ihnen fehlt eine benötigte Bibliothek um DOM zu durchstöbern (Paket php-xml).', + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek um DOM zu durchstöbern.', 'ok' => 'Sie haben die benötigte Bibliothek um DOM zu durchstöbern.', ), 'favicons' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/favicons</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', + ), + 'fileinfo' => array( + 'nok' => 'Ihnen fehlt PHP fileinfo (Paket fileinfo).', + 'ok' => 'Sie haben die fileinfo-Erweiterung.', ), 'http_referer' => array( 'nok' => 'Bitte stellen Sie sicher, dass Sie Ihren HTTP REFERER nicht abändern.', 'ok' => 'Ihr HTTP REFERER ist bekannt und entspricht Ihrem Server.', ), + 'json' => array( + 'nok' => 'Ihnen fehlt eine empfohlene Bibliothek um JSON zu parsen.', + 'ok' => 'Sie haben eine empfohlene Bibliothek um JSON zu parsen.', + ), 'minz' => array( 'nok' => 'Ihnen fehlt das Minz-Framework.', 'ok' => 'Sie haben das Minz-Framework.', @@ -68,12 +77,8 @@ return array( 'ok' => 'Sie haben die benötigte Bibliothek für reguläre Ausdrücke (PCRE).', ), 'pdo' => array( - 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite).', - 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/persona</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/persona</em> sind in Ordnung.', + 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( 'nok' => 'Ihre PHP-Version ist %s aber FreshRSS benötigt mindestens Version %s.', @@ -81,22 +86,29 @@ return array( ), 'users' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/users</em>. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', + ), + 'xml' => array( + 'nok' => 'Ihnen fehlt die benötigte Bibliothek um XML zu parsen.', + 'ok' => 'Sie haben die benötigte Bibliothek um XML zu parsen.', ), ), 'conf' => array( '_' => 'Allgemeine Konfiguration', - 'ok' => 'Allgemeine Konfiguration ist gespeichert worden.', + 'ok' => 'Die allgemeine Konfiguration ist gespeichert worden.', ), 'congratulations' => 'Glückwunsch!', 'default_user' => 'Nutzername des Standardbenutzers <small>(maximal 16 alphanumerische Zeichen)</small>', 'delete_articles_after' => 'Entferne Artikel nach', - 'fix_errors_before' => 'Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'fix_errors_before' => 'Bitte den Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', 'javascript_is_better' => 'FreshRSS ist ansprechender mit aktiviertem JavaScript', + 'js' => array( + 'confirm_reinstall' => 'Du wirst deine vorherige Konfiguration (Daten) verlieren FreshRSS. Bist du sicher, dass du fortfahren willst?', + ), 'language' => array( '_' => 'Sprache', 'choose' => 'Wählen Sie eine Sprache für FreshRSS', - 'defined' => 'Sprache ist festgelegt worden.', + 'defined' => 'Die Sprache ist festgelegt worden.', ), 'not_deleted' => 'Etwas ist schiefgelaufen; Sie müssen die Datei <em>%s</em> manuell löschen.', 'ok' => 'Der Installationsvorgang war erfolgreich.', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 0479b8f46..4ffef4302 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -1,6 +1,15 @@ <?php return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), 'category' => array( '_' => 'Kategorie', 'add' => 'Eine Kategorie hinzufügen', @@ -37,13 +46,18 @@ return array( 'url' => 'Feed-URL', 'validator' => 'Überprüfen Sie die Gültigkeit des Feeds', 'website' => 'Webseiten-URL', + 'pubsubhubbub' => 'Sofortbenachrichtigung mit PubSubHubbub', + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.',// TODO + 'title' => 'Firefox feed reader',// TODO ), 'import_export' => array( 'export' => 'Exportieren', 'export_opml' => 'Liste der Feeds exportieren (OPML)', 'export_starred' => 'Ihre Favoriten exportieren', 'feed_list' => 'Liste von %s Artikeln', - 'file_to_import' => 'Zu importierende Datei<br />(OPML, JSON oder Zip)', + 'file_to_import' => 'Zu importierende Datei<br />(OPML, JSON oder ZIP)', 'file_to_import_no_zip' => 'Zu importierende Datei<br />(OPML oder JSON)', 'import' => 'Importieren', 'starred_list' => 'Liste der Lieblingsartikel', @@ -53,9 +67,11 @@ return array( 'bookmark' => 'Abonnieren (FreshRSS-Lesezeichen)', 'import_export' => 'Importieren / Exportieren', 'subscription_management' => 'Abonnementverwaltung', + 'subscription_tools' => 'Subscription tools',// TODO ), 'title' => array( '_' => 'Abonnementverwaltung', 'feed_management' => 'Verwaltung der RSS-Feeds', + 'subscription_tools' => 'Subscription tools',// TODO ), ); diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index d2fcd3e82..d92a016af 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -8,11 +8,10 @@ return array( 'form' => 'Web form (traditional, requires JavaScript)', 'http' => 'HTTP (for advanced users with HTTPS)', 'none' => 'None (dangerous)', - 'persona' => 'Mozilla Persona (modern, requires JavaScript)', 'title' => 'Authentication', 'title_reset' => 'Authentication reset', 'token' => 'Authentication token', - 'token_help' => 'Allows to access RSS output of the default user without authentication:', + 'token_help' => 'Allows access to RSS output of the default user without authentication:', 'type' => 'Authentication method', 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', ), @@ -22,20 +21,20 @@ return array( 'ok' => 'Permissions on cache directory are good.', ), 'categories' => array( - 'nok' => 'Category table is bad configured.', + 'nok' => 'Category table is improperly configured.', 'ok' => 'Category table is ok.', ), 'connection' => array( - 'nok' => 'Connection to the database cannot being established.', + 'nok' => 'Connection to the database cannot be established.', 'ok' => 'Connection to the database is ok.', ), 'ctype' => array( - 'nok' => 'You lack a required library for character type checking (php-ctype).', + 'nok' => 'Cannot find a required library for character type checking (php-ctype).', 'ok' => 'You have the required library for character type checking (ctype).', ), 'curl' => array( - 'nok' => 'You lack cURL (php5-curl package).', - 'ok' => 'You have cURL extension.', + 'nok' => 'Cannot find the cURL library (php-curl package).', + 'ok' => 'You have the cURL library.', ), 'data' => array( 'nok' => 'Check permissions on <em>./data</em> directory. HTTP server must have rights to write into', @@ -43,11 +42,11 @@ return array( ), 'database' => 'Database installation', 'dom' => array( - 'nok' => 'You lack a required library to browse the DOM (php-xml package).', + 'nok' => 'Cannot find a required library to browse the DOM (php-xml package).', 'ok' => 'You have the required library to browse the DOM.', ), 'entries' => array( - 'nok' => 'Entry table is bad configured.', + 'nok' => 'Entry table is improperly configured.', 'ok' => 'Entry table is ok.', ), 'favicons' => array( @@ -55,29 +54,29 @@ return array( 'ok' => 'Permissions on favicons directory are good.', ), 'feeds' => array( - 'nok' => 'Feed table is bad configured.', + 'nok' => 'Feed table is improperly configured.', 'ok' => 'Feed table is ok.', ), + 'fileinfo' => array( + 'nok' => 'Cannot find the PHP fileinfo library (fileinfo package).', + 'ok' => 'You have the fileinfo library.', + ), 'files' => 'File installation', 'json' => array( - 'nok' => 'You lack JSON (php5-json package).', + 'nok' => 'Cannot find JSON (php5-json package).', 'ok' => 'You have JSON extension.', ), 'minz' => array( - 'nok' => 'You lack the Minz framework.', + 'nok' => 'Cannot find the Minz framework.', 'ok' => 'You have the Minz framework.', ), 'pcre' => array( - 'nok' => 'You lack a required library for regular expressions (php-pcre).', + 'nok' => 'Cannot find a required library for regular expressions (php-pcre).', 'ok' => 'You have the required library for regular expressions (PCRE).', ), 'pdo' => array( - 'nok' => 'You lack PDO or one of the supported drivers (pdo_mysql, pdo_sqlite).', - 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Check permissions on <em>./data/persona</em> directory. HTTP server must have rights to write into', - 'ok' => 'Permissions on Mozilla Persona directory are good.', + 'nok' => 'Cannot find PDO or one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( '_' => 'PHP installation', @@ -85,8 +84,8 @@ return array( 'ok' => 'Your PHP version is %s, which is compatible with FreshRSS.', ), 'tables' => array( - 'nok' => 'There is one or more lacking tables in the database.', - 'ok' => 'Tables are existing in the database.', + 'nok' => 'There are one or more missing tables in the database.', + 'ok' => 'The appropriate tables exist in the database.', ), 'title' => 'Installation checking', 'tokens' => array( @@ -98,13 +97,13 @@ return array( 'ok' => 'Permissions on users directory are good.', ), 'zip' => array( - 'nok' => 'You lack ZIP extension (php5-zip package).', + 'nok' => 'Cannot find ZIP extension (php-zip package).', 'ok' => 'You have ZIP extension.', ), ), 'extensions' => array( 'disabled' => 'Disabled', - 'empty_list' => 'There is no installed extension', + 'empty_list' => 'There are no installed extensions', 'enabled' => 'Enabled', 'no_configure_view' => 'This extension cannot be configured.', 'system' => array( @@ -113,6 +112,13 @@ return array( ), 'title' => 'Extensions', 'user' => 'User extensions', + 'community' => 'Available community extensions', + 'name' => 'Name', + 'version' => 'Version', + 'description' => 'Description', + 'author' => 'Author', + 'latest' => 'Installed', + 'update' => 'Update available' ), 'stats' => array( '_' => 'Statistics', @@ -146,11 +152,22 @@ return array( 'title' => 'Statistics', 'top_feed' => 'Top ten feeds', ), + 'system' => array( + '_' => 'System configuration', + 'auto-update-url' => 'Auto-update server URL', + 'instance-name' => 'Instance name', + 'max-categories' => 'Categories per user limit', + 'max-feeds' => 'Feeds per user limit', + 'registration' => array( + 'help' => '0 means that there is no account limit', + 'number' => 'Max number of accounts', + ), + ), 'update' => array( '_' => 'Update system', 'apply' => 'Apply', 'check' => 'Check for new updates', - 'current_version' => 'Your current version of FreshRSS is the %s.', + 'current_version' => 'Your current version of FreshRSS is %s.', 'last' => 'Last verification: %s', 'none' => 'No update to apply', 'title' => 'Update system', @@ -158,8 +175,9 @@ return array( 'user' => array( 'articles_and_size' => '%s articles (%s)', 'create' => 'Create new user', - 'email_persona' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'language' => 'Language', + 'number' => 'There is %d account created', + 'numbers' => 'There are %d accounts created', 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', 'password_format' => 'At least 7 characters', 'title' => 'Manage users', diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 308c45d2c..e4eeb74b7 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -5,10 +5,10 @@ return array( '_' => 'Archiving', 'advanced' => 'Advanced', 'delete_after' => 'Remove articles after', - 'help' => 'More options are available in the individual stream settings', + 'help' => 'More options are available in the individual feed settings', 'keep_history_by_feed' => 'Minimum number of articles to keep by feed', - 'optimize' => 'Optimize database', - 'optimize_help' => 'To do occasionally to reduce the size of the database', + 'optimize' => 'Optimise database', + 'optimize_help' => 'Do occasionally to reduce the size of the database', 'purge_now' => 'Purge now', 'title' => 'Archiving', 'ttl' => 'Do not automatically refresh more often than', @@ -44,10 +44,10 @@ return array( 'filter' => 'Filter applied:', 'get_all' => 'Display all articles', 'get_category' => 'Display "%s" category', - 'get_favorite' => 'Display favorite articles', + 'get_favorite' => 'Display favourite articles', 'get_feed' => 'Display "%s" feed', 'no_filter' => 'No filter', - 'none' => 'You haven’t created any user query yet.', + 'none' => 'You haven’t created any user queries yet.', 'number' => 'Query n°%d', 'order_asc' => 'Display oldest articles first', 'order_desc' => 'Display newest articles first', @@ -56,14 +56,14 @@ return array( 'state_1' => 'Display read articles', 'state_2' => 'Display unread articles', 'state_3' => 'Display all articles', - 'state_4' => 'Display favorite articles', - 'state_5' => 'Display read favorite articles', - 'state_6' => 'Display unread favorite articles', - 'state_7' => 'Display favorite articles', - 'state_8' => 'Display not favorite articles', - 'state_9' => 'Display read not favorite articles', - 'state_10' => 'Display unread not favorite articles', - 'state_11' => 'Display not favorite articles', + 'state_4' => 'Display favourite articles', + 'state_5' => 'Display read favourite articles', + 'state_6' => 'Display unread favourite articles', + 'state_7' => 'Display favourite articles', + 'state_8' => 'Display not favourite articles', + 'state_9' => 'Display read not favourite articles', + 'state_10' => 'Display unread not favourite articles', + 'state_11' => 'Display not favourite articles', 'state_12' => 'Display all articles', 'state_13' => 'Display read articles', 'state_14' => 'Display unread articles', @@ -72,8 +72,11 @@ return array( ), 'profile' => array( '_' => 'Profile management', - 'email_persona' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', - 'password_api' => 'Password API<br /><small>(e.g., for mobile apps)</small>', + 'delete' => array( + '_' => 'Account deletion', + 'warn' => 'Your account and all related data will be deleted.', + ), + 'password_api' => 'API password<br /><small>(e.g., for mobile apps)</small>', 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', 'password_format' => 'At least 7 characters', 'title' => 'Profile', @@ -82,31 +85,33 @@ return array( '_' => 'Reading', 'after_onread' => 'After “mark all as read”,', 'articles_per_page' => 'Number of articles per page', - 'auto_load_more' => 'Load next articles at the page bottom', + 'auto_load_more' => 'Load more articles at the page bottom', 'auto_remove_article' => 'Hide articles after reading', + 'mark_updated_article_unread' => 'Mark updated articles as unread', 'confirm_enabled' => 'Display a confirmation dialog on “mark all as read” actions', 'display_articles_unfolded' => 'Show articles unfolded by default', 'display_categories_unfolded' => 'Show categories folded by default', - 'hide_read_feeds' => 'Hide categories & feeds with no unread article (does not work with “Show all articles” configuration)', + 'hide_read_feeds' => 'Hide categories & feeds with no unread articles (does not work with “Show all articles” configuration)', 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', + 'sides_close_article' => 'Clicking outside of article text area closes the article', 'jump_next' => 'jump to next unread sibling (feed or category)', 'number_divided_when_reader' => 'Divided by 2 in the reading view.', 'read' => array( 'article_open_on_website' => 'when article is opened on its original website', 'article_viewed' => 'when article is viewed', 'scroll' => 'while scrolling', - 'upon_reception' => 'upon reception of the article', + 'upon_reception' => 'upon receiving the article', 'when' => 'Mark article as read…', ), 'show' => array( - '_' => 'Articles to display', + '_' => 'Articles to display', 'adaptive' => 'Adjust showing', 'all_articles' => 'Show all articles', 'unread' => 'Show only unread', ), 'sort' => array( '_' => 'Sort order', - 'newer_first' => 'Newer first', + 'newer_first' => 'Newest first', 'older_first' => 'Oldest first', ), 'sticky_post' => 'Stick the article to the top when opened', @@ -138,7 +143,7 @@ return array( '_' => 'Shortcuts', 'article_action' => 'Article actions', 'auto_share' => 'Share', - 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', + 'auto_share_help' => 'If there is only one sharing mode, it is used. Otherwise, modes are accessible by their number.', 'close_dropdown' => 'Close menus', 'collapse_article' => 'Collapse', 'first_article' => 'Skip to the first article', @@ -158,7 +163,7 @@ return array( 'shift_for_all_read' => '+ <code>shift</code> to mark all articles as read', 'title' => 'Shortcuts', 'user_filter' => 'Access user filters', - 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', + 'user_filter_help' => 'If there is only one user filter, it is used. Otherwise, filters are accessible by their number.', ), 'user' => array( 'articles_and_size' => '%s articles (%s)', diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index 19af81e5b..334d9a8f5 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -21,7 +21,6 @@ return array( 'success' => 'You are disconnected', ), 'no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', - 'not_persona' => 'Only Persona system can be reset.', ), 'conf' => array( 'error' => 'An error occurred during configuration saving', @@ -40,26 +39,26 @@ return array( 'ok' => '%s is now enabled', ), 'no_access' => 'You have no access on %s', - 'not_enabled' => '%s is not enabled yet', + 'not_enabled' => '%s is not enabled', 'not_found' => '%s does not exist', ), 'import_export' => array( - 'export_no_zip_extension' => 'Zip extension is not present on your server. Please try to export files one by one.', + 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', 'feeds_imported' => 'Your feeds have been imported and will now be updated', - 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', + 'feeds_imported_with_errors' => 'Your feeds have been imported, but some errors occurred', 'file_cannot_be_uploaded' => 'File cannot be uploaded!', - 'no_zip_extension' => 'Zip extension is not present on your server.', - 'zip_error' => 'An error occured during Zip import.', + 'no_zip_extension' => 'ZIP extension is not present on your server.', + 'zip_error' => 'An error occured during ZIP import.', ), 'sub' => array( - 'actualize' => 'Actualize', + 'actualize' => 'Updating', 'category' => array( 'created' => 'Category %s has been created.', 'deleted' => 'Category has been deleted.', 'emptied' => 'Category has been emptied', 'error' => 'Category cannot be updated', 'name_exists' => 'Category name already exists.', - 'no_id' => 'You must precise the id of the category.', + 'no_id' => 'You must specify the id of the category.', 'no_name' => 'Category name cannot be empty.', 'not_delete_default' => 'You cannot delete the default category!', 'not_exist' => 'The category does not exist!', @@ -86,9 +85,9 @@ return array( 'purge_completed' => 'Purge completed (%d articles deleted)', ), 'update' => array( - 'can_apply' => 'FreshRSS will be now updated to the <strong>version %s</strong>.', + 'can_apply' => 'FreshRSS will now be updated to the <strong>version %s</strong>.', 'error' => 'The update process has encountered an error: %s', - 'file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into', + 'file_is_nok' => 'New <strong>version %s</strong> available, but check permissions on <em>%s</em> directory. HTTP server must have rights to write into', 'finished' => 'Update completed!', 'none' => 'No update to apply', 'server_not_found' => 'Update server cannot be found. [%s]', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 223cd82b1..0dc03795b 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -10,27 +10,36 @@ return array( 'empty' => 'Empty', 'enable' => 'Enable', 'export' => 'Export', - 'filter' => 'Filtrer', + 'filter' => 'Filter', 'import' => 'Import', 'manage' => 'Manage', - 'mark_read' => 'Mark as read', 'mark_favorite' => 'Mark as favourite', + 'mark_read' => 'Mark as read', 'remove' => 'Remove', 'see_website' => 'See website', 'submit' => 'Submit', 'truncate' => 'Delete all articles', ), 'auth' => array( - 'keep_logged_in' => 'Keep me logged in <small>(1 month)</small>', + 'email' => 'Email address', + 'keep_logged_in' => 'Keep me logged in <small>(%s days)</small>', 'login' => 'Login', - 'login_persona' => 'Login with Persona', - 'login_persona_problem' => 'Connection problem with Persona?', 'logout' => 'Logout', - 'password' => 'Password', + 'password' => array( + '_' => 'Password', + 'format' => '<small>At least 7 characters</small>', + ), + 'registration' => array( + '_' => 'New account', + 'ask' => 'Create an account?', + 'title' => 'Account creation', + ), 'reset' => 'Authentication reset', - 'username' => 'Username', - 'username_admin' => 'Administrator username', - 'will_reset' => 'Authentication system will be reset: a form will be used instead of Persona.', + 'username' => array( + '_' => 'Username', + 'admin' => 'Administrator username', + 'format' => '<small>maximum 16 alphanumeric characters</small>', + ), ), 'date' => array( 'Apr' => '\\A\\p\\r\\i\\l', @@ -45,41 +54,42 @@ return array( 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', - 'apr' => 'apr', - 'april' => 'Apr', - 'aug' => 'aug', - 'august' => 'Aug', + 'apr' => 'Apr.', + 'april' => 'April', + 'aug' => 'Aug.', + 'august' => 'August', 'before_yesterday' => 'Before yesterday', - 'dec' => 'dec', - 'december' => 'Dec', - 'feb' => 'feb', - 'february' => 'Feb', + 'dec' => 'Dec.', + 'december' => 'December', + 'feb' => 'Feb.', + 'february' => 'February', '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', 'fri' => 'Fri', - 'jan' => 'jan', - 'january' => 'Jan', - 'jul' => 'jul', - 'july' => 'Jul', - 'jun' => 'jun', - 'june' => 'Jun', + 'jan' => 'Jan.', + 'january' => 'January', + 'jul' => 'July', + 'july' => 'July', + 'jun' => 'June', + 'june' => 'June', 'last_3_month' => 'Last three months', 'last_6_month' => 'Last six months', 'last_month' => 'Last month', 'last_week' => 'Last week', 'last_year' => 'Last year', - 'mar' => 'mar', - 'march' => 'Mar', + 'mar' => 'Mar.', + 'march' => 'March', 'may' => 'May', + 'may_' => 'May', 'mon' => 'Mon', 'month' => 'months', - 'nov' => 'nov', - 'november' => 'Nov', - 'oct' => 'oct', - 'october' => 'Oct', + 'nov' => 'Nov.', + 'november' => 'November', + 'oct' => 'Oct.', + 'october' => 'October', 'sat' => 'Sat', - 'sep' => 'sep', - 'september' => 'Sep', + 'sep' => 'Sept.', + 'september' => 'September', 'sun' => 'Sun', 'thu' => 'Thu', 'today' => 'Today', @@ -94,9 +104,9 @@ return array( 'js' => array( 'category_empty' => 'Empty category', 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', - 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favorites and user queries. It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favourites and user queries. It cannot be cancelled!', 'feedback' => array( - 'body_new_articles' => 'There are \\d new articles to read on FreshRSS.', + 'body_new_articles' => 'There are %%d new articles to read on FreshRSS.', 'request_failed' => 'A request has failed, it may have been caused by Internet connection problems.', 'title_new_articles' => 'FreshRSS: new articles!', ), @@ -104,10 +114,19 @@ return array( 'should_be_activated' => 'JavaScript must be enabled', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', + 'es' => 'Español', 'fr' => 'Français', 'he' => 'עברית', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', ), 'menu' => array( 'about' => 'About', @@ -125,6 +144,7 @@ return array( 'sharing' => 'Sharing', 'shortcuts' => 'Shortcuts', 'stats' => 'Statistics', + 'system' => 'System configuration', 'update' => 'Update', 'user_management' => 'Manage users', 'user_profile' => 'Profile', @@ -144,19 +164,25 @@ return array( 'email' => 'Email', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', 'print' => 'Print', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', - 'wallabag' => 'wallabag', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', ), 'short' => array( - 'attention' => 'Attention!', + 'attention' => 'Warning!', 'blank_to_disable' => 'Leave blank to disable', 'by_author' => 'By <em>%s</em>', 'by_default' => 'By default', - 'damn' => 'Damn!', + 'damn' => 'Blast!', 'default_category' => 'Uncategorized', 'no' => 'No', + 'not_applicable' => 'Not available', 'ok' => 'Ok!', 'or' => 'or', 'yes' => 'Yes', diff --git a/app/i18n/en/index.php b/app/i18n/en/index.php index 80fa3d950..a4686de4e 100644 --- a/app/i18n/en/index.php +++ b/app/i18n/en/index.php @@ -6,7 +6,7 @@ return array( 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', 'bugs_reports' => 'Bugs reports', '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 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.', + '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 has been created by <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.', '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.', 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', 'license' => 'License', @@ -41,7 +41,7 @@ return array( 'mark_cat_read' => 'Mark category as read', 'mark_feed_read' => 'Mark feed as read', 'newer_first' => 'Newer first', - 'non-starred' => 'Show all but favorites', + 'non-starred' => 'Show all but favourites', 'normal_view' => 'Normal view', 'older_first' => 'Oldest first', 'queries' => 'User queries', @@ -49,7 +49,7 @@ return array( 'reader_view' => 'Reading view', 'rss_view' => 'RSS feed', 'search_short' => 'Search', - 'starred' => 'Show only favorites', + 'starred' => 'Show only favourites', 'stats' => 'Statistics', 'subscription' => 'Subscriptions management', 'unread' => 'Show only unread', diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index 2bc6bd38f..40fff37dd 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -3,17 +3,17 @@ return array( 'action' => array( 'finish' => 'Complete installation', - 'fix_errors_before' => 'Fix errors before skip to the next step.', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', + 'keep_install' => 'Keep previous configuration', 'next_step' => 'Go to the next step', + 'reinstall' => 'Reinstall FreshRSS', ), 'auth' => array( - 'email_persona' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'form' => 'Web form (traditional, requires JavaScript)', 'http' => 'HTTP (for advanced users with HTTPS)', 'none' => 'None (dangerous)', 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', 'password_format' => 'At least 7 characters', - 'persona' => 'Mozilla Persona (modern, requires JavaScript)', 'type' => 'Authentication method', ), 'bdd' => array( @@ -25,55 +25,60 @@ return array( ), 'host' => 'Host', 'prefix' => 'Table prefix', - 'password' => 'HTTP password', + 'password' => 'Database password', 'type' => 'Type of database', - 'username' => 'HTTP username', + 'username' => 'Database username', ), 'check' => array( '_' => 'Checks', + 'already_installed' => 'We have detected that FreshRSS is already installed!', 'cache' => array( 'nok' => 'Check permissions on <em>./data/cache</em> directory. HTTP server must have rights to write into', 'ok' => 'Permissions on cache directory are good.', ), 'ctype' => array( - 'nok' => 'You lack a required library for character type checking (php-ctype).', + 'nok' => 'Cannot find a required library for character type checking (php-ctype).', 'ok' => 'You have the required library for character type checking (ctype).', ), 'curl' => array( - 'nok' => 'You lack cURL (php5-curl package).', - 'ok' => 'You have cURL extension.', + 'nok' => 'Cannot find the cURL library (php-curl package).', + 'ok' => 'You have the cURL library.', ), 'data' => array( 'nok' => 'Check permissions on <em>./data</em> directory. HTTP server must have rights to write into', 'ok' => 'Permissions on data directory are good.', ), 'dom' => array( - 'nok' => 'You lack a required library to browse the DOM (php-xml package).', + 'nok' => 'Cannot find a required library to browse the DOM.', 'ok' => 'You have the required library to browse the DOM.', ), 'favicons' => array( 'nok' => 'Check permissions on <em>./data/favicons</em> directory. HTTP server must have rights to write into', 'ok' => 'Permissions on favicons directory are good.', ), + 'fileinfo' => array( + 'nok' => 'Cannot find the PHP fileinfo library (fileinfo package).', + 'ok' => 'You have the fileinfo library.', + ), 'http_referer' => array( 'nok' => 'Please check that you are not altering your HTTP REFERER.', 'ok' => 'Your HTTP REFERER is known and corresponds to your server.', ), + 'json' => array( + 'nok' => 'Cannot find a recommended library to parse JSON.', + 'ok' => 'You have a recommended library to parse JSON.', + ), 'minz' => array( - 'nok' => 'You lack the Minz framework.', + 'nok' => 'Cannot find the Minz framework.', 'ok' => 'You have the Minz framework.', ), 'pcre' => array( - 'nok' => 'You lack a required library for regular expressions (php-pcre).', + 'nok' => 'Cannot find a required library for regular expressions (php-pcre).', 'ok' => 'You have the required library for regular expressions (PCRE).', ), 'pdo' => array( - 'nok' => 'You lack PDO or one of the supported drivers (pdo_mysql, pdo_sqlite).', - 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Check permissions on <em>./data/persona</em> directory. HTTP server must have rights to write into', - 'ok' => 'Permissions on Mozilla Persona directory are good.', + 'nok' => 'Cannot find PDO or one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( 'nok' => 'Your PHP version is %s but FreshRSS requires at least version %s.', @@ -83,6 +88,10 @@ return array( 'nok' => 'Check permissions on <em>./data/users</em> directory. HTTP server must have rights to write into', 'ok' => 'Permissions on users directory are good.', ), + 'xml' => array( + 'nok' => 'Cannot find the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), ), 'conf' => array( '_' => 'General configuration', @@ -91,8 +100,11 @@ return array( 'congratulations' => 'Congratulations!', 'default_user' => 'Username of the default user <small>(maximum 16 alphanumeric characters)</small>', 'delete_articles_after' => 'Remove articles after', - 'fix_errors_before' => 'Fix errors before skip to the next step.', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', + 'js' => array( + 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', + ), 'language' => array( '_' => 'Language', 'choose' => 'Choose a language for FreshRSS', diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 2b62e4775..47b15ae7a 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -1,6 +1,15 @@ <?php return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.', + 'title' => 'API', + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.', + 'label' => 'Subscribe', + 'title' => 'Bookmarklet', + ), 'category' => array( '_' => 'Category', 'add' => 'Add a category', @@ -10,23 +19,23 @@ return array( 'feed' => array( 'add' => 'Add a RSS feed', 'advanced' => 'Advanced', - 'archiving' => 'Archivage', + 'archiving' => 'Archiving', 'auth' => array( 'configuration' => 'Login', - 'help' => 'Connection allows to access HTTP protected RSS feeds', + 'help' => 'Allows access to HTTP protected RSS feeds', 'http' => 'HTTP Authentication', 'password' => 'HTTP password', 'username' => 'HTTP username', ), - 'css_help' => 'Retrieves truncated RSS feeds (attention, requires more time!)', + 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', 'css_path' => 'Articles CSS path on original website', 'description' => 'Description', 'empty' => 'This feed is empty. Please verify that it is still maintained.', - 'error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.', + 'error' => 'This feed has encountered a problem. Please verify that it is always reachable then update it.', 'in_main_stream' => 'Show in main stream', 'informations' => 'Information', 'keep_history' => 'Minimum number of articles to keep', - 'moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under <em>%s</em>.', + 'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.', 'no_selected' => 'No feed selected.', 'number_entries' => '%d articles', 'stats' => 'Statistics', @@ -37,14 +46,19 @@ return array( 'url' => 'Feed URL', 'validator' => 'Check the validity of the feed', 'website' => 'Website URL', + 'pubsubhubbub' => 'Instant notification with PubSubHubbub', + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.', + 'title' => 'Firefox feed reader', ), 'import_export' => array( 'export' => 'Export', 'export_opml' => 'Export list of feeds (OPML)', 'export_starred' => 'Export your favourites', 'feed_list' => 'List of %s articles', - 'file_to_import' => 'File to import<br />(OPML, Json or Zip)', - 'file_to_import_no_zip' => 'File to import<br />(OPML or Json)', + 'file_to_import' => 'File to import<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)', 'import' => 'Import', 'starred_list' => 'List of favourite articles', 'title' => 'Import / export', @@ -53,9 +67,11 @@ return array( 'bookmark' => 'Subscribe (FreshRSS bookmark)', 'import_export' => 'Import / export', 'subscription_management' => 'Subscriptions management', + 'subscription_tools' => 'Subscription tools', ), 'title' => array( '_' => 'Subscriptions management', 'feed_management' => 'RSS feeds management', + 'subscription_tools' => 'Subscription tools', ), ); diff --git a/app/i18n/es/admin.php b/app/i18n/es/admin.php new file mode 100755 index 000000000..93b1e6e5c --- /dev/null +++ b/app/i18n/es/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Permitir la lectura anónima de los artículos del usuario por defecto (%s)', + 'allow_anonymous_refresh' => 'Permitir la actualización anónima de los artículos', + 'api_enabled' => 'Concederle acceso a la <abbr>API</abbr> <small>(necesario para apps de móvil)</small>', + 'form' => 'Formulario Web (el más habitual, requiere JavaScript)', + 'http' => 'HTTP (para usuarios avanzados con HTTPS)', + 'none' => 'Ninguno (peligroso)', + 'title' => 'Identificación', + 'title_reset' => 'Reinicio de la identificación', + 'token' => 'Clave de identificación', + 'token_help' => 'Permite el acceso a la salida RSS del usuario por defecto sin necesidad de identificación:', + 'type' => 'Método de identificación', + 'unsafe_autologin' => 'Permite la identificación automática insegura usando el formato: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data/cache</em> . El servidor HTTP debe contar con permiso de escritura', + 'ok' => 'Los permisos en el cache son correctos.', + ), + 'categories' => array( + 'nok' => 'La tabla Categorías está configurada de forma incorrecta.', + 'ok' => 'La tabla Categorías está correcta.', + ), + 'connection' => array( + 'nok' => 'No se pudo establecer una conexión con la base de datos.', + 'ok' => 'La conexión con la base de datos es correcta.', + ), + 'ctype' => array( + 'nok' => 'No se puedo encontrar la librería necesaria para compropbar el tipo de caracteres (php-ctype).', + 'ok' => 'Dispones de la librería necesaria para la verificación del tipo de caracteres (ctype).', + ), + 'curl' => array( + 'nok' => 'No se pudo encontrar la librería cURL (paquete php-curl).', + 'ok' => 'Dispones de la librería cURL.', + ), + 'data' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos en el directorio data son correctos.', + ), + 'database' => 'Instalación de la base de datos', + 'dom' => array( + 'nok' => 'No se ha podido localizar la librería necesaria para explorar el DOM (paquete php-xml).', + 'ok' => 'Dispones de la librería necesaria para explorar el DOM.', + ), + 'entries' => array( + 'nok' => 'La tabla de entrada no está configurada correctamente.', + 'ok' => 'La tabla de entrada está correcta.', + ), + 'favicons' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data/favicons</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos en el directorio favicons son correctos.', + ), + 'feeds' => array( + 'nok' => 'La tabla Feed está configurada de forma incorrecta.', + 'ok' => 'La tabla Feed está correcta.', + ), + 'fileinfo' => array( + 'nok' => 'No se ha podido localizar la librería PHP fileinfo (paquete fileinfo).', + 'ok' => 'Dispones de la librería fileinfo.', + ), + 'files' => 'Instalación de Archivos', + 'json' => array( + 'nok' => 'No se ha podido localizar JSON (paquete php5-json).', + 'ok' => 'Dispones de la extensión JSON.', + ), + 'minz' => array( + 'nok' => 'No se ha podido localizar el entorno Minz.', + 'ok' => 'Dispones del entorno Minz.', + ), + 'pcre' => array( + 'nok' => 'No se ha podido localizar la librería para las expresiones regulares (php-pcre).', + 'ok' => 'Dispones de la librería necesaria para expresiones regulares (PCRE).', + ), + 'pdo' => array( + 'nok' => 'No se ha podido localiar PDO o uno de los controladores compatibles (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Dispones de PDO y, al menos, de uno de los controladores compatibles (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Instalación PHP', + 'nok' => 'Dispones de la versión PHP %s pero FreshRSS requiere de, al menos, la versión %s.', + 'ok' => 'Dispones de la versión PHP %s, que es compatible con FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Falta al menos una tabla en la base de datos.', + 'ok' => 'Todas las tablas necesarias están disponibles en la base de datos.', + ), + 'title' => 'Verificación de instalación', + 'tokens' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data/tokens</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos en el directorio de tokens de identificación son correctos.', + ), + 'users' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data/users</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos en el directorio users son correctos.', + ), + 'zip' => array( + 'nok' => 'No se ha podido localizar la extensión ZIP (paquete php-zip).', + 'ok' => 'Dispones de la extensión ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Desactivado', + 'empty_list' => 'No hay extensiones instaladas', + 'enabled' => 'Activado', + 'no_configure_view' => 'Esta extensión no puede ser configurada.', + 'system' => array( + '_' => 'Sistema de extensiones', + 'no_rights' => 'Sistema de extensiones (careces de los permisos necesarios)', + ), + 'title' => 'Extensiones', + 'user' => 'Extensiones de usuario', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => 'Estadísticas', + 'all_feeds' => 'Todas las fuentes', + 'category' => 'Categoría', + 'entry_count' => 'Cómputo total', + 'entry_per_category' => 'Entradas por categoría', + 'entry_per_day' => 'Entradas por día (últimos 30 días)', + 'entry_per_day_of_week' => 'Por día de la semana (mnedia: %.2f mensajes)', + 'entry_per_hour' => 'Por hora (media: %.2f mensajes)', + 'entry_per_month' => 'Por mes (media: %.2f mensajes)', + 'entry_repartition' => 'Reparto de entradas', + 'feed' => 'Fuente', + 'feed_per_category' => 'Fuentes por categoría', + 'idle' => 'Fuentes inactivas', + 'main' => 'Estadísticas principales', + 'main_stream' => 'Salida principal', + 'menu' => array( + 'idle' => 'Fuentes inactivas', + 'main' => 'Estadísticas principañes', + 'repartition' => 'Reparto de artículos', + ), + 'no_idle' => 'No hay fuentes inactivas', + 'number_entries' => '%d artículos', + 'percent_of_total' => '%% del total', + 'repartition' => 'Reprto de artículos', + 'status_favorites' => 'Favoritos', + 'status_read' => 'Leídos', + 'status_total' => 'Total', + 'status_unread' => 'Pendientes', + 'title' => 'Estadísticas', + 'top_feed' => 'Las 10 fuentes más activas', + ), + 'system' => array( + '_' => 'Configuración del sistema', + 'auto-update-url' => 'URL de auto-actualización', + 'instance-name' => 'Nombre de la fuente', + 'max-categories' => 'Límite de categorías por usuario', + 'max-feeds' => 'Límite de fuentes por usuario', + 'registration' => array( + 'help' => '0 significa que no hay límite en la cuenta', + 'number' => 'Número máximo de cuentas', + ), + ), + 'update' => array( + '_' => 'Actualizar sistema', + 'apply' => 'Aplicar', + 'check' => 'Buscar actualizaciones', + 'current_version' => 'Dispones de la versión %s de FreshRSS.', + 'last' => 'Última comprobación: %s', + 'none' => 'No hay actualizaciones disponibles', + 'title' => 'Actualizar sistema', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'create' => 'Crear nuevo usuario', + 'language' => 'Idioma', + 'number' => 'Hay %d cuenta creada', + 'numbers' => 'Hay %d cuentas creadas', + 'password_form' => 'Contraseña<br /><small>(para el método de identificación por formulario web)</small>', + 'password_format' => 'Mínimo de 7 caracteres', + 'title' => 'Administrar usuarios', + 'user_list' => 'Lista de usuarios', + 'username' => 'Nombre de usuario', + 'users' => 'Usuarios', + ), +); diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.php new file mode 100755 index 000000000..aad5cc66d --- /dev/null +++ b/app/i18n/es/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archivo', + 'advanced' => 'Avanzado', + 'delete_after' => 'Eliminar artículos tras', + 'help' => 'Hay más opciones disponibles en los ajustes de la fuente', + 'keep_history_by_feed' => 'Número mínimo de artículos a conservar por fuente', + 'optimize' => 'Optimizar la base de datos', + 'optimize_help' => 'Ejecuta la optimización de vez en cuando para reducir el tamaño de la base de datos', + 'purge_now' => 'Limpiar ahora', + 'title' => 'Archivo', + 'ttl' => 'No actualizar automáticamente más de', + ), + 'display' => array( + '_' => 'Visualización', + 'icon' => array( + 'bottom_line' => 'Línea inferior', + 'entry' => 'Iconos de artículos', + 'publication_date' => 'Fecha de publicación', + 'related_tags' => 'Etiquetas relacionadas', + 'sharing' => 'Compartir', + 'top_line' => 'Línea superior', + ), + 'language' => 'Idioma', + 'notif_html5' => array( + 'seconds' => 'segundos (0 significa sin límite de espera)', + 'timeout' => 'Notificación de fin de espera HTML5', + ), + 'theme' => 'Tema', + 'title' => 'Visualización', + 'width' => array( + 'content' => 'Ancho de contenido', + 'large' => 'Grande', + 'medium' => 'Mediano', + 'no_limit' => 'Sin límite', + 'thin' => 'Estrecho', + ), + ), + 'query' => array( + '_' => 'Consultas de usuario', + 'deprecated' => 'Esta consulta ya no es válida. La categoría referenciada o fuente ha sido eliminada.', + 'filter' => 'Filtro aplicado:', + 'get_all' => 'Mostrar todos los artículos', + 'get_category' => 'Mostrar la categoría "%s"', + 'get_favorite' => 'Mostrar artículos favoritos', + 'get_feed' => 'Mostrar fuente "%s"', + 'no_filter' => 'Sin filtro', + 'none' => 'Todavía no has creado ninguna consulta de usuario.', + 'number' => 'Consulta n° %d', + 'order_asc' => 'Mostrar primero los artículos más antiguos', + 'order_desc' => 'Mostrar primero los artículos más recientes', + 'search' => 'Buscar "%s"', + 'state_0' => 'Mostrar todos los artículos', + 'state_1' => 'Mostrar artículos leídos', + 'state_2' => 'Mostrar artículos pendientes', + 'state_3' => 'Mostrar todos los artículos', + 'state_4' => 'Mostrar artículos favoritos', + 'state_5' => 'Mostrar artículos favoritos leídos', + 'state_6' => 'Mostrar artículos favoritos pendientes', + 'state_7' => 'Mostrar artículos favoritos', + 'state_8' => 'Mostrar artículos no favoritos', + 'state_9' => 'Mostrar artículos no favoritos leídos', + 'state_10' => 'Mostrar artículos no favoritos pendientes', + 'state_11' => 'Mostrar artículos no favoritos', + 'state_12' => 'Mostrar todos los artículos', + 'state_13' => 'Mostrar artículos leídos', + 'state_14' => 'Mostrar artículos sin leer', + 'state_15' => 'Mostrar todos los artículos', + 'title' => 'Consultas de usuario', + ), + 'profile' => array( + '_' => 'Administración de perfiles', + 'delete' => array( + '_' => 'Borrar cuenta', + 'warn' => 'Tu cuenta y todos los datos asociados serán eliminados.', + ), + 'password_api' => 'Contraseña API <br /><small>(para apps móviles, por ej.)</small>', + 'password_form' => 'Contraseña<br /><small>(para el método de identificación por formulario web)</small>', + 'password_format' => 'Mínimo de 7 caracteres', + 'title' => 'Perfil', + ), + 'reading' => array( + '_' => 'Lectura', + 'after_onread' => 'Tras “marcar todo como leído”,', + 'articles_per_page' => 'Número de artículos por página', + 'auto_load_more' => 'Cargar más artículos al final de la página', + 'auto_remove_article' => 'Ocultar artículos tras la lectura', + 'mark_updated_article_unread' => 'Marcar artículos actualizados como no leídos', + 'confirm_enabled' => 'Mostrar ventana de confirmación al usar la función “marcar todos como leídos”', + 'display_articles_unfolded' => 'Mostrar los artículos sin expandir por defecto', + 'display_categories_unfolded' => 'Mostrar categorías expandidas por defecto', + 'hide_read_feeds' => 'Ocultar categorías & fuentes sin artículos no leídos (no funciona con la configuración "Mostrar todos los artículos")', + 'img_with_lazyload' => 'Usar el modo de "carga perezosa" para las imágenes', + 'sides_close_article' => 'Pinchar fuera del área de texto del artículo lo cerrará', + 'jump_next' => 'saltar al siguiente archivo sin leer emparentado (fuente o categoría)', + 'number_divided_when_reader' => 'Dividido en 2 en la vista de lectura.', + 'read' => array( + 'article_open_on_website' => 'cuando el artículo se abra en su web original', + 'article_viewed' => 'cuando se muestre el artículo', + 'scroll' => 'durante el desplazamiento', + 'upon_reception' => 'al recibir el artículo', + 'when' => 'Marcar el artículo como leído…', + ), + 'show' => array( + '_' => 'Artículos a mostrar', + 'adaptive' => 'Ajustar la visualización', + 'all_articles' => 'Mostrar todos los artículos', + 'unread' => 'Mostrar solo pendientes', + ), + 'sort' => array( + '_' => 'Orden', + 'newer_first' => 'Nuevos primero', + 'older_first' => 'Antiguos primero', + ), + 'sticky_post' => 'Pegar el artículo a la parte superior al abrirlo', + 'title' => 'Lectura', + 'view' => array( + 'default' => 'Vista por defecto', + 'global' => 'Vista Global', + 'normal' => 'Vista Normal', + 'reader' => 'Vista de Lectura', + ), + ), + 'sharing' => array( + '_' => 'Compartir', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Más información', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'share_name' => 'Compartir nombre a mostrar', + 'share_url' => 'Compatir URL a usar', + 'title' => 'Compartir', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Atajos de teclado', + 'article_action' => 'Acciones de artículo', + 'auto_share' => 'Compartir', + 'auto_share_help' => 'Si solo hay un modo para compartir, ese será el que se use. En caso contrario los modos quedarán accesibles por su numeración.', + 'close_dropdown' => 'Cerrar menús', + 'collapse_article' => 'Contraer', + 'first_article' => 'Saltar al primer artículo', + 'focus_search' => 'Acceso a la casilla de búsqueda', + 'help' => 'Mostrar documentación', + 'javascript' => 'JavaScript debe estar activado para poder usar atajos de teclado', + 'last_article' => 'Saltar al último artículo', + 'load_more' => 'Cargar más artículos', + 'mark_read' => 'Marcar como leído', + 'mark_favorite' => 'Marcar como favorito', + 'navigation' => 'Navegación', + 'navigation_help' => 'Con el modificador "Mayúsculas" es posible usar los atajos de teclado en las fuentes.<br/>Con el modificador "Alt" es posible aplicar los atajos de teclado en las categorías.', + 'next_article' => 'Saltar al siguiente artículo', + 'other_action' => 'Otras acciones', + 'previous_article' => 'Saltar al artículo anterior', + 'see_on_website' => 'Ver en la web original', + 'shift_for_all_read' => '+ <code>mayúsculas</code> para marcar todos los artículos como leídos', + 'title' => 'Atajos de teclado', + 'user_filter' => 'Acceso a filtros de usuario', + 'user_filter_help' => 'Si solo hay un filtro de usuario, ese será el que se use. En caso contrario, los filtros están accesibles por su númeración.', + ), + 'user' => array( + 'articles_and_size' => '%s artículos (%s)', + 'current' => 'Usuario actual', + 'is_admin' => 'es administrador', + 'users' => 'Usuarios', + ), +); diff --git a/app/i18n/es/feedback.php b/app/i18n/es/feedback.php new file mode 100755 index 000000000..136e70179 --- /dev/null +++ b/app/i18n/es/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimimización completada', + ), + 'access' => array( + 'denied' => 'No dispones de permiso para acceder a esta página', + 'not_found' => 'La página que buscas no existe', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Hubo un problema durante la configuración del sistema de idenfificación. Por favor, inténtalo más tarde.', + 'set' => 'El formulario será desde ahora tu sistema de identificación por defecto.', + ), + 'login' => array( + 'invalid' => 'Identificación incorrecta', + 'success' => 'Conexión', + ), + 'logout' => array( + 'success' => 'Desconexión', + ), + 'no_password_set' => 'Esta opción no está disponible porque no se ha definido una contraseña de administrador.', + ), + 'conf' => array( + 'error' => 'Hubo un error durante el guardado de la configuración.', + 'query_created' => 'Se ha creado la petición "%s".', + 'shortcuts_updated' => 'Se han actualizado los atajos de teclado', + 'updated' => 'Se ha actualizado la configuración', + ), + 'extensions' => array( + 'already_enabled' => '%s ya está activado', + 'disable' => array( + 'ko' => '%s no se puede desactivar. <a href="%s">Revisa el registro de FressRSS</a> para más información.', + 'ok' => '%s ha quedado desactivado', + ), + 'enable' => array( + 'ko' => '%s no se puede activar. <a href="%s">Revisa el registro de FressRSS</a> para más información.', + 'ok' => '%s ha quedado activado', + ), + 'no_access' => 'No tienes acceso a %s', + 'not_enabled' => '%s no está activado', + 'not_found' => '%s no existe', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'La extensión ZIP no está disponible en tu servidor. Por favor, exporta estos archivos uno a uno.', + 'feeds_imported' => 'Se han importado tus fuentes y quedarán actualizadas', + 'feeds_imported_with_errors' => 'Se importaron tus fuentes; pero hubo algunos errores', + 'file_cannot_be_uploaded' => 'No es posible enviar el archivo', + 'no_zip_extension' => 'La extensión ZIP no está disponible en tu servidor.', + 'zip_error' => 'Hubo un error durante la importación ZIP.', + ), + 'sub' => array( + 'actualize' => 'Actualización', + 'category' => array( + 'created' => 'Se ha creado la categoría %s.', + 'deleted' => 'Se ha eliminado la categoría.', + 'emptied' => 'Se ha vaciado la categoría', + 'error' => 'No es posible actualizar la categoría', + 'name_exists' => 'Ya existe una categoría con ese nombre.', + 'no_id' => 'Debes especificar la id de la categoría.', + 'no_name' => '¡El nombre de la categoría no puede dejarse en blanco!.', + 'not_delete_default' => '¡No puedes borrar la categoría por defecto!', + 'not_exist' => 'La categoría no existe', + 'over_max' => 'Has alcanzado el límite de categorías (%d)', + 'updated' => 'La categoría se ha actualizado.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> ha sido actualizada', + 'actualizeds' => 'Las fuentes RSS se han actualizado', + 'added' => 'Fuente RSS agregada <em>%s</em>', + 'already_subscribed' => 'Ya estás suscrito a <em>%s</em>', + 'deleted' => 'Fuente eliminada', + 'error' => 'No es posible actualizar la fuente', + 'internal_problem' => 'No ha sido posible agregar la fuente RSS. <a href="%s">Revisa el registro de FressRSS </a> para más información.', + 'invalid_url' => 'La URL <em>%s</em> es inválida', + 'marked_read' => 'Fuentes marcadas como leídas', + 'n_actualized' => 'Se han actualiado %d fuentes', + 'n_entries_deleted' => 'Se han eliminado %d artículos', + 'no_refresh' => 'No hay fuente a actualizar…', + 'not_added' => '<em>%s</em> no ha podido se añadida', + 'over_max' => 'Has alcanzado tu límite de fuentes (%d)', + 'updated' => 'Fuente actualizada', + ), + 'purge_completed' => 'Limpieza completada (se han eliminado %d artículos)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS se va a actualizar a la <strong>versión %s</strong>.', + 'error' => 'Hubo un error durante el proceso de actualización: %s', + 'file_is_nok' => 'Disponible la nueva <strong>versión %s</strong>. Sin embargo, debes revisar los permisos en el directorio <em>%s</em>. El servidor HTTP debe contar con permisos de escritura', + 'finished' => '¡Actualización completada!', + 'none' => 'No hay actualizaciones para procesar', + 'server_not_found' => 'No se ha podido conectar con el servidor de actualizaciones. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Se ha creado el usuario %s', + 'error' => 'No se ha podido crear al usuario %s', + ), + 'deleted' => array( + '_' => 'El usuario %s ha sido eliminado', + 'error' => 'El usuario %s no ha podido ser eliminado', + ), + ), + 'profile' => array( + 'error' => 'Tu perfil no puede ser modificado', + 'updated' => 'Tu perfil ha sido modificado', + ), +); diff --git a/app/i18n/es/gen.php b/app/i18n/es/gen.php new file mode 100755 index 000000000..0f113e073 --- /dev/null +++ b/app/i18n/es/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualizar', + 'back_to_rss_feeds' => '← regresar a tus fuentes RSS', + 'cancel' => 'Cancelar', + 'create' => 'Crear', + 'disable' => 'Desactivar', + 'empty' => 'Vaciar', + 'enable' => 'Activar', + 'export' => 'Exportar', + 'filter' => 'Filtrar', + 'import' => 'Importar', + 'manage' => 'Administrar', + 'mark_favorite' => 'Marcar como favorita', + 'mark_read' => 'Marcar como leído', + 'remove' => 'Borrar', + 'see_website' => 'Ver web', + 'submit' => 'Enviar', + 'truncate' => 'Borrar todos los artículos', + ), + 'auth' => array( + 'email' => 'Correo electrónico', + 'keep_logged_in' => 'Mantenerme identificado <small>(%s días)</small>', + 'login' => 'Conectar', + 'logout' => 'Desconectar', + 'password' => array( + '_' => 'Contraseña', + 'format' => '<small>Mínimo de 7 caracteres</small>', + ), + 'registration' => array( + '_' => 'Nueva cuenta', + 'ask' => '¿Crear una cuenta?', + 'title' => 'Creación de cuenta', + ), + 'reset' => 'Reinicar identificación', + 'username' => array( + '_' => 'Nombre de usuario', + 'admin' => 'Nombre de usuario del Administrador', + 'format' => '<small>máximo 16 caracteres alfanuméricos</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\b\\r\\i\\l', + 'Aug' => '\\A\\g\\o\\s\\t\\o', + 'Dec' => '\\D\\i\\c\\i\\e\\m\\b\\r\\e', + 'Feb' => '\\F\\e\\b\\r\\e\\r\\o', + 'Jan' => '\\E\\n\\e\\r\\o', + 'Jul' => '\\J\\u\\l\\i\\o', + 'Jun' => '\\J\\u\\n\\i\\o', + 'Mar' => '\\M\\a\\r\\z\\o', + 'May' => '\\M\\a\\y\\o', + 'Nov' => '\\N\\o\\v\\i\\e\\m\\b\\r\\e', + 'Oct' => '\\O\\c\\t\\u\\b\\r\\e', + 'Sep' => '\\S\\e\\p\\t\\i\\e\\m\\b\\r\\e', + 'apr' => 'abr', + 'april' => 'abril', + 'aug' => 'ago', + 'august' => 'agosto', + 'before_yesterday' => 'Anteayer', + 'dec' => 'dic', + 'december' => 'diciembre', + 'feb' => 'feb', + 'february' => 'febrero', + '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', + 'fri' => 'Vie', + 'jan' => 'ene', + 'january' => 'ene', + 'jul' => 'jul', + 'july' => 'julio', + 'jun' => 'jun', + 'june' => 'junio', + 'last_3_month' => 'Últimos tres meses', + 'last_6_month' => 'Últimos seis meses', + 'last_month' => 'Mes pasado', + 'last_week' => 'Semana pasada', + 'last_year' => 'Año pasado', + 'mar' => 'mar', + 'march' => 'marzo', + 'may' => 'mayo', + 'may_' => 'may', + 'mon' => 'Lun', + 'month' => 'meses', + 'nov' => 'nov', + 'november' => 'noviembre', + 'oct' => 'oct', + 'october' => 'octubre', + 'sat' => 'Sab', + 'sep' => 'sep', + 'september' => 'septiembre', + 'sun' => 'Dom', + 'thu' => 'Jue', + 'today' => 'Hoy', + 'tue' => 'Mar', + 'wed' => 'Mie', + 'yesterday' => 'Ayer', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Acerca de FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Vaciar categoría', + 'confirm_action' => '¿Seguyro que quieres hacerlo? No hay marcha atrás...', + 'confirm_action_feed_cat' => '¿Seguro que quieres hacerlo? Perderás todos los favoritos relacionados y las peticiones de usuario. ¡Y no hay marcha atrás!', + 'feedback' => array( + 'body_new_articles' => 'Hay %%d nuevos artículos para leer en FreshRSS.', + 'request_failed' => 'La petición ha fallado. Puede ser debido a problemas de conexión a internet.', + 'title_new_articles' => 'FreshRSS: ¡Nuevos artículos!', + ), + 'new_article' => 'Hay nuevos artículos disponibles. Pincha para refrescar la página.', + 'should_be_activated' => 'JavaScript debe estar activado', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'Acerca de', + 'admin' => 'Administración', + 'archiving' => 'Archivo', + 'authentication' => 'Identificación', + 'check_install' => 'Verificación de instalación', + 'configuration' => 'Configuración', + 'display' => 'Visualización', + 'extensions' => 'Extensiones', + 'logs' => 'Registros', + 'queries' => 'Peticiones de usuario', + 'reading' => 'Lectura', + 'search' => 'Buscar palabras o #etiquetas', + 'sharing' => 'Compartir', + 'shortcuts' => 'Atajos', + 'stats' => 'Estadísticas', + 'system' => 'Configuración del sistema', + 'update' => 'Actualización', + 'user_management' => 'Administrar usuarios', + 'user_profile' => 'Perfil', + ), + 'pagination' => array( + 'first' => 'Primero', + 'last' => 'Último', + 'load_more' => 'Cargar más artículos', + 'mark_all_read' => 'Marcar todo como leído', + 'next' => 'Siguiente', + 'nothing_to_load' => 'No hay más artículos', + 'previous' => 'Anterior', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => '¡Aviso!', + 'blank_to_disable' => 'Deja en blanco para desactivar', + 'by_author' => 'Por <em>%s</em>', + 'by_default' => 'Por defecto', + 'damn' => '¡Córcholis!', + 'default_category' => 'Sin categorizar', + 'no' => 'No', + 'not_applicable' => 'No disponible', + 'ok' => '¡Vale!', + 'or' => 'o', + 'yes' => 'Sí', + ), +); diff --git a/app/i18n/es/index.php b/app/i18n/es/index.php new file mode 100755 index 000000000..03054e23a --- /dev/null +++ b/app/i18n/es/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Acerca de', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Informe de fallos', + 'credits' => 'Créditos', + 'credits_content' => 'Aunque FreshRSS no usa ese entorno, algunos elementos del diseño están obtenidos de <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>. Los <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Iconos</a> han sido obtenidos del <a href="https://www.gnome.org/">proyecto GNOME</a>. La fuente <em>Open Sans</em> es una creación de <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS usa el entorno PHP <a href="https://github.com/marienfressinaud/MINZ">Minz</a>.', + 'freshrss_description' => 'FreshRSS es un agregador de fuentes RSS de alojamiento privado al estilo de <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> o <a href="http://projet.idleman.fr/leed/">Leed</a>. Es una herramienta potente, pero ligera y fácil de usar y configurar.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">en Github</a>', + 'license' => 'Licencia', + 'project_website' => 'Web del proyecto', + 'title' => 'Acerca de', + 'version' => 'Versión', + 'website' => 'Web', + ), + 'feed' => array( + 'add' => 'Puedes añadir fuentes.', + 'empty' => 'No hay artículos a mostrar.', + 'rss_of' => 'Fuente RSS de %s', + 'title' => 'Tus fuentes RSS', + 'title_global' => 'Vista global', + 'title_fav' => 'Tus favoritos', + ), + 'log' => array( + '_' => 'Registros', + 'clear' => 'Limpiar registros', + 'empty' => 'El archivo de registro está vacío', + 'title' => 'Registros', + ), + 'menu' => array( + 'about' => 'Acerca de FreshRSS', + 'add_query' => 'Añadir petición', + 'before_one_day' => 'Con más de 1 día', + 'before_one_week' => 'Con más de una semana', + 'favorites' => 'Favoritos (%s)', + 'global_view' => 'Vista Global', + 'main_stream' => 'Salida Principal', + 'mark_all_read' => 'Marcar todo como leído', + 'mark_cat_read' => 'Marcar categoría como leída', + 'mark_feed_read' => 'Marcar fuente como leída', + 'newer_first' => 'Nuevos primero', + 'non-starred' => 'Mostrar todos menos los favoritos', + 'normal_view' => 'Vista normal', + 'older_first' => 'Más antiguos primero', + 'queries' => 'Peticiones de usuario', + 'read' => 'Mostrar solo los leídos', + 'reader_view' => 'Vista de lectura', + 'rss_view' => 'Fuente RSS', + 'search_short' => 'Buscar', + 'starred' => 'Mostrar solo los favoritos', + 'stats' => 'Estadísticas', + 'subscription' => 'Administración de suscripciones', + 'unread' => 'Mostar solo no leídos', + ), + 'share' => 'Compartir', + 'tag' => array( + 'related' => 'Etiquetas relacionadas', + ), +); diff --git a/app/i18n/es/install.php b/app/i18n/es/install.php new file mode 100755 index 000000000..cd6f63432 --- /dev/null +++ b/app/i18n/es/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Completar instalación', + 'fix_errors_before' => 'Por favor, soluciona los errores detectados antes de continuar con el siguiente paso.', + 'keep_install' => 'Conservar la configuración anterior', + 'next_step' => 'Ir al siguiente paso', + 'reinstall' => 'Reinstalar FreshRSS', + ), + 'auth' => array( + 'form' => 'Formulario Web (método más habitual, requiere JavaScript)', + 'http' => 'HTTP (para usuarios avanzados con HTTPS)', + 'none' => 'Ninguna (peligroso)', + 'password_form' => 'Contraseña<br /><small>(para el método de acceso mediante formulario web)</small>', + 'password_format' => 'Al menos 7 caracteres', + 'type' => 'Método de identificación', + ), + 'bdd' => array( + '_' => 'Base de datos', + 'conf' => array( + '_' => 'Configuración de la base de datos', + 'ko' => 'Verificar la información de tu base de datos.', + 'ok' => 'La configuración de la base de datos ha sido guardada.', + ), + 'host' => 'Servidor', + 'prefix' => 'Prefijo de la tabla', + 'password' => 'Contraseña de la base de datos', + 'type' => 'Tipo de base de datos', + 'username' => 'Nombre de usuario de la base de datos', + ), + 'check' => array( + '_' => 'Verificaciones', + 'already_installed' => '¡FreshRSS ya está instalado!', + 'cache' => array( + 'nok' => 'Comprueba los permisos en el directorio <em>./data/cache</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos del directorio cache son correctos.', + ), + 'ctype' => array( + 'nok' => 'No se ha podido localizar la librería para la verificación del tipo de caracteres (php-ctype).', + 'ok' => 'Cuentas con la librería necesaria para la verificación del tipo de caracteres (ctype).', + ), + 'curl' => array( + 'nok' => 'No se ha podido localizar la librería cURL (paquete php-curl).', + 'ok' => 'Dispones de la librería cURL.', + ), + 'data' => array( + 'nok' => 'Comprueba los permisos del directorio <em>./data</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos del directorio data son correctos.', + ), + 'dom' => array( + 'nok' => 'No se ha podido localizar la librería necesaria para explorar la DOM.', + 'ok' => 'Dispones de la librería necesaria para explorar la DOM.', + ), + 'favicons' => array( + 'nok' => 'Verifica los permisos en el directorio <em>./data/favicons</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos del directorio favicons son correctos.', + ), + 'fileinfo' => array( + 'nok' => 'No se ha podido localizar la librería PHP fileinfo (paquete fileinfo).', + 'ok' => 'Dispones de la librería fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Por favor, comprueba que no estás alterando tu configuración HTTP REFERER.', + 'ok' => 'La configuración HTTP REFERER es conocida y se corresponde con la de tu servidor.', + ), + 'json' => array( + 'nok' => 'No se ha podido localizar la librería para procesar JSON.', + 'ok' => 'Dispones de la librería recomendada para procesar JSON.', + ), + 'minz' => array( + 'nok' => 'No se ha podido localizar el entorno Minz.', + 'ok' => 'Dispones del entorno Minz.', + ), + 'pcre' => array( + 'nok' => 'No se ha podido encontrar la librería necesaria para las expresiones regulares (php-pcre).', + 'ok' => 'Dispones de la librería necesaria para las expresiones regulares (PCRE).', + ), + 'pdo' => array( + 'nok' => 'No se ha podido localizar PDO o uno de los controladores compatibles (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Dispones de PDO y al menos uno de los controladores compatibles (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Dispones de la versión PHP %s, pero FreshRSS necesita de, al menos, la versión %s.', + 'ok' => 'Dispones de la versión PHP %s, que es compatible con FreshRSS.', + ), + 'users' => array( + 'nok' => 'Revisa los permisos en el directorio <em>./data/users</em>. El servidor HTTP debe contar con permisos de escritura.', + 'ok' => 'Los permisos en el directorio users son correctos.', + ), + 'xml' => array( + 'nok' => 'No se ha podido localizar la librería necesaria para procesar XML.', + 'ok' => 'Dispones de la librería necesaria para procesar XML.', + ), + ), + 'conf' => array( + '_' => 'Configuración general', + 'ok' => 'La configuración general se ha guardado.', + ), + 'congratulations' => '¡Enhorabuena!', + 'default_user' => 'Nombre de usuario para el usuario por defecto <small>(máximo de 16 caracteres alfanuméricos)</small>', + 'delete_articles_after' => 'Eliminar los artículos tras', + 'fix_errors_before' => 'Por favor, soluciona los errores detectados antes de proceder con el siguiente paso.', + 'javascript_is_better' => 'FreshRSS funciona mejor con JavaScript activado', + 'js' => array( + 'confirm_reinstall' => 'Al reinstalar FreshRSS perderás cualquier configuración anterior. ¿Seguro que quieres continuar?', + ), + 'language' => array( + '_' => 'Idioma', + 'choose' => 'Selecciona el idioma para FreshRSS', + 'defined' => 'Idioma seleccionado.', + ), + 'not_deleted' => 'Parece que ha habido un error. Debes eliminar el archivo <em>%s</em> de forma manual.', + 'ok' => 'La instalación se ha completado correctamente.', + 'step' => 'paso %d', + 'steps' => 'Pasos', + 'title' => 'Instalación · FreshRSS', + 'this_is_the_end' => '¡Terminamos!', +); diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php new file mode 100755 index 000000000..72eb06eb7 --- /dev/null +++ b/app/i18n/es/sub.php @@ -0,0 +1,66 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'category' => array( + '_' => 'Categoría', + 'add' => 'Añadir a la categoría', + 'empty' => 'Vaciar categoría', + 'new' => 'Nueva categoría', + ), + 'feed' => array( + 'add' => 'Añadir fuente RSS', + 'advanced' => 'Avanzado', + 'archiving' => 'Archivo', + 'auth' => array( + 'configuration' => 'Identificación', + 'help' => 'Permitir acceso a fuentes RSS protegidas con HTTP', + 'http' => 'Identificación HTTP', + 'password' => 'Contraseña HTTP', + 'username' => 'Nombre de usuario HTTP', + ), + 'css_help' => 'Recibir fuentes RSS truncadas (aviso, ¡necesita más tiempo!)', + 'css_path' => 'Ruta a la CSS de los artículos en la web original', + 'description' => 'Descripción', + 'empty' => 'La fuente está vacía. Por favor, verifica que siga activa.', + 'error' => 'Hay un problema con esta fuente. Por favor, veritica que esté disponible y prueba de nuevo.', + 'in_main_stream' => 'Mostrar en salida principal', + 'informations' => 'Información', + 'keep_history' => 'Número mínimo de artículos a conservar', + 'moved_category_deleted' => 'Al borrar una categoría todas sus fuentes pasan automáticamente a la categoría <em>%s</em>.', + 'no_selected' => 'No hay funentes seleccionadas.', + 'number_entries' => '%d artículos', + 'stats' => 'Estadísticas', + 'think_to_add' => 'Puedes añadir fuentes.', + 'title' => 'Título', + 'title_add' => 'Añadir fuente RSS', + 'ttl' => 'No actualizar de forma automática con una frecuencia mayor a', + 'url' => 'URL de la fuente', + 'validator' => 'Verifica la validez de la fuente', + 'website' => 'Web de la URL', + 'pubsubhubbub' => 'Notificación inmedaiata con PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Exportar', + 'export_opml' => 'Exportar la lista de fuentes (OPML)', + 'export_starred' => 'Exportar tus favoritos', + 'feed_list' => 'Lista de %s artículos', + 'file_to_import' => 'Archivo a importar<br />(OPML, JSON o ZIP)', + 'file_to_import_no_zip' => 'Archivo a importar<br />(OPML o JSON)', + 'import' => 'Importar', + 'starred_list' => 'Lista de artículos favoritos', + 'title' => 'Importar / exportar', + ), + 'menu' => array( + 'bookmark' => 'Suscribirse (favorito FreshRSS)', + 'import_export' => 'Importar / exportar', + 'subscription_management' => 'Administración de suscripciones', + ), + 'title' => array( + '_' => 'Administración de suscripciones', + 'feed_management' => 'Administración de fuentes RSS', + ), +); diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index b740bd0d2..b2bc48209 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -8,7 +8,6 @@ return array( 'form' => 'Formulaire (traditionnel, requiert JavaScript)', 'http' => 'HTTP (pour utilisateurs avancés avec HTTPS)', 'none' => 'Aucune (dangereux)', - 'persona' => 'Mozilla Persona (moderne, requiert JavaScript)', 'title' => 'Authentification', 'title_reset' => 'Réinitialisation de l’authentification', 'token' => 'Jeton d’identification', @@ -30,12 +29,12 @@ return array( 'ok' => 'La connexion à la base de données est bonne.', ), 'ctype' => array( - 'nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype).', - 'ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype).', + 'nok' => 'Impossible de trouver une librairie pour la vérification des types de caractères (php-ctype).', + 'ok' => 'Vous disposez de la librairie pour la vérification des types de caractères (ctype).', ), 'curl' => array( - 'nok' => 'Vous ne disposez pas de cURL (paquet php5-curl).', - 'ok' => 'Vous disposez de cURL.', + 'nok' => 'Impossible de trouver la librairie cURL (paquet php-curl).', + 'ok' => 'Vous disposez de la librairie cURL.', ), 'data' => array( 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data</em>. Le serveur HTTP doit être capable d’écrire dedans', @@ -43,8 +42,8 @@ return array( ), 'database' => 'Installation de la base de données', 'dom' => array( - 'nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml).', - 'ok' => 'Vous disposez du nécessaire pour parcourir le DOM.', + 'nok' => 'Impossible de trouver une librairie pour parcourir le DOM (paquet php-xml).', + 'ok' => 'Vous disposez de la librairie pour parcourir le DOM.', ), 'entries' => array( 'nok' => 'La table entry est mal configurée.', @@ -58,26 +57,26 @@ return array( 'nok' => 'La table feed est mal configurée.', 'ok' => 'La table feed est bien configurée.', ), + 'fileinfo' => array( + 'nok' => 'Impossible de trouver la librairie PHP fileinfo (paquet fileinfo).', + 'ok' => 'Vous disposez de la librairie fileinfo.', + ), 'files' => 'Installation des fichiers', 'json' => array( 'nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', - 'ok' => 'Vous disposez de l\'extension JSON.', + 'ok' => 'Vous disposez de l’extension JSON.', ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', 'ok' => 'Vous disposez du framework Minz', ), 'pcre' => array( - 'nok' => 'Il manque une librairie pour les expressions régulières (php-pcre).', - 'ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE).', + 'nok' => 'Impossible de trouver une librairie pour les expressions régulières (php-pcre).', + 'ok' => 'Vous disposez de la librairie pour les expressions régulières (PCRE).', ), 'pdo' => array( - 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite).', - 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/persona</em>. Le serveur HTTP doit être capable d’écrire dedans', - 'ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons.', + 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( '_' => 'Installation de PHP', @@ -85,7 +84,7 @@ return array( 'ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS.', ), 'tables' => array( - 'nok' => 'Il manque une ou plusieurs tables en base de données.', + 'nok' => 'Impossible de trouver une ou plusieurs tables en base de données.', 'ok' => 'Les tables sont bien présentes en base de données.', ), 'title' => 'Vérification de l’installation', @@ -98,21 +97,28 @@ return array( 'ok' => 'Les droits sur le répertoire des utilisateurs sont bons.', ), 'zip' => array( - 'nok' => 'Vous ne disposez pas de l\'extension ZIP (paquet php5-zip).', - 'ok' => 'Vous disposez de l\'extension ZIP.', + 'nok' => 'Vous ne disposez pas de l’extension ZIP (paquet php-zip).', + 'ok' => 'Vous disposez de l’extension ZIP.', ), ), 'extensions' => array( 'disabled' => 'Désactivée', - 'empty_list' => 'Il n’y a aucune extension installée.', + 'empty_list' => 'Aucune extension installée', 'enabled' => 'Activée', - 'no_configure_view' => 'Cette extension ne peut pas être configurée.', + 'no_configure_view' => 'Cette extension n’a pas à être configurée', 'system' => array( '_' => 'Extensions système', - 'no_rights' => 'Extension système (vous n’avez aucun droit dessus)', + 'no_rights' => 'Extensions système (contrôlées par l’administrateur)', ), 'title' => 'Extensions', 'user' => 'Extensions utilisateur', + 'community' => 'Extensions utilisateur disponibles', + 'name' => 'Nom', + 'version' => 'Version', + 'description' => 'Description', + 'author' => 'Auteur', + 'latest' => 'Installée', + 'update' => 'Mise à jour disponible', ), 'stats' => array( '_' => 'Statistiques', @@ -146,6 +152,17 @@ return array( 'title' => 'Statistiques', 'top_feed' => 'Les dix plus gros flux', ), + 'system' => array( + '_' => 'Configuration du système', + 'auto-update-url' => 'URL du service de mise à jour', + 'instance-name' => 'Nom de l’instance', + 'max-categories' => 'Limite de catégories par utilisateur', + 'max-feeds' => 'Limite de flux par utilisateur', + 'registration' => array( + 'help' => 'Un chiffre de 0 signifie que l’on peut créer un nombre infini de comptes', + 'number' => 'Nombre max de comptes', + ), + ), 'update' => array( '_' => 'Système de mise à jour', 'apply' => 'Appliquer la mise à jour', @@ -158,8 +175,9 @@ return array( 'user' => array( 'articles_and_size' => '%s articles (%s)', 'create' => 'Créer un nouvel utilisateur', - 'email_persona' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'language' => 'Langue', + 'number' => '%d compte a déjà été créé', + 'numbers' => '%d comptes ont déjà été créés', 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', 'password_format' => '7 caractères minimum', 'title' => 'Gestion des utilisateurs', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index d38445b99..0c8188623 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -72,7 +72,10 @@ return array( ), 'profile' => array( '_' => 'Gestion du profil', - 'email_persona' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', + 'delete' => array( + '_' => 'Suppression du compte', + 'warn' => 'Le compte et toutes les données associées vont être supprimées.', + ), 'password_api' => 'Mot de passe API<br /><small>(ex. : pour applis mobiles)</small>', 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', 'password_format' => '7 caractères minimum', @@ -84,11 +87,13 @@ return array( 'articles_per_page' => 'Nombre d’articles par page', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'auto_remove_article' => 'Cacher les articles après lecture', + 'mark_updated_article_unread' => 'Marquer les articles mis à jour comme non-lus', 'confirm_enabled' => 'Afficher une confirmation lors des actions “marquer tout comme lu”', 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', 'display_categories_unfolded' => 'Afficher les catégories pliées par défaut', 'hide_read_feeds' => 'Cacher les catégories & flux sans article non-lu (ne fonctionne pas avec la configuration “Afficher tous les articles”)', 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', + 'sides_close_article' => 'Cliquer hors de la zone de texte ferme l’article', 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', 'number_divided_when_reader' => 'Divisé par 2 dans la vue de lecture.', 'read' => array( diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index e2364a251..aa19cd02b 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -21,7 +21,6 @@ return array( 'success' => 'Vous avez été déconnecté', ), 'no_password_set' => 'Aucun mot de passe administrateur n’a été précisé. Cette fonctionnalité n’est pas disponible.', - 'not_persona' => 'Seul le système d’authentification Persona peut être réinitialisé.', ), 'conf' => array( 'error' => 'Une erreur est survenue durant la sauvegarde de la configuration', @@ -44,12 +43,12 @@ return array( 'not_found' => '%s n’existe pas', ), 'import_export' => array( - 'export_no_zip_extension' => 'L’extension Zip n’est pas présente sur votre serveur. Veuillez essayer d’exporter les fichiers un par un.', + 'export_no_zip_extension' => 'L’extension ZIP n’est pas présente sur votre serveur. Veuillez essayer d’exporter les fichiers un par un.', 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés.', 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues.', 'file_cannot_be_uploaded' => 'Le fichier ne peut pas être téléchargé !', - 'no_zip_extension' => 'L’extension Zip n’est pas présente sur votre serveur.', - 'zip_error' => 'Une erreur est survenue durant l’import du fichier Zip.', + 'no_zip_extension' => 'L’extension ZIP n’est pas présente sur votre serveur.', + 'zip_error' => 'Une erreur est survenue durant l’import du fichier ZIP.', ), 'sub' => array( 'actualize' => 'Actualiser', @@ -88,7 +87,7 @@ return array( 'update' => array( 'can_apply' => 'FreshRSS va maintenant être mis à jour vers la <strong>version %s</strong>.', 'error' => 'La mise à jour a rencontré un problème : %s', - 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'file_is_nok' => 'Nouvelle <strong>version %s</strong> disponible, mais veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans', 'finished' => 'La mise à jour est terminée !', 'none' => 'Aucune mise à jour à appliquer', 'server_not_found' => 'Le serveur de mise à jour n’a pas été trouvé. [%s]', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 92dc297c0..61a24602a 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -13,24 +13,33 @@ return array( 'filter' => 'Filtrer', 'import' => 'Importer', 'manage' => 'Gérer', - 'mark_read' => 'Marquer comme lu', 'mark_favorite' => 'Mettre en favori', + 'mark_read' => 'Marquer comme lu', 'remove' => 'Supprimer', 'see_website' => 'Voir le site', 'submit' => 'Valider', 'truncate' => 'Supprimer tous les articles', ), 'auth' => array( - 'keep_logged_in' => 'Rester connecté <small>(1 mois)</small>', + 'email' => 'Adresse courriel', + 'keep_logged_in' => 'Rester connecté <small>(%s jours)</small>', 'login' => 'Connexion', - 'login_persona' => 'Connexion avec Persona', - 'login_persona_problem' => 'Problème de connexion à Persona ?', 'logout' => 'Déconnexion', - 'password' => 'Mot de passe', + 'password' => array( + '_' => 'Mot de passe', + 'format' => '<small>7 caractères minimum</small>', + ), + 'registration' => array( + '_' => 'Nouveau compte', + 'ask' => 'Créer un compte ?', + 'title' => 'Création de compte', + ), 'reset' => 'Réinitialisation de l’authentification', - 'username' => 'Nom d’utilisateur', - 'username_admin' => 'Nom d’utilisateur administrateur', - 'will_reset' => 'Le système d’authentification va être réinitialisé : un formulaire sera utilisé à la place de Persona.', + 'username' => array( + '_' => 'Nom d’utilisateur', + 'admin' => 'Nom d’utilisateur administrateur', + 'format' => '<small>16 caractères alphanumériques maximum</small>', + ), ), 'date' => array( 'Apr' => '\\a\\v\\r\\i\\l', @@ -68,9 +77,10 @@ return array( 'last_month' => 'Depuis le mois dernier', 'last_week' => 'Depuis la semaine dernière', 'last_year' => 'Depuis l’année dernière', - 'mar' => 'mar.', + 'mar' => 'mars', 'march' => 'mars', - 'may' => 'mai.', + 'may' => 'mai', + 'may_' => 'mai', 'mon' => 'lun.', 'month' => 'mois', 'nov' => 'nov.', @@ -96,7 +106,7 @@ return array( 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', 'confirm_action_feed_cat' => 'Êtes-vous sûr(e) de vouloir continuer ? Vous perdrez les favoris et les filtres associés. Cette action ne peut être annulée !', 'feedback' => array( - 'body_new_articles' => 'Il y a \\d nouveaux articles à lire sur FreshRSS.', + 'body_new_articles' => 'Il y a %%d nouveaux articles à lire sur FreshRSS.', 'request_failed' => 'Une requête a échoué, cela peut être dû à des problèmes de connexion à Internet.', 'title_new_articles' => 'FreshRSS : nouveaux articles !', ), @@ -104,10 +114,19 @@ return array( 'should_be_activated' => 'Le JavaScript doit être activé.', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', + 'es' => 'Español', 'fr' => 'Français', 'he' => 'עברית', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', ), 'menu' => array( 'about' => 'À propos', @@ -125,6 +144,7 @@ return array( 'sharing' => 'Partage', 'shortcuts' => 'Raccourcis', 'stats' => 'Statistiques', + 'system' => 'Configuration du système', 'update' => 'Mise à jour', 'user_management' => 'Gestion des utilisateurs', 'user_profile' => 'Profil', @@ -139,15 +159,21 @@ return array( 'previous' => 'Précédent', ), 'share' => array( + 'Known' => 'Sites basés sur Known', 'blogotext' => 'Blogotext', 'diaspora' => 'Diaspora*', 'email' => 'Courriel', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', 'print' => 'Imprimer', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', - 'wallabag' => 'wallabag', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', ), 'short' => array( 'attention' => 'Attention !', @@ -157,6 +183,7 @@ return array( 'damn' => 'Arf !', 'default_category' => 'Sans catégorie', 'no' => 'Non', + 'not_applicable' => 'Non disponible', 'ok' => 'Ok !', 'or' => 'ou', 'yes' => 'Oui', diff --git a/app/i18n/fr/index.php b/app/i18n/fr/index.php index 7e028ab92..62eedc280 100644 --- a/app/i18n/fr/index.php +++ b/app/i18n/fr/index.php @@ -6,7 +6,7 @@ return array( 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', 'bugs_reports' => 'Rapports de bugs', '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.', + '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://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.', '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.', 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">sur Github</a>', 'license' => 'Licence', diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php index 245a20c56..09625de78 100644 --- a/app/i18n/fr/install.php +++ b/app/i18n/fr/install.php @@ -4,16 +4,16 @@ return array( 'action' => array( 'finish' => 'Terminer l’installation', 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', + 'keep_install' => 'Garder l’ancienne configuration', 'next_step' => 'Passer à l’étape suivante', + 'reinstall' => 'Réinstaller FreshRSS', ), 'auth' => array( - 'email_persona' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', 'form' => 'Formulaire (traditionnel, requiert JavaScript)', 'http' => 'HTTP (pour utilisateurs avancés avec HTTPS)', 'none' => 'Aucune (dangereux)', 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', 'password_format' => '7 caractères minimum', - 'persona' => 'Mozilla Persona (moderne, requiert JavaScript)', 'type' => 'Méthode d’authentification', ), 'bdd' => array( @@ -24,23 +24,24 @@ return array( 'ok' => 'La configuration de la base de données a été enregistrée.', ), 'host' => 'Hôte', - 'password' => 'Mot de passe', + 'password' => 'Mot de passe pour base de données', 'prefix' => 'Préfixe des tables', 'type' => 'Type de base de données', - 'username' => 'Nom d’utilisateur', + 'username' => 'Nom d’utilisateur pour base de données', ), 'check' => array( '_' => 'Vérifications', + 'already_installed' => 'FreshRSS semble avoir déjà été installé !', 'cache' => array( 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/cache</em>. Le serveur HTTP doit être capable d’écrire dedans', 'ok' => 'Les droits sur le répertoire de cache sont bons.', ), 'ctype' => array( - 'nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype).', - 'ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype).', + 'nok' => 'Impossible de trouver une librairie pour la vérification des types de caractères (php-ctype).', + 'ok' => 'Vous disposez de la librairie pour la vérification des types de caractères (ctype).', ), 'curl' => array( - 'nok' => 'Vous ne disposez pas de cURL (paquet php5-curl).', + 'nok' => 'Vous ne disposez pas de cURL (paquet php-curl).', 'ok' => 'Vous disposez de cURL.', ), 'data' => array( @@ -48,32 +49,36 @@ return array( 'ok' => 'Les droits sur le répertoire de data sont bons.', ), 'dom' => array( - 'nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml).', - 'ok' => 'Vous disposez du nécessaire pour parcourir le DOM.', + 'nok' => 'Impossible de trouver une librairie pour parcourir le DOM.', + 'ok' => 'Vous disposez de la librairie pour parcourir le DOM.', ), 'favicons' => array( 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/favicons</em>. Le serveur HTTP doit être capable d’écrire dedans', 'ok' => 'Les droits sur le répertoire des favicons sont bons.', ), + 'fileinfo' => array( + 'nok' => 'Vous ne disposez pas de PHP fileinfo (paquet fileinfo).', + 'ok' => 'Vous disposez de fileinfo.', + ), 'http_referer' => array( 'nok' => 'Veuillez vérifier que vous ne modifiez pas votre HTTP REFERER.', 'ok' => 'Le HTTP REFERER est connu et semble correspondre à votre serveur.', ), + 'json' => array( + 'nok' => 'Impossible de trouver une librairie recommandée pour JSON.', + 'ok' => 'Vouz disposez de la librairie recommandée pour JSON.', + ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', 'ok' => 'Vous disposez du framework Minz', ), 'pcre' => array( - 'nok' => 'Il manque une librairie pour les expressions régulières (php-pcre).', - 'ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE).', + 'nok' => 'Impossible de trouver une librairie pour les expressions régulières (php-pcre).', + 'ok' => 'Vous disposez de la librairie pour les expressions régulières (PCRE).', ), 'pdo' => array( - 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite).', - 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite).', - ), - 'persona' => array( - 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/persona</em>. Le serveur HTTP doit être capable d’écrire dedans', - 'ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons.', + 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', ), 'php' => array( 'nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s.', @@ -83,6 +88,10 @@ return array( 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/users</em>. Le serveur HTTP doit être capable d’écrire dedans', 'ok' => 'Les droits sur le répertoire des utilisateurs sont bons.', ), + 'xml' => array( + 'nok' => 'Impossible de trouver une librairie requise pour XML.', + 'ok' => 'Vouz disposez de la librairie requise pour XML.', + ), ), 'conf' => array( '_' => 'Configuration générale', @@ -93,6 +102,9 @@ return array( 'delete_articles_after' => 'Supprimer les articles après', 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', + 'js' => array( + 'confirm_reinstall' => 'Réinstaller FreshRSS vous fera perdre la configuration précédente. Êtes-vous sûr de vouloir continuer ?', + ), 'language' => array( '_' => 'Langue', 'choose' => 'Choisissez la langue pour FreshRSS', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index a3f7c4d6d..607863c8f 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -1,6 +1,15 @@ <?php return array( + 'api' => array( + 'documentation' => 'Copier l’URL suivante dans l’outil qui utilisera l’API.', + 'title' => 'API', + ), + 'bookmarklet' => array( + 'documentation' => 'Glisser ce bouton dans la barre des favoris ou cliquer droit dessus et choisir "Enregistrer ce lien". Ensuite, cliquer sur le bouton "S’abonner" sur les pages auxquelles vous voulez vous abonner.', + 'label' => 'S’abonner', + 'title' => 'Bookmarklet', + ), 'category' => array( '_' => 'Catégorie', 'add' => 'Ajouter une catégorie', @@ -35,16 +44,21 @@ return array( 'title_add' => 'Ajouter un flux RSS', 'ttl' => 'Ne pas automatiquement rafraîchir plus souvent que', 'url' => 'URL du flux', - 'validator' => 'Vérifier la valididé du flux', + 'validator' => 'Vérifier la validité du flux', 'website' => 'URL du site', + 'pubsubhubbub' => 'Notification instantanée par PubSubHubbub', + ), + 'firefox' => array( + 'documentation' => 'Suivre les étapes décrites <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">ici</a> pour ajouter FreshRSS à la liste des lecteurs de flux dans Firefox.', + 'title' => 'Lecteur de flux dans Firefox', ), 'import_export' => array( 'export' => 'Exporter', 'export_opml' => 'Exporter la liste des flux (OPML)', 'export_starred' => 'Exporter les favoris', 'feed_list' => 'Liste des articles de %s', - 'file_to_import' => 'Fichier à importer<br />(OPML, Json ou Zip)', - 'file_to_import_no_zip' => 'Fichier à importer<br />(OPML ou Json)', + 'file_to_import' => 'Fichier à importer<br />(OPML, JSON ou ZIP)', + 'file_to_import_no_zip' => 'Fichier à importer<br />(OPML ou JSON)', 'import' => 'Importer', 'starred_list' => 'Liste des articles favoris', 'title' => 'Importer / exporter', @@ -53,9 +67,11 @@ return array( 'bookmark' => 'S’abonner (bookmark FreshRSS)', 'import_export' => 'Importer / exporter', 'subscription_management' => 'Gestion des abonnements', + 'subscription_tools' => 'Outils d’abonnement', ), 'title' => array( '_' => 'Gestion des abonnements', 'feed_management' => 'Gestion des flux RSS', + 'subscription_tools' => 'Outils d’abonnement', ), ); diff --git a/app/i18n/it/admin.php b/app/i18n/it/admin.php new file mode 100644 index 000000000..0248d9317 --- /dev/null +++ b/app/i18n/it/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Consenti la lettura agli utenti anonimi degli articoli dell utente predefinito (%s)', + 'allow_anonymous_refresh' => 'Consenti agli utenti anonimi di aggiornare gli articoli', + 'api_enabled' => 'Consenti le <abbr>API</abbr> di accesso <small>(richiesto per le app mobili)</small>', + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'title' => 'Autenticazione', + 'title_reset' => 'Reset autenticazione', + 'token' => 'Token di autenticazione', + 'token_help' => 'Consenti accesso agli RSS dell utente predefinito senza autenticazione:', + 'type' => 'Metodo di autenticazione', + 'unsafe_autologin' => 'Consenti accesso automatico non sicuro usando il formato: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/cache</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'categories' => array( + 'nok' => 'La tabella delle categorie ha una configurazione errata.', + 'ok' => 'Tabella delle categorie OK.', + ), + 'connection' => array( + 'nok' => 'La connessione al database non può essere stabilita.', + 'ok' => 'Connessione al database OK', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'database' => 'Installazione database', + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM (pacchetto php-xml).', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'entries' => array( + 'nok' => 'La tabella Entry ha una configurazione errata.', + 'ok' => 'Tabella Entry OK.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/favicons</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'feeds' => array( + 'nok' => 'La tabella Feed ha una configurazione errata.', + 'ok' => 'Tabella Feed OK.', + ), + 'fileinfo' => array( + 'nok' => 'Manca il supporto per PHP fileinfo (pacchetto fileinfo).', + 'ok' => 'Estensione fileinfo presente.', + ), + 'files' => 'Installazione files', + 'json' => array( + 'nok' => 'Manca il supoorto a JSON (pacchetto php5-json).', + 'ok' => 'Estensione JSON presente.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione PHP %s, compatibile con FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Rilevate tabelle mancanti nel database.', + 'ok' => 'Tutte le tabelle sono presenti nel database.', + ), + 'title' => 'Verifica installazione', + 'tokens' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/tokens</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella tokens sono corretti.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/users</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + 'zip' => array( + 'nok' => 'Manca estensione ZIP (pacchetto php-zip).', + 'ok' => 'Estensione ZIP presente.', + ), + ), + 'extensions' => array( + 'disabled' => 'Disabilitata', + 'empty_list' => 'Non ci sono estensioni installate', + 'enabled' => 'Abilitata', + 'no_configure_view' => 'Questa estensioni non può essere configurata.', + 'system' => array( + '_' => 'Estensioni di sistema', + 'no_rights' => 'Estensione di sistema (non hai i permessi su questo tipo)', + ), + 'title' => 'Estensioni', + 'user' => 'Estensioni utente', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => 'Statistiche', + 'all_feeds' => 'Tutti i feeds', + 'category' => 'Categoria', + 'entry_count' => 'Articoli', + 'entry_per_category' => 'Articoli per categoria', + 'entry_per_day' => 'Articoli per giorno (ultimi 30 giorni)', + 'entry_per_day_of_week' => 'Per giorno della settimana (media: %.2f articoli)', + 'entry_per_hour' => 'Per ora (media: %.2f articoli)', + 'entry_per_month' => 'Per mese (media: %.2f articoli)', + 'entry_repartition' => 'Ripartizione contenuti', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categoria', + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'main_stream' => 'Flusso principale', + 'menu' => array( + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'repartition' => 'Ripartizione articoli', + ), + 'no_idle' => 'Non ci sono feed non aggiornati', + 'number_entries' => '%d articoli', + 'percent_of_total' => '%% del totale', + 'repartition' => 'Ripartizione articoli', + 'status_favorites' => 'Preferiti', + 'status_read' => 'Letti', + 'status_total' => 'Totale', + 'status_unread' => 'Non letti', + 'title' => 'Statistiche', + 'top_feed' => 'I migliori 10 feeds', + ), + 'system' => array( + '_' => 'Configurazione di sistema', + 'auto-update-url' => 'Auto-update server URL', // @todo translate + 'instance-name' => 'Nome istanza', + 'max-categories' => 'Limite categorie per utente', + 'max-feeds' => 'Limite feeds per utente', + 'registration' => array( + 'help' => '0 significa che non esiste limite sui profili', + 'number' => 'Numero massimo di profili', + ), + ), + 'update' => array( + '_' => 'Aggiornamento sistema', + 'apply' => 'Applica', + 'check' => 'Controlla la presenza di nuovi aggiornamenti', + 'current_version' => 'FreshRSS versione %s.', + 'last' => 'Ultima verifica: %s', + 'none' => 'Nessun aggiornamento da applicare', + 'title' => 'Aggiorna sistema', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'create' => 'Crea nuovo utente', + 'language' => 'Lingua', + 'number' => ' %d profilo utente creato', + 'numbers' => 'Sono presenti %d profili utente', + 'password_form' => 'Password<br /><small>(per il login classico)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Gestione utenti', + 'user_list' => 'Lista utenti', + 'username' => 'Nome utente', + 'users' => 'Utenti', + ), +); diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php new file mode 100644 index 000000000..15837ae8a --- /dev/null +++ b/app/i18n/it/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archiviazione', + 'advanced' => 'Avanzate', + 'delete_after' => 'Rimuovi articoli dopo', + 'help' => 'Altre opzioni sono disponibili nelle impostazioni dei singoli feed', + 'keep_history_by_feed' => 'Numero minimo di articoli da mantenere per feed', + 'optimize' => 'Ottimizza database', + 'optimize_help' => 'Da fare occasionalmente per ridurre le dimensioni del database', + 'purge_now' => 'Cancella ora', + 'title' => 'Archiviazione', + 'ttl' => 'Non effettuare aggiornamenti per più di', + ), + 'display' => array( + '_' => 'Visualizzazione', + 'icon' => array( + 'bottom_line' => 'Barra in fondo', + 'entry' => 'Icone degli articoli', + 'publication_date' => 'Data di pubblicazione', + 'related_tags' => 'Tags correlati', + 'sharing' => 'Condivisione', + 'top_line' => 'Barra in alto', + ), + 'language' => 'Lingua', + 'notif_html5' => array( + 'seconds' => 'secondi (0 significa nessun timeout)', + 'timeout' => 'Notifica timeout HTML5', + ), + 'theme' => 'Tema', + 'title' => 'Visualizzazione', + 'width' => array( + 'content' => 'Larghezza contenuto', + 'large' => 'Largo', + 'medium' => 'Medio', + 'no_limit' => 'Nessun limite', + 'thin' => 'Stretto', + ), + ), + 'query' => array( + '_' => 'Ricerche personali', + 'deprecated' => 'Questa query non è più valida. La categoria o il feed di riferimento non stati cancellati.', + 'filter' => 'Filtro applicato:', + 'get_all' => 'Mostra tutti gli articoli', + 'get_category' => 'Mostra la categoria "%s" ', + 'get_favorite' => 'Mostra articoli preferiti', + 'get_feed' => 'Mostra feed "%s" ', + 'no_filter' => 'Nessun filtro', + 'none' => 'Non hai creato nessuna ricerca personale.', + 'number' => 'Ricerca n°%d', + 'order_asc' => 'Mostra prima gli articoli più vecchi', + 'order_desc' => 'Mostra prima gli articoli più nuovi', + 'search' => 'Cerca per "%s"', + 'state_0' => 'Mostra tutti gli articoli', + 'state_1' => 'Mostra gli articoli letti', + 'state_2' => 'Mostra gli articoli non letti', + 'state_3' => 'Mostra tutti gli articoli', + 'state_4' => 'Mostra gli articoli preferiti', + 'state_5' => 'Mostra gli articoli preferiti letti', + 'state_6' => 'Mostra gli articoli preferiti non letti', + 'state_7' => 'Mostra gli articoli preferiti', + 'state_8' => 'Non mostrare gli articoli preferiti', + 'state_9' => 'Mostra gli articoli letti non preferiti', + 'state_10' => 'Mostra gli articoli non letti e non preferiti', + 'state_11' => 'Non mostrare gli articoli preferiti', + 'state_12' => 'Mostra tutti gli articoli', + 'state_13' => 'Mostra gli articoli letti', + 'state_14' => 'Mostra gli articoli non letti', + 'state_15' => 'Mostra tutti gli articoli', + 'title' => 'Ricerche personali', + ), + 'profile' => array( + '_' => 'Gestione profili', + 'delete' => array( + '_' => 'Cancellazione account', + 'warn' => 'Il tuo account e tutti i dati associati saranno cancellati.', + ), + 'password_api' => 'Password API<br /><small>(e.g., per applicazioni mobili)</small>', + 'password_form' => 'Password<br /><small>(per il login classico)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Profilo', + ), + 'reading' => array( + '_' => 'Lettura', + 'after_onread' => 'Dopo “segna tutto come letto”,', + 'articles_per_page' => 'Numero di articoli per pagina', + 'auto_load_more' => 'Carica articoli successivi a fondo pagina', + 'auto_remove_article' => 'Nascondi articoli dopo la lettura', + 'mark_updated_article_unread' => 'Segna articoli aggiornati come non letti', + 'confirm_enabled' => 'Mostra una conferma per “segna tutto come letto”', + 'display_articles_unfolded' => 'Mostra articoli aperti di predefinito', + 'display_categories_unfolded' => 'Mostra categorie aperte di predefinito', + 'hide_read_feeds' => 'Nascondi categorie e feeds con articoli già letti (non funziona se “Mostra tutti gli articoli” è selezionato)', + 'img_with_lazyload' => 'Usa la modalità "caricamento ritardato" per le immagini', + 'sides_close_article' => 'Clicking outside of article text area closes the article', //TODO + 'jump_next' => 'Salta al successivo feed o categoria non letto', + 'number_divided_when_reader' => 'Diviso 2 nella modalità di lettura.', + 'read' => array( + 'article_open_on_website' => 'Quando un articolo è aperto nel suo sito di origine', + 'article_viewed' => 'Quando un articolo viene letto', + 'scroll' => 'Scorrendo la pagina', + 'upon_reception' => 'Alla ricezione del contenuto', + 'when' => 'Segna articoli come letti…', + ), + 'show' => array( + '_' => 'Articoli da visualizzare', + 'adaptive' => 'Adatta visualizzazione', + 'all_articles' => 'Mostra tutti gli articoli', + 'unread' => 'Mostra solo non letti', + ), + 'sort' => array( + '_' => 'Ordinamento', + 'newer_first' => 'Prima i più recenti', + 'older_first' => 'Prima i più vecchi', + ), + 'sticky_post' => 'Blocca il contenuto a inizio pagina quando aperto', + 'title' => 'Lettura', + 'view' => array( + 'default' => 'Visualizzazione predefinita', + 'global' => 'Vista globale per categorie', + 'normal' => 'Vista elenco', + 'reader' => 'Modalità di lettura', + ), + ), + 'sharing' => array( + '_' => 'Condivisione', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Ulteriori informazioni', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'share_name' => 'Nome condivisione', + 'share_url' => 'URL condivisione', + 'title' => 'Condividi', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Comandi tastiera', + 'article_action' => 'Azioni sugli articoli', + 'auto_share' => 'Condividi', + 'auto_share_help' => 'Se è presente un solo servizio di condivisione verrà usato quello, altrimenti usare anche il numero associato.', + 'close_dropdown' => 'Chiudi menù', + 'collapse_article' => 'Collassa articoli', + 'first_article' => 'Salta al primo articolo', + 'focus_search' => 'Modulo di ricerca', + 'help' => 'Mostra documentazione', + 'javascript' => 'JavaScript deve essere abilitato per poter usare i comandi da tastiera', + 'last_article' => 'Salta all ultimo articolo', + 'load_more' => 'Carica altri articoli', + 'mark_read' => 'Segna come letto', + 'mark_favorite' => 'Segna come preferito', + 'navigation' => 'Navigazione', + 'navigation_help' => 'Con il tasto "Shift" i comandi di navigazione verranno applicati ai feeds.<br/>Con il tasto "Alt" i comandi di navigazione verranno applicati alle categorie.', + 'next_article' => 'Salta al contenuto successivo', + 'other_action' => 'Altre azioni', + 'previous_article' => 'Salta al contenuto precedente', + 'see_on_website' => 'Vai al sito fonte', + 'shift_for_all_read' => '+ <code>shift</code> per segnare tutti gli articoli come letti', + 'title' => 'Comandi da tastiera', + 'user_filter' => 'Accedi alle ricerche personali', + 'user_filter_help' => 'Se è presente una sola ricerca personale verrà usata quella, altrimenti usare anche il numero associato.', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'current' => 'Utente connesso', + 'is_admin' => 'è amministratore', + 'users' => 'Utenti', + ), +); diff --git a/app/i18n/it/feedback.php b/app/i18n/it/feedback.php new file mode 100644 index 000000000..8f3cf3ed6 --- /dev/null +++ b/app/i18n/it/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Ottimizzazione completata', + ), + 'access' => array( + 'denied' => 'Non hai i permessi per accedere a questa pagina', + 'not_found' => 'Pagina non disponibile', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Si è verificato un problema alla configurazione del sistema di autenticazione. Per favore riprova più tardi.', + 'set' => 'Sistema di autenticazione tramite Form impostato come predefinito.', + ), + 'login' => array( + 'invalid' => 'Autenticazione non valida', + 'success' => 'Autenticazione effettuata', + ), + 'logout' => array( + 'success' => 'Disconnessione effettuata', + ), + 'no_password_set' => 'Password di amministrazione non impostata. Opzione non disponibile.', + ), + 'conf' => array( + 'error' => 'Si è verificato un errore durante il salvataggio della configurazione', + 'query_created' => 'Ricerca "%s" creata.', + 'shortcuts_updated' => 'Collegamenti tastiera aggiornati', + 'updated' => 'Configurazione aggiornata', + ), + 'extensions' => array( + 'already_enabled' => '%s è già abilitata', + 'disable' => array( + 'ko' => '%s non può essere disabilitata. <a href="%s">Verifica i logs</a> per dettagli.', + 'ok' => '%s è disabilitata', + ), + 'enable' => array( + 'ko' => '%s non può essere abilitata. <a href="%s">Verifica i logs</a> per dettagli.', + 'ok' => '%s è ora abilitata', + ), + 'no_access' => 'Accesso negato a %s', + 'not_enabled' => '%s non abilitato', + 'not_found' => '%s non disponibile', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Estensione ZIP non presente sul server. Per favore esporta i files singolarmente.', + 'feeds_imported' => 'I tuoi feed sono stati importati e saranno aggiornati', + 'feeds_imported_with_errors' => 'I tuoi feeds sono stati importati ma si sono verificati alcuni errori', + 'file_cannot_be_uploaded' => 'Il file non può essere caricato!', + 'no_zip_extension' => 'Estensione ZIP non presente sul server.', + 'zip_error' => 'Si è verificato un errore importando il file ZIP', + ), + 'sub' => array( + 'actualize' => 'Aggiorna', + 'category' => array( + 'created' => 'Categoria %s creata.', + 'deleted' => 'Categoria cancellata', + 'emptied' => 'Categoria svuotata', + 'error' => 'Categoria non aggiornata', + 'name_exists' => 'Categoria già esistente.', + 'no_id' => 'Categoria senza ID.', + 'no_name' => 'Il nome della categoria non può essere lasciato vuoto.', + 'not_delete_default' => 'Non puoi cancellare la categoria predefinita!', + 'not_exist' => 'La categoria non esite!', + 'over_max' => 'Hai raggiunto il numero limite di categorie (%d)', + 'updated' => 'Categoria aggiornata.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> aggiornato', + 'actualizeds' => 'RSS feeds aggiornati', + 'added' => 'RSS feed <em>%s</em> aggiunti', + 'already_subscribed' => 'Hai già sottoscritto <em>%s</em>', + 'deleted' => 'Feed cancellato', + 'error' => 'Feed non aggiornato', + 'internal_problem' => 'RSS feed non aggiunto. <a href="%s">Verifica i logs</a> per dettagli.', + 'invalid_url' => 'URL <em>%s</em> non valido', + 'marked_read' => 'Feeds segnati come letti', + 'n_actualized' => '%d feeds aggiornati', + 'n_entries_deleted' => '%d articoli cancellati', + 'no_refresh' => 'Nessun aggiornamento disponibile…', + 'not_added' => '<em>%s</em> non può essere aggiunto', + 'over_max' => 'Hai raggiunto il numero limite di feed (%d)', + 'updated' => 'Feed aggiornato', + ), + 'purge_completed' => 'Svecchiamento completato (%d articoli cancellati)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS verrà aggiornato alla <strong>versione %s</strong>.', + 'error' => 'Il processo di aggiornamento ha riscontrato il seguente errore: %s', + 'file_is_nok' => 'Nuova <strong>versione %s</strong>, ma verifica i permessi della cartella <em>%s</em>. Il server HTTP deve avere i permessi per la scrittura ', + 'finished' => 'Aggiornamento completato con successo!', + 'none' => 'Nessun aggiornamento disponibile', + 'server_not_found' => 'Server per aggiornamento non disponibile. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Utente %s creato', + 'error' => 'Errore nella creazione utente %s ', + ), + 'deleted' => array( + '_' => 'Utente %s cancellato', + 'error' => 'Utente %s non cancellato', + ), + ), + 'profile' => array( + 'error' => 'Il tuo profilo non può essere modificato', + 'updated' => 'Il tuo profilo è stato modificato', + ), +); diff --git a/app/i18n/it/gen.php b/app/i18n/it/gen.php new file mode 100644 index 000000000..9eaabc2be --- /dev/null +++ b/app/i18n/it/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Aggiorna', + 'back_to_rss_feeds' => '← Indietro', + 'cancel' => 'Annulla', + 'create' => 'Crea', + 'disable' => 'Disabilita', + 'empty' => 'Vuoto', + 'enable' => 'Abilita', + 'export' => 'Esporta', + 'filter' => 'Filtra', + 'import' => 'Importa', + 'manage' => 'Gestisci', + 'mark_favorite' => 'Segna come preferito', + 'mark_read' => 'Segna come letto', + 'remove' => 'Rimuovi', + 'see_website' => 'Vai al sito', + 'submit' => 'Conferma', + 'truncate' => 'Cancella tutti gli articoli', + ), + 'auth' => array( + 'email' => 'Indirizzo email', + 'keep_logged_in' => 'Ricorda i dati <small>(%s giorni)</small>', + 'login' => 'Accedi', + 'logout' => 'Esci', + 'password' => array( + '_' => 'Password', + 'format' => '<small>almeno 7 caratteri</small>', + ), + 'registration' => array( + '_' => 'Nuovo profilo', + 'ask' => 'Vuoi creare un nuovo profilo?', + 'title' => 'Creazione profilo', + ), + 'reset' => 'Reset autenticazione', + 'username' => array( + '_' => 'Username', + 'admin' => 'Username amministratore', + 'format' => '<small>massimo 16 caratteri alfanumerici</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l\\e', + 'Aug' => '\\A\\g\\o\\s\\t\\o', + 'Dec' => '\\D\\i\\c\\e\\m\\b\\r\\e', + 'Feb' => '\\F\\e\\b\\b\\r\\a\\i\\o', + 'Jan' => '\\G\\e\\n\\u\\a\\i\\o', + 'Jul' => '\\L\\u\\g\\l\\i\\o', + 'Jun' => '\\G\\i\\u\\g\\n\\o', + 'Mar' => '\\M\\a\\r\\z\\o', + 'May' => '\\M\\a\\g\\g\\i\\o', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\r\\e', + 'Oct' => '\\O\\t\\t\\o\\b\\r\\e', + 'Sep' => '\\S\\e\\t\\t\\e\\m\\b\\r\\e', + 'apr' => 'apr.', + 'april' => 'aprile', + 'aug' => 'ag.', + 'august' => 'agosto', + 'before_yesterday' => 'Meno recenti', + 'dec' => 'dic.', + 'december' => 'dicembre', + 'feb' => 'febbr.', + 'february' => 'febbraio', + 'format_date' => 'j\\ %s Y', + 'format_date_hour' => 'j\\ %s Y \\o\\r\\e H\\:i', + 'fri' => 'Fri', + 'jan' => 'genn.', + 'january' => 'gennaio', + 'jul' => 'jul', + 'july' => 'luglio', + 'jun' => 'jun', + 'june' => 'giugno', + 'last_3_month' => 'Ultimi 3 mesi', + 'last_6_month' => 'Ultimi 6 mesi', + 'last_month' => 'Ultimo mese', + 'last_week' => 'Ultima settimana', + 'last_year' => 'Ultimo anno', + 'mar' => 'mar.', + 'march' => 'marzo', + 'may' => 'maggio', + 'may_' => 'May', + 'mon' => 'Mon', + 'month' => 'mesi', + 'nov' => 'nov.', + 'november' => 'novembre', + 'oct' => 'ott.', + 'october' => 'ottobre', + 'sat' => 'Sat', + 'sep' => 'sett.', + 'september' => 'settembre', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Oggi', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Ieri', + ), + 'freshrss' => array( + '_' => 'Feed RSS Reader', + 'about' => 'Informazioni', + ), + 'js' => array( + 'category_empty' => 'Categoria vuota', + 'confirm_action' => 'Sei sicuro di voler continuare?', + 'confirm_action_feed_cat' => 'Sei sicuro di voler continuare? Verranno persi i preferiti e le ricerche utente correlate!', + 'feedback' => array( + 'body_new_articles' => 'Ci sono %%d nuovi articoli da leggere.', + 'request_failed' => 'Richiesta fallita, probabilmente a causa di problemi di connessione', + 'title_new_articles' => 'Feed RSS Reader: nuovi articoli!', + ), + 'new_article' => 'Sono disponibili nuovi articoli, clicca qui per caricarli.', + 'should_be_activated' => 'JavaScript deve essere abilitato', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'admin' => 'Amministrazione', + 'archiving' => 'Archiviazione', + 'authentication' => 'Autenticazione', + 'check_install' => 'Installazione', + 'configuration' => 'Configurazione', + 'display' => 'Visualizzazione', + 'extensions' => 'Estensioni', + 'logs' => 'Logs', + 'queries' => 'Ricerche personali', + 'reading' => 'Lettura', + 'search' => 'Ricerca parole o #tags', + 'sharing' => 'Condivisione', + 'shortcuts' => 'Comandi tastiera', + 'stats' => 'Statistiche', + 'system' => 'Configurazione sistema', + 'update' => 'Aggiornamento', + 'user_management' => 'Gestione utenti', + 'user_profile' => 'Profilo', + ), + 'pagination' => array( + 'first' => 'Prima', + 'last' => 'Ultima', + 'load_more' => 'Carica altri articoli', + 'mark_all_read' => 'Segna tutto come letto', + 'next' => 'Successiva', + 'nothing_to_load' => 'Non ci sono altri articoli', + 'previous' => 'Precedente', + ), + 'share' => array( + 'Known' => 'Siti basati su Known', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Attenzione!', + 'blank_to_disable' => 'Lascia vuoto per disabilitare', + 'by_author' => 'di <em>%s</em>', + 'by_default' => 'predefinito', + 'damn' => 'Ops!', + 'default_category' => 'Senza categoria', + 'no' => 'No', + 'not_applicable' => 'Non disponibile', + 'ok' => 'OK!', + 'or' => 'o', + 'yes' => 'Si', + ), +); diff --git a/app/i18n/it/index.php b/app/i18n/it/index.php new file mode 100644 index 000000000..d79502c79 --- /dev/null +++ b/app/i18n/it/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Informazioni', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bugs', + 'credits' => 'Crediti', + 'credits_content' => 'Alcuni elementi di design provengono da <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> sebbene FreshRSS non usi questo framework. Le <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icone</a> provengono dal progetto <a href="https://www.gnome.org/">GNOME</a>. Il carattere <em>Open Sans</em> è stato creato da <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS è basato su <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.', + 'freshrss_description' => 'FreshRSS è un aggregatore di feeds RSS da installare sul proprio host come <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> o <a href="http://projet.idleman.fr/leed/">Leed</a>. Leggero e facile da mantenere pur essendo molto configurabile e potente.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">su Github</a>', + 'license' => 'Licenza', + 'project_website' => 'Sito del progetto', + 'title' => 'Informazioni', + 'version' => 'Versione', + 'website' => 'Sito', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'empty' => 'Non ci sono articoli da mostrare.', + 'rss_of' => 'RSS feed di %s', + 'title' => 'RSS feeds', + 'title_global' => 'Vista globale per categorie', + 'title_fav' => 'Preferiti', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Svuota logs', + 'empty' => 'File di log vuoto', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'add_query' => 'Aggiungi ricerca', + 'before_one_day' => 'Giorno precedente', + 'before_one_week' => 'Settimana precedente', + 'favorites' => 'Preferiti (%s)', + 'global_view' => 'Vista globale per categorie', + 'main_stream' => 'Flusso principale', + 'mark_all_read' => 'Segna tutto come letto', + 'mark_cat_read' => 'Segna la categoria come letta', + 'mark_feed_read' => 'Segna il feed come letto', + 'newer_first' => 'Mostra prima i recenti', + 'non-starred' => 'Escludi preferiti', + 'normal_view' => 'Vista elenco', + 'older_first' => 'Ordina per meno recenti', + 'queries' => 'Chiavi di ricerca', + 'read' => 'Mostra solo letti', + 'reader_view' => 'Modalità di lettura', + 'rss_view' => 'RSS feed', + 'search_short' => 'Cerca', + 'starred' => 'Mostra solo preferiti', + 'stats' => 'Statistiche', + 'subscription' => 'Gestione sottoscrizioni', + 'unread' => 'Mostra solo non letti', + ), + 'share' => 'Condividi', + 'tag' => array( + 'related' => 'Tags correlati', + ), +); diff --git a/app/i18n/it/install.php b/app/i18n/it/install.php new file mode 100644 index 000000000..18f8cc337 --- /dev/null +++ b/app/i18n/it/install.php @@ -0,0 +1,120 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Installazione completata', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'keep_install' => 'Mantieni configurazione precedente', + 'next_step' => 'Vai al prossimo passaggio', + 'reinstall' => 'Reinstalla FreshRSS', + ), + 'auth' => array( + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'password_form' => 'Password<br /><small>(per il login tramite Web-form tradizionale)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'type' => 'Metodo di autenticazione', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Configurazione database', + 'ko' => 'Verifica le informazioni del database.', + 'ok' => 'Le configurazioni del database sono state salvate.', + ), + 'host' => 'Host', + 'prefix' => 'Prefisso tabella', + 'password' => 'Password del database', + 'type' => 'Tipo di database', + 'username' => 'Nome utente del database', + ), + 'check' => array( + '_' => 'Controlli', + 'already_installed' => 'FreshRSS risulta già installato!', + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/cache</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM.', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/favicons</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'fileinfo' => array( + 'nok' => 'Manca il supporto per PHP fileinfo (pacchetto fileinfo).', + 'ok' => 'Estensione fileinfo presente.', + ), + 'http_referer' => array( + 'nok' => 'Per favore verifica che non stai alterando il tuo HTTP REFERER.', + 'ok' => 'Il tuo HTTP REFERER riconosciuto corrisponde al tuo server.', + ), + 'json' => array( + 'nok' => 'You lack a recommended library to parse JSON.', + 'ok' => 'You have a recommended library to parse JSON.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione di PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione di PHP %s, compatibile con FreshRSS.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/users</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + 'xml' => array( + 'nok' => 'You lack the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), + ), + 'conf' => array( + '_' => 'Configurazioni generali', + 'ok' => 'Configurazioni generali salvate.', + ), + 'congratulations' => 'Congratulazione!', + 'default_user' => 'Username utente predefinito <small>(massimo 16 caratteri alfanumerici)</small>', + 'delete_articles_after' => 'Rimuovi articoli dopo', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'javascript_is_better' => 'FreshRSS funziona meglio con JavaScript abilitato', + 'js' => array( + 'confirm_reinstall' => 'Reinstallando FreshRSS perderai la configurazione precedente. Sei sicuro di voler procedere?', + ), + 'language' => array( + '_' => 'Lingua', + 'choose' => 'Seleziona la lingua per FreshRSS', + 'defined' => 'Lingua impostata.', + ), + 'not_deleted' => 'Qualcosa non ha funzionato; devi cancellare il file <em>%s</em> manualmente.', + 'ok' => 'Processo di installazione terminato con successo.', + 'step' => 'Passaggio %d', + 'steps' => 'Passaggi', + 'title' => 'Installazione · FreshRSS', + 'this_is_the_end' => 'Fine', +); diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php new file mode 100644 index 000000000..fe18855fb --- /dev/null +++ b/app/i18n/it/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), + 'category' => array( + '_' => 'Categoria', + 'add' => 'Aggiungi una categoria', + 'empty' => 'Categoria vuota', + 'new' => 'Nuova categoria', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'advanced' => 'Avanzate', + 'archiving' => 'Archiviazione', + 'auth' => array( + 'configuration' => 'Autenticazione', + 'help' => 'Accesso per feeds protetti', + 'http' => 'Autenticazione HTTP', + 'password' => 'HTTP password', + 'username' => 'HTTP username', + ), + 'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)', + 'css_path' => 'Percorso del foglio di stile CSS del sito di origine', + 'description' => 'Descrizione', + 'empty' => 'Questo feed non contiene articoli. Per favore verifica il sito direttamente.', + 'error' => 'Questo feed ha generato un errore. Per favore verifica se ancora disponibile.', + 'in_main_stream' => 'Mostra in homepage', + 'informations' => 'Informazioni', + 'keep_history' => 'Numero minimo di articoli da mantenere', + 'moved_category_deleted' => 'Cancellando una categoria i feed al suo interno verranno classificati automaticamente come <em>%s</em>.', + 'no_selected' => 'Nessun feed selezionato.', + 'number_entries' => '%d articoli', + 'stats' => 'Statistiche', + 'think_to_add' => 'Aggiungi feed.', + 'title' => 'Titolo', + 'title_add' => 'Aggiungi RSS feed', + 'ttl' => 'Non aggiornare automaticamente piu di', + 'url' => 'Feed URL', + 'validator' => 'Controlla la validita del feed ', + 'website' => 'URL del sito', + 'pubsubhubbub' => 'Notifica istantanea con PubSubHubbub', + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.',// TODO + 'title' => 'Firefox feed reader',// TODO + ), + 'import_export' => array( + 'export' => 'Esporta', + 'export_opml' => 'Esporta tutta la lista dei feed (OPML)', + 'export_starred' => 'Esporta i tuoi preferiti', + 'feed_list' => 'Elenco di %s articoli', + 'file_to_import' => 'File da importare<br />(OPML, JSON o ZIP)', + 'file_to_import_no_zip' => 'File da importare<br />(OPML o JSON)', + 'import' => 'Importa', + 'starred_list' => 'Elenco articoli preferiti', + 'title' => 'Importa / esporta', + ), + 'menu' => array( + 'bookmark' => 'Bookmark (trascina nei preferiti)', + 'import_export' => 'Importa / esporta', + 'subscription_management' => 'Gestione sottoscrizioni', + 'subscription_tools' => 'Subscription tools',// TODO + ), + 'title' => array( + '_' => 'Gestione sottoscrizioni', + 'feed_management' => 'Gestione RSS feeds', + 'subscription_tools' => 'Subscription tools',// TODO + ), +); diff --git a/app/i18n/kr/admin.php b/app/i18n/kr/admin.php new file mode 100644 index 000000000..9781fb640 --- /dev/null +++ b/app/i18n/kr/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => '누구나 기본 사용자의 글을 읽을 수 있도록 합니다(%s)', + 'allow_anonymous_refresh' => '누구나 피드를 갱신할 수 있도록 합니다', + 'api_enabled' => '<abbr>API</abbr> 사용을 허가합니다<small>(모바일 애플리케이션을 사용할 때 필요합니다)</small>', + 'form' => '웹폼 (전통적인 방식, 자바스크립트 필요)', + 'http' => 'HTTP (HTTPS를 사용하는 고급 사용자용)', + 'none' => '사용하지 않음 (위험)', + 'title' => '인증', + 'title_reset' => '인증 초기화', + 'token' => '인증 토큰', + 'token_help' => '기본 사용자의 RSS에 인증 없이 접근할 수 있도록 합니다:', + 'type' => '인증', + 'unsafe_autologin' => '다음과 같은 안전하지 않은 방식의 로그인을 허가합니다: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => '<em>./data/cache</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'cache 디렉토리의 권한이 올바르게 설정되었습니다.', + ), + 'categories' => array( + 'nok' => 'category 테이블 설정이 잘못되었습니다.', + 'ok' => 'category 테이블이 올바르게 설정되었습니다.', + ), + 'connection' => array( + 'nok' => '데이터베이스에 연결할 수 없습니다.', + 'ok' => '데이터베이스와의 연결이 올바르게 설정되었습니다.', + ), + 'ctype' => array( + 'nok' => '문자열 타입 검사에 필요한 라이브러리를 찾을 수 없습니다 (php-ctype).', + 'ok' => '문자열 타입 검사에 필요한 라이브러리가 설치되어 있습니다 (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL 라이브러리를 찾을 수 없습니다 (php-curl 패키지).', + 'ok' => 'cURL 라이브러리가 설치되어 있습니다.', + ), + 'data' => array( + 'nok' => '<em>./data</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'data 디렉토리의 권한이 올바르게 설정되었습니다.', + ), + 'database' => '데이터베이스 설치 요구사항', + 'dom' => array( + 'nok' => 'DOM을 다룰 수 있는 라이브러리를 찾을 수 없습니다 (php-xml 패키지).', + 'ok' => 'DOM을 다룰 수 있는 라이브러리가 설치되어 있습니다.', + ), + 'entries' => array( + 'nok' => 'entry 테이블 설정이 잘못되었습니다.', + 'ok' => 'entry 테이블이 올바르게 설정되었습니다.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'favicons 디렉토리의 권한이 올바르게 설정되어 있습니다.', + ), + 'feeds' => array( + 'nok' => 'feed 테이블 설정이 잘못되었습니다.', + 'ok' => 'feed 테이블이 올바르게 설정되었습니다', + ), + 'fileinfo' => array( + 'nok' => 'fileinfo 라이브러리를 찾을 수 없습니다 (fileinfo 패키지).', + 'ok' => 'fileinfo 라이브러리가 설치되어 있습니다.', + ), + 'files' => '파일 시스템 설치 요구사항', + 'json' => array( + 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php5-json 패키지).', + 'ok' => 'JSON 확장 기능이 설치되어 있습니다.', + ), + 'minz' => array( + 'nok' => 'Minz 프레임워크를 찾을 수 없습니다.', + 'ok' => 'Minz 프레임워크가 설치되어 있습니다.', + ), + 'pcre' => array( + 'nok' => '정규표현식을 위한 라이브러리를 찾을 수 없습니다 (php-pcre).', + 'ok' => '정규표현식을 위한 라이브러리가 설치되어 있습니다 (PCRE).', + ), + 'pdo' => array( + 'nok' => '지원가능한 드라이버나 PDO를 찾을 수 없습니다 (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => '최소 하나의 지원가능한 드라이버와 PDO가 설치되어 있습니다 (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP 설치 요구사항', + 'nok' => 'PHP 버전은 %s 이지만, FreshRSS에는 최소 %s의 버전이 필요합니다.', + 'ok' => 'PHP 버전은 %s 이고, FreshRSS와 호환가능 합니다.', + ), + 'tables' => array( + 'nok' => '하나 이상의 테이블을 데이터베이스에서 찾을 수 없습니다.', + 'ok' => '데이터베이스에 모든 테이블이 존재합니다.', + ), + 'title' => '설치 요구사항 확인', + 'tokens' => array( + 'nok' => '<em>./data/tokens</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'tokens 디렉토리의 권한이 올바르게 설정되어 있습니다', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'users 디렉토리의 권한이 올바르게 설정되어 있습니다.', + ), + 'zip' => array( + 'nok' => 'ZIP 확장 기능을 찾을 수 없습니다 (php-zip 패키지).', + 'ok' => 'ZIP 확장 기능이 설치되어 있습니다.', + ), + ), + 'extensions' => array( + 'disabled' => '비활성화됨', + 'empty_list' => '설치된 확장 기능이 없습니다', + 'enabled' => '활성화됨', + 'no_configure_view' => '이 확장 기능은 설정이 없습니다.', + 'system' => array( + '_' => '시스템 확장 기능', + 'no_rights' => '시스템 확장 기능 (이 확장 기능에 대한 권한이 없습니다)', + ), + 'title' => '확장 기능', + 'user' => '사용자 확장 기능', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => '통계', + 'all_feeds' => '모든 피드', + 'category' => '카테고리', + 'entry_count' => '글 개수', + 'entry_per_category' => '카테고리별 글 개수', + 'entry_per_day' => '일일 글 개수 (최근 30 일)', + 'entry_per_day_of_week' => '요일별 (평균: %.2f 개의 글)', + 'entry_per_hour' => '시간별 (평균: %.2f 개의 글)', + 'entry_per_month' => '월별 (평균: %.2f 개의 글)', + 'entry_repartition' => '글 분류', + 'feed' => '피드', + 'feed_per_category' => '카테고리별 피드 개수', + 'idle' => '유휴 피드', + 'main' => '주요 통계', + 'main_stream' => '메인 스트림', + 'menu' => array( + 'idle' => '유휴 피드', + 'main' => '주요 통계', + 'repartition' => '글 분류', + ), + 'no_idle' => '유휴 피드가 없습니다!', + 'number_entries' => '%d 개의 글', + 'percent_of_total' => '전체에서의 비율 (%%)', + 'repartition' => '글 분류', + 'status_favorites' => '즐겨찾기', + 'status_read' => '읽음', + 'status_total' => '전체', + 'status_unread' => '읽지 않음', + 'title' => '통계', + 'top_feed' => '상위 10 개 피드', + ), + 'system' => array( + '_' => '시스템 설정', + 'auto-update-url' => '자동 업데이트 서버 URL', + 'instance-name' => '인스턴스 이름', + 'max-categories' => '사용자별 카테고리 개수 제한', + 'max-feeds' => '사용자별 피드 개수 제한', + 'registration' => array( + 'help' => '0: 제한 없음', + 'number' => '계정 최대 개수', + ), + ), + 'update' => array( + '_' => '업데이트', + 'apply' => '업데이트 적용하기', + 'check' => '새 업데이트 확인하기', + 'current_version' => '현재 FreshRSS 버전은 %s 입니다.', + 'last' => '마지막 확인: %s', + 'none' => '적용 가능한 업데이트가 없습니다', + 'title' => '업데이트', + ), + 'user' => array( + 'articles_and_size' => '%s 개의 글 (%s)', + 'create' => '새 사용자 생성', + 'language' => '언어', + 'number' => '%d 개의 계정이 생성되었습니다', + 'numbers' => '%d 개의 계정이 생성되었습니다', + 'password_form' => '암호<br /><small>(웹폼 로그인 방식 사용시)</small>', + 'password_format' => '7 글자 이상이어야 합니다', + 'title' => '사용자 관리', + 'user_list' => '사용자 목록', + 'username' => '사용자 이름', + 'users' => '전체 사용자', + ), +); diff --git a/app/i18n/kr/conf.php b/app/i18n/kr/conf.php new file mode 100644 index 000000000..35d412078 --- /dev/null +++ b/app/i18n/kr/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => '보관', + 'advanced' => '고급 설정', + 'delete_after' => '다음 기간보다 오래된 글 삭제', + 'help' => '더 자세한 옵션은 개별 피드 설정에 있습니다', + 'keep_history_by_feed' => '피드별 최소 유지 글 개수', + 'optimize' => '데이터베이스 최적화', + 'optimize_help' => '데이터베이스 크기를 줄이기 위해 가끔씩 수행해주세요', + 'purge_now' => '지금 삭제', + 'title' => '보관', + 'ttl' => '다음 시간이 지나기 전에 새로고침 금지', + ), + 'display' => array( + '_' => '표시', + 'icon' => array( + 'bottom_line' => '하단', + 'entry' => '문서 아이콘', + 'publication_date' => '발행일', + 'related_tags' => '관련 태그', + 'sharing' => '공유', + 'top_line' => '상단', + ), + 'language' => '언어', + 'notif_html5' => array( + 'seconds' => '초 (0: 타임아웃 없음)', + 'timeout' => 'HTML5 알림 타임아웃', + ), + 'theme' => '테마', + 'title' => '표시', + 'width' => array( + 'content' => '내용 표시 너비', + 'large' => '넓음', + 'medium' => '보통', + 'no_limit' => '제한 없음', + 'thin' => '얇음', + ), + ), + 'query' => array( + '_' => '사용자 쿼리', + 'deprecated' => '이 쿼리는 더 이상 유효하지 않습니다. 해당하는 카테고리나 피드가 삭제되었습니다.', + 'filter' => '적용된 필터:', + 'get_all' => '모든 글 표시', + 'get_category' => '"%s" 카테고리 표시', + 'get_favorite' => '즐겨찾기에 등록된 글 표시', + 'get_feed' => '"%s" 피드 표시', + 'no_filter' => '필터가 없습니다', + 'none' => '아직 사용자 쿼리를 만들지 않았습니다.', + 'number' => '쿼리 #%d', + 'order_asc' => '오래된 글 먼저 표시', + 'order_desc' => '최근 글 먼저 표시', + 'search' => '"%s"의 검색 결과', + 'state_0' => '모든 글 표시', + 'state_1' => '읽은 글 표시', + 'state_2' => '읽지 않은 글 표시', + 'state_3' => '모든 글 표시', + 'state_4' => '즐겨찾기에 등록된 글 표시', + 'state_5' => '즐겨찾기에 등록된 읽은 글 표시', + 'state_6' => '즐겨찾기에 등록된 읽지 않은 글 표시', + 'state_7' => '즐겨찾기에 등록된 글 표시', + 'state_8' => '즐겨찾기에 등록되지 않은 글 표시', + 'state_9' => '즐겨찾기에 등록되지 않고 읽은 글 표시', + 'state_10' => '즐겨찾기에 등록되지 않고 읽지 않은 글 표시', + 'state_11' => '즐겨찾기에 등록되지 않은 글 표시', + 'state_12' => '모든 글 표시', + 'state_13' => '읽은 글 표시', + 'state_14' => '읽지 않은 글 표시', + 'state_15' => '모든 글 표시', + 'title' => '사용자 쿼리', + ), + 'profile' => array( + '_' => '프로필 관리', + 'delete' => array( + '_' => '계정 삭제', + 'warn' => '당신의 계정과 관련된 모든 데이터가 삭제됩니다.', + ), + 'password_api' => 'API 암호<br /><small>(예: 모바일 애플리케이션)</small>', + 'password_form' => '암호<br /><small>(웹폼 로그인 방식 사용시)</small>', + 'password_format' => '7 글자 이상이어야 합니다', + 'title' => '프로필', + ), + 'reading' => array( + '_' => '읽기', + 'after_onread' => '“모두 읽음으로 표시” 후,', + 'articles_per_page' => '페이지당 글 수', + 'auto_load_more' => '페이지 하단에 다다르면 글 더 불러오기', + 'auto_remove_article' => '글을 읽은 후 숨기기', + 'mark_updated_article_unread' => '갱신 된 글을 읽지 않음으로 표시', + 'confirm_enabled' => '“모두 읽음으로 표시” 실행시 확인 창 표시', + 'display_articles_unfolded' => '글을 펼쳐진 상태로 보여주기', + 'display_categories_unfolded' => '카테고리를 접힌 상태로 보여주기', + 'hide_read_feeds' => '읽지 않은 글이 없는 카테고리와 피드 감추기 (“모든 글 표시”가 설정된 경우 동작하지 않습니다)', + 'img_with_lazyload' => '그림을 불러오는 데에 "lazy load" 모드 사용하기', + 'sides_close_article' => '글 영역 바깥을 클릭하면 글 접기', + 'jump_next' => '다음 읽지 않은 항목으로 이동 (피드 또는 카테고리)', + 'number_divided_when_reader' => '읽기 모드에서는 절반만 표시됩니다.', + 'read' => array( + 'article_open_on_website' => '글이 게재된 웹사이트를 방문했을 때', + 'article_viewed' => '글을 읽었을 때', + 'scroll' => '스크롤을 하며 지나갈 때', + 'upon_reception' => '글을 가져오자마자', + 'when' => '읽음으로 표시…', + ), + 'show' => array( + '_' => '글 표시 방식', + 'adaptive' => '읽지 않은 글이 없으면 모든 글 표시', + 'all_articles' => '모든 글 표시', + 'unread' => '읽지 않은 글만 표시', + ), + 'sort' => array( + '_' => '정렬 순서', + 'newer_first' => '최근 글 먼저', + 'older_first' => '오래된 글 먼저', + ), + 'sticky_post' => '글이 펼쳐진 경우 최상단에 고정하기', + 'title' => '읽기', + 'view' => array( + 'default' => '기본 보기 모드', + 'global' => '전체 모드', + 'normal' => '일반 모드', + 'reader' => '읽기 모드', + ), + ), + 'sharing' => array( + '_' => '공유', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => '메일', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => '자세한 정보', + 'print' => '인쇄', + 'shaarli' => 'Shaarli', + 'share_name' => '표시할 이름', + 'share_url' => '사용할 공유 URL', + 'title' => '공유', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => '단축키', + 'article_action' => '글 관련 동작', + 'auto_share' => '공유', + 'auto_share_help' => '공유 옵션이 하나만 설정되어 있다면 해당 공유 옵션을 사용하고, 그렇지 않다면 공유 옵션을 번호로 선택할 수 있습니다.', + 'close_dropdown' => '메뉴 닫기', + 'collapse_article' => '접기', + 'first_article' => '첫 글 보기', + 'focus_search' => '검색창 사용하기', + 'help' => '도움말 보기', + 'javascript' => '단축키를 사용하기 위해선 자바스크립트를 사용하도록 설정하여야 합니다', + 'last_article' => '마지막 글 보기', + 'load_more' => '글 더 불러오기', + 'mark_read' => '읽음으로 표시', + 'mark_favorite' => '즐겨찾기에 등록', + 'navigation' => '탐색', + 'navigation_help' => '"Shift" 키를 누른 상태에선 탐색 단축키가 피드에 적용됩니다.<br/>"Alt" 키를 누른 상태에선 탐색 단축키가 카테고리에 적용됩니다.', + 'next_article' => '다음 글 보기', + 'other_action' => '다른 동작', + 'previous_article' => '이전 글 보기', + 'see_on_website' => '글이 게재된 웹사이트에서 보기', + 'shift_for_all_read' => '+ <code>shift</code>를 누른 상태에선 모두 읽음으로 표시', + 'title' => '단축키', + 'user_filter' => '사용자 필터 사용하기', + 'user_filter_help' => '사용자 필터가 하나만 설정되어 있다면 해당 필터를 사용하고, 그렇지 않다면 필터를 번호로 선택할 수 있습니다.', + ), + 'user' => array( + 'articles_and_size' => '%s 개의 글 (%s)', + 'current' => '현재 사용자', + 'is_admin' => '관리자입니다', + 'users' => '전체 사용자', + ), +); diff --git a/app/i18n/kr/feedback.php b/app/i18n/kr/feedback.php new file mode 100644 index 000000000..a70923761 --- /dev/null +++ b/app/i18n/kr/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => '최적화가 완료되었습니다', + ), + 'access' => array( + 'denied' => '이 페이지에 접근할 수 있는 권한이 없습니다', + 'not_found' => '이 페이지는 존재하지 않습니다', + ), + 'auth' => array( + 'form' => array( + 'not_set' => '인증 시스템을 설정하는 동안 문제가 발생했습니다. 잠시 후 다시 시도하세요.', + 'set' => '웹폼이 이제 기본 인증 시스템으로 설정되었습니다.', + ), + 'login' => array( + 'invalid' => '유효하지 않은 로그인입니다', + 'success' => '접속되었습니다', + ), + 'logout' => array( + 'success' => '접속이 해제되었습니다', + ), + 'no_password_set' => '관리자 암호가 설정되지 않았습니다. 이 기능은 사용할 수 없습니다.', + ), + 'conf' => array( + 'error' => '설정을 저장하는 동안 문제가 발생했습니다', + 'query_created' => '쿼리 "%s" 가 생성되었습니다.', + 'shortcuts_updated' => '단축키가 갱신되었습니다', + 'updated' => '설정이 저장되었습니다', + ), + 'extensions' => array( + 'already_enabled' => '%s 확장 기능은 이미 활성화되어 있습니다', + 'disable' => array( + 'ko' => '%s 확장 기능을 비활성화 할 수 없습니다. 자세한 내용은 <a href="%s">FressRSS 로그</a>를 참고하세요.', + 'ok' => '%s 확장 기능이 비활성화되었습니다', + ), + 'enable' => array( + 'ko' => '%s 확장 기능을 활성화 할 수 없습니다. 자세한 내용은 <a href="%s">FressRSS 로그</a>를 참고하세요.', + 'ok' => '%s 확장 기능이 활성화되었습니다', + ), + 'no_access' => '%s 확장 기능에 접근 권한이 없습니다', + 'not_enabled' => '%s 확장 기능이 활성화되지 않았습니다', + 'not_found' => '%s 확장 기능이 존재하지 않습니다', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP 확장 기능을 서버에서 찾을 수 없습니다. 파일을 하나씩 내보내세요.', + 'feeds_imported' => '피드를 성공적으로 불러왔습니다', + 'feeds_imported_with_errors' => '피드를 불러왔지만, 문제가 발생했습니다', + 'file_cannot_be_uploaded' => '파일을 업로드할 수 없습니다!', + 'no_zip_extension' => 'ZIP 확장 기능을 서버에서 찾을 수 없습니다.', + 'zip_error' => 'ZIP 파일을 불러오는 동안 문제가 발생했습니다.', + ), + 'sub' => array( + 'actualize' => 'Updating', + 'category' => array( + 'created' => '%s 카테고리가 생성되었습니다.', + 'deleted' => '카테고리가 삭제되었습니다.', + 'emptied' => '카테고리를 비웠습니다', + 'error' => '카테고리를 변경할 수 없습니다', + 'name_exists' => '같은 카테고리 이름이 이미 존재합니다.', + 'no_id' => '카테고리 id를 명시해야 합니다.', + 'no_name' => '카테고리 이름을 명시해야 합니다.', + 'not_delete_default' => '기본 카테고리는 삭제할 수 없습니다!', + 'not_exist' => '카테고리가 존재하지 않습니다!', + 'over_max' => '카테고리 개수 제한에 다다랐습니다 (%d)', + 'updated' => '카테고리가 변경되었습니다.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> 피드에서 새 글을 가져왔습니다', + 'actualizeds' => 'RSS 피드에서 새 글을 가져왔습니다', + 'added' => '<em>%s</em> 피드가 추가되었습니다', + 'already_subscribed' => '이미 <em>%s</em> 피드를 구독 중입니다', + 'deleted' => '피드가 삭제되었습니다', + 'error' => '피드를 변경할 수 없습니다', + 'internal_problem' => 'RSS 피드를 추가할 수 없습니다. 자세한 내용은 <a href="%s">FressRSS 로그</a>를 참고하세요.', + 'invalid_url' => 'URL (<em>%s</em>)이 유효하지 않습니다', + 'marked_read' => '피드가 읽음으로 표시되었습니다', + 'n_actualized' => '%d 개의 피드에서 새 글을 가져왔습니다', + 'n_entries_deleted' => '%d 개의 글을 삭제했습니다', + 'no_refresh' => '새 글을 가져올 피드가 없습니다…', + 'not_added' => '<em>%s</em> 피드를 추가할 수 없습니다', + 'over_max' => '피드 개수 제한에 다다랐습니다 (%d)', + 'updated' => '피드가 변경되었습니다', + ), + 'purge_completed' => '삭제 완료 (%d 개의 글을 삭제했습니다)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS가 <strong>%s</strong> 버전으로 업데이트됩니다.', + 'error' => '업데이트 과정에서 문제가 발생했습니다: %s', + 'file_is_nok' => '<strong>%s</strong> 버전을 사용할 수 있지만, <em>%s</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'finished' => '업데이트를 완료했습니다!', + 'none' => '적용할 업데이트가 없습니다', + 'server_not_found' => '업데이트 서버를 찾을 수 없습니다. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => '%s 사용자가 생성되었습니다', + 'error' => '%s 사용자를 생성할 수 없습니다', + ), + 'deleted' => array( + '_' => '%s 사용자를 삭제했습니다', + 'error' => '%s 사용자를 삭제할 수 없습니다', + ), + ), + 'profile' => array( + 'error' => '프로필을 변경할 수 없습니다', + 'updated' => '프로필을 변경했습니다', + ), +); diff --git a/app/i18n/kr/gen.php b/app/i18n/kr/gen.php new file mode 100644 index 000000000..e9b6ea9b8 --- /dev/null +++ b/app/i18n/kr/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => '새 글 가져오기', + 'back_to_rss_feeds' => '← RSS 피드로 돌아가기', + 'cancel' => '취소', + 'create' => '생성', + 'disable' => '비활성화', + 'empty' => '비우기', + 'enable' => '활성화', + 'export' => '내보내기', + 'filter' => '해당하는 글 보기', + 'import' => '불러오기', + 'manage' => '관리', + 'mark_favorite' => '즐겨찾기에 등록', + 'mark_read' => '읽음으로 표시', + 'remove' => '삭제', + 'see_website' => '웹사이트 열기', + 'submit' => '설정 저장', + 'truncate' => '모든 글 삭제', + ), + 'auth' => array( + 'email' => '메일 주소', + 'keep_logged_in' => '로그인 유지 <small>(%s 일)</small>', + 'login' => '로그인', + 'logout' => '로그아웃', + 'password' => array( + '_' => '암호', + 'format' => '<small>7 글자 이상이어야 합니다</small>', + ), + 'registration' => array( + '_' => '새 계정', + 'ask' => '새 계정을 만들까요?', + 'title' => '계정 생성', + ), + 'reset' => '인증 초기화', + 'username' => array( + '_' => '사용자 이름', + 'admin' => '관리자 이름', + 'format' => '<small>알파벳과 숫자를 포함할 수 있고 최대 16 글자</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => '4월', + 'april' => '4월', + 'aug' => '8월', + 'august' => '8월', + 'before_yesterday' => '어제 이전', + 'dec' => '12월', + 'december' => '12월', + 'feb' => '2월', + 'february' => '2월', + 'format_date' => 'Y년 m월 d일', + 'format_date_hour' => 'Y년 m월 d일 H시 i분', + 'fri' => '금', + 'jan' => '1월', + 'january' => '1월', + 'jul' => '7월', + 'july' => '7월', + 'jun' => '6월', + 'june' => '6월', + 'last_3_month' => '최근 3 개월', + 'last_6_month' => '최근 6 개월', + 'last_month' => '최근 한 달', + 'last_week' => '최근 한 주', + 'last_year' => '최근 일 년', + 'mar' => '3월', + 'march' => '3월', + 'may' => '5월', + 'may_' => '5월', + 'mon' => '월', + 'month' => '개월', + 'nov' => '11월', + 'november' => '11월', + 'oct' => '10월', + 'october' => '10월', + 'sat' => '토', + 'sep' => '9월', + 'september' => '9월', + 'sun' => '일', + 'thu' => '목', + 'today' => '오늘', + 'tue' => '화', + 'wed' => '수', + 'yesterday' => '어제', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => '정보', + ), + 'js' => array( + 'category_empty' => '빈 카테고리', + 'confirm_action' => '정말 이 작업을 수행하시겠습니까? 이 작업은 되돌릴 수 없습니다!', + 'confirm_action_feed_cat' => '정말 이 작업을 수행하시겠습니까? 관련된 즐겨찾기와 사용자 쿼리가 삭제됩니다. 이 작업은 되돌릴 수 없습니다!!', + 'feedback' => array( + 'body_new_articles' => '%%d 개의 새 글이 FreshRSS에 있습니다.', + 'request_failed' => '요청한 작업을 수행할 수 없습니다. 인터넷 연결에 문제가 발생한 것 같습니다.', + 'title_new_articles' => 'FreshRSS: 새 글이 있습니다!', + ), + 'new_article' => '새 글이 있습니다. 여기를 클릭하면 페이지를 다시 불러옵니다.', + 'should_be_activated' => '자바스크립트를 사용하도록 설정해야합니다', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => '정보', + 'admin' => '관리', + 'archiving' => '보관', + 'authentication' => '인증', + 'check_install' => '설치 요구사항 확인', + 'configuration' => '설정', + 'display' => '표시', + 'extensions' => '확장 기능', + 'logs' => '로그', + 'queries' => '사용자 쿼리', + 'reading' => '읽기', + 'search' => '단어 또는 #태그 검색', + 'sharing' => '공유', + 'shortcuts' => '단축키', + 'stats' => '통계', + 'system' => '시스템 설정', + 'update' => '업데이트', + 'user_management' => '사용자 관리', + 'user_profile' => '프로필', + ), + 'pagination' => array( + 'first' => 'First', + 'last' => 'Last', + 'load_more' => '글 더 불러오기', + 'mark_all_read' => '모두 읽음으로 표시', + 'next' => 'Next', + 'nothing_to_load' => '더 이상 글이 없습니다', + 'previous' => 'Previous', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => '메일', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => '인쇄', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => '경고!', + 'blank_to_disable' => '빈 칸으로 두면 비활성화', + 'by_author' => 'By <em>%s</em>', + 'by_default' => '기본값', + 'damn' => '이런!', + 'default_category' => '분류 없음', + 'no' => '아니요', + 'not_applicable' => '사용할 수 없음', + 'ok' => 'Ok!', + 'or' => '또는', + 'yes' => '네', + ), +); diff --git a/app/i18n/kr/index.php b/app/i18n/kr/index.php new file mode 100644 index 000000000..cc03f91c2 --- /dev/null +++ b/app/i18n/kr/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => '정보', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => '버그 제보하기', + 'credits' => '크레딧', + 'credits_content' => 'FreshRSS는 <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> 프레임워크를 사용하진 않지만, 일부 디자인 요소를 가져왔습니다. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">아이콘들</a>은 <a href="https://www.gnome.org/">GNOME 프로젝트</a>에서 가져왔습니다. <em>Open Sans</em> 글꼴은 <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>가 제작하였습니다. FreshRSS는 PHP 프레임워크인 <a href="https://github.com/marienfressinaud/MINZ">Minz</a>에 기반하고 있습니다.', + 'freshrss_description' => 'FreshRSS는 <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> 또는 <a href="http://projet.idleman.fr/leed/">Leed</a>와 같은 셀프 호스팅 기반의 RSS 피드 수집기입니다. FreshRSS는 강력하고 다양한 설정을 할 수 있으면서 도 가볍고 사용하기 쉽습니다.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">Github 저장소에 제보</a>', + 'license' => '라이센스', + 'project_website' => '프로젝트 웹사이트', + 'title' => '정보', + 'version' => '버전', + 'website' => '웹사이트', + ), + 'feed' => array( + 'add' => '피드를 추가하세요.', + 'empty' => '글이 없습니다.', + 'rss_of' => '%s의 피드', + 'title' => 'RSS 피드', + 'title_global' => '전체 모드', + 'title_fav' => '즐겨찾기', + ), + 'log' => array( + '_' => '로그', + 'clear' => '로그 모두 지우기', + 'empty' => '로그 파일이 비어있습니다', + 'title' => '로그', + ), + 'menu' => array( + 'about' => 'FreshRSS 정보', + 'add_query' => '쿼리 만들기', + 'before_one_day' => '하루 이전', + 'before_one_week' => '한 주 이전', + 'favorites' => '즐겨찾기 (%s)', + 'global_view' => '전체 모드', + 'main_stream' => '메인 스트림', + 'mark_all_read' => '모두 읽음으로 표시', + 'mark_cat_read' => '카테고리를 읽음으로 표시', + 'mark_feed_read' => '피드를 읽음으로 표시', + 'newer_first' => '최근 글 먼저', + 'non-starred' => '즐겨찾기를 제외하고 표시', + 'normal_view' => '일반 모드', + 'older_first' => '오래된 글 먼저', + 'queries' => '사용자 쿼리', + 'read' => '읽은 글만 표시', + 'reader_view' => '읽기 모드', + 'rss_view' => 'RSS 피드', + 'search_short' => '검색', + 'starred' => '즐겨찾기만 표시', + 'stats' => '통계', + 'subscription' => '구독 관리', + 'unread' => '읽지 않은 글만 표시', + ), + 'share' => '공유', + 'tag' => array( + 'related' => '관련 태그', + ), +); diff --git a/app/i18n/kr/install.php b/app/i18n/kr/install.php new file mode 100644 index 000000000..2eea71ff9 --- /dev/null +++ b/app/i18n/kr/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => '설치 완료', + 'fix_errors_before' => '다음 단계로 가기 전에 문제를 해결하세요.', + 'keep_install' => '이전 설정 유지', + 'next_step' => '다음 단계', + 'reinstall' => 'FreshRSS 다시 설치', + ), + 'auth' => array( + 'form' => '웹폼 (전통적인 방식, 자바스크립트 필요)', + 'http' => 'HTTP (HTTPS를 사용하는 고급 사용자용)', + 'none' => '사용하지 않음 (위험)', + 'password_form' => '암호<br /><small>(웹폼 로그인 방식 사용시)</small>', + 'password_format' => '7 글자 이상이어야 합니다', + 'type' => '인증 방식', + ), + 'bdd' => array( + '_' => '데이터베이스', + 'conf' => array( + '_' => '데이터베이스 설정', + 'ko' => '데이터베이스 정보를 확인하세요.', + 'ok' => '데이터베이스 설정이 저장되었습니다.', + ), + 'host' => '데이터베이스 서버', + 'prefix' => '테이블 접두어', + 'password' => '데이터베이스 암호', + 'type' => '데이터베이스 종류', + 'username' => '데이터베이스 사용자 이름', + ), + 'check' => array( + '_' => '설치 요구사항 확인', + 'already_installed' => 'FreshRSS가 이미 설치되어 있는 것을 감지했습니다!', + 'cache' => array( + 'nok' => '<em>./data/cache</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'cache 디렉토리의 권한이 올바르게 설정되었습니다.', + ), + 'ctype' => array( + 'nok' => '문자열 타입 검사에 필요한 라이브러리를 찾을 수 없습니다 (php-ctype).', + 'ok' => '문자열 타입 검사에 필요한 라이브러리가 설치되어 있습니다 (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL 라이브러리를 찾을 수 없습니다 (php-curl 패키지).', + 'ok' => 'cURL 라이브러리가 설치되어 있습니다.', + ), + 'data' => array( + 'nok' => '<em>./data</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'data 디렉토리의 권한이 올바르게 설정되었습니다.', + ), + 'dom' => array( + 'nok' => 'DOM을 다룰 수 있는 라이브러리를 찾을 수 없습니다 (php-xml 패키지).', + 'ok' => 'DOM을 다룰 수 있는 라이브러리가 설치되어 있습니다.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'favicons 디렉토리의 권한이 올바르게 설정되어 있습니다.', + ), + 'fileinfo' => array( + 'nok' => 'fileinfo 라이브러리를 찾을 수 없습니다 (fileinfo 패키지).', + 'ok' => 'fileinfo 라이브러리가 설치되어 있습니다.', + ), + 'http_referer' => array( + 'nok' => 'HTTP REFERER가 변경되지 않았는지 확인해주세요.', + 'ok' => 'HTTP REFERER가 서버와 일치하는 것을 확인했습니다.', + ), + 'json' => array( + 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php5-json 패키지).', + 'ok' => 'JSON 확장 기능이 설치되어 있습니다.', + ), + 'minz' => array( + 'nok' => 'Minz 프레임워크를 찾을 수 없습니다.', + 'ok' => 'Minz 프레임워크가 설치되어 있습니다.', + ), + 'pcre' => array( + 'nok' => '정규표현식을 위한 라이브러리를 찾을 수 없습니다 (php-pcre).', + 'ok' => '정규표현식을 위한 라이브러리가 설치되어 있습니다 (PCRE).', + ), + 'pdo' => array( + 'nok' => '지원가능한 드라이버나 PDO를 찾을 수 없습니다 (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => '최소 하나의 지원가능한 드라이버와 PDO가 설치되어 있습니다 (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'PHP 버전은 %s 이지만, FreshRSS에는 최소 %s의 버전이 필요합니다.', + 'ok' => 'PHP 버전은 %s 이고, FreshRSS와 호환가능 합니다.', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> 디렉토리의 권한을 확인하세요. HTTP 서버가 쓰기 권한을 가지고 있어야 합니다', + 'ok' => 'users 디렉토리의 권한이 올바르게 설정되어 있습니다.', + ), + 'xml' => array( + 'nok' => 'XML 해석을 위한 라이브러리르 찾을 수 없습니다.', + 'ok' => 'XML 해석을 위한 라이브러리가 설치되어 있습니다.', + ), + ), + 'conf' => array( + '_' => '일반 설정', + 'ok' => '일반 설정이 저장되었습니다.', + ), + 'congratulations' => '축하합니다!', + 'default_user' => '기본 사용자 이름<small>(알파벳과 숫자를 포함할 수 있고 최대 16 글자)</small>', + 'delete_articles_after' => '다음 기간보다 오래된 글 삭제', + 'fix_errors_before' => '다음 단계로 가기 전에 문제를 해결하세요.', + 'javascript_is_better' => 'FreshRSS는 자바스크립트를 사용할 때 더욱 쾌적하고 강력합니다', + 'js' => array( + 'confirm_reinstall' => 'FreshRSS을 다시 설치하면 이전 설정이 사라집니다. 계속하시겠습니까?', + ), + 'language' => array( + '_' => '언어', + 'choose' => 'FreshRSS에서 사용할 언어를 고르세요', + 'defined' => '언어가 설정되었습니다.', + ), + 'not_deleted' => '무언가 잘못되었습니다; <em>%s</em> 파일을 직접 삭제해주세요.', + 'ok' => '설치 과정이 성공적으로 끝났습니다.', + 'step' => '단계 %d', + 'steps' => '단계', + 'title' => '설치 · FreshRSS', + 'this_is_the_end' => '마침', +); diff --git a/app/i18n/kr/sub.php b/app/i18n/kr/sub.php new file mode 100644 index 000000000..b8f2385b3 --- /dev/null +++ b/app/i18n/kr/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => '이 버튼을 즐겨찾기 막대로 끌어다 놓거나 마우스 오른쪽 클릭으로 나타나는 메뉴에서 "이 링크를 즐겨찾기에 추가"를 선택하세요. 그리고 피드를 구독하길 원하는 페이지에서 "구독하기" 버튼을 클릭하세요.', + 'label' => '구독하기', + 'title' => '북마클릿', + ), + 'category' => array( + '_' => '카테고리', + 'add' => '카테고리 추가', + 'empty' => '빈 카테고리', + 'new' => '새 카테고리', + ), + 'feed' => array( + 'add' => 'RSS 피드 추가', + 'advanced' => '고급 설정', + 'archiving' => '보관', + 'auth' => array( + 'configuration' => '로그인', + 'help' => 'HTTP 접속이 제한되는 RSS 피드에 접근합니다', + 'http' => 'HTTP 인증', + 'password' => 'HTTP 암호', + 'username' => 'HTTP 사용자 이름', + ), + 'css_help' => '글의 일부가 포함된 RSS 피드를 가져옵니다 (주의, 시간이 좀 더 걸립니다!)', + 'css_path' => '웹사이트 상의 글 본문에 해당하는 CSS 경로', + 'description' => '설명', + 'empty' => '이 피드는 비어있습니다. 피드가 계속 운영되고 있는지 확인하세요.', + 'error' => '이 피드에 문제가 발생했습니다. 이 피드에 접근 권한이 있는지 확인하세요.', + 'in_main_stream' => '메인 스트림에 표시하기', + 'informations' => '정보', + 'keep_history' => '최소 유지 글 개수', + 'moved_category_deleted' => '카테고리를 삭제하면, 해당 카테고리 아래에 있던 피드들은 자동적으로 <em>%s</em> 아래로 분류됩니다.', + 'no_selected' => '선택된 피드가 없습니다.', + 'number_entries' => '%d 개의 글', + 'stats' => '통계', + 'think_to_add' => '피드를 추가할 수 있습니다.', + 'title' => '제목', + 'title_add' => 'RSS 피드 추가', + 'ttl' => '다음 시간이 지나기 전에 새로고침 금지', + 'url' => '피드 URL', + 'validator' => '피드 유효성 검사', + 'website' => '웹사이트 URL', + 'pubsubhubbub' => 'PubSubHubbub을 사용한 즉시 알림', + ), + 'firefox' => array( + 'documentation' => 'FreshRSS를 Firefox 피드 리더에 추가하기 위해서는 <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">여기</a>의 설명을 따르세요.', + 'title' => 'Firefox 피드 리더', + ), + 'import_export' => array( + 'export' => '내보내기', + 'export_opml' => '피드 목록 내보내기 (OPML)', + 'export_starred' => '즐겨찾기 내보내기', + 'feed_list' => '%s 개의 글 목록', + 'file_to_import' => '불러올 파일<br />(OPML, JSON 또는 ZIP)', + 'file_to_import_no_zip' => '불러올 파일<br />(OPML 또는 JSON)', + 'import' => '불러오기', + 'starred_list' => '즐겨찾기에 등록된 글 목록', + 'title' => '불러오기 / 내보내기', + ), + 'menu' => array( + 'bookmark' => '구독하기 (FreshRSS 북마클릿)', + 'import_export' => '불러오기 / 내보내기', + 'subscription_management' => '구독 관리', + 'subscription_tools' => '구독 도구', + ), + 'title' => array( + '_' => '구독 관리', + 'feed_management' => 'RSS 피드 관리', + 'subscription_tools' => '구독 도구', + ), +); diff --git a/app/i18n/nl/admin.php b/app/i18n/nl/admin.php new file mode 100644 index 000000000..384242b4d --- /dev/null +++ b/app/i18n/nl/admin.php @@ -0,0 +1,193 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'auth' => array( + 'allow_anonymous' => 'Sta bezoekers toe om artikelen te lezen van de standaard gebruiker (%s)', + 'allow_anonymous_refresh' => 'Sta bezoekers toe om de artikelen te vernieuwen', + 'api_enabled' => 'Sta <abbr>API</abbr> toegang toe <small>(nodig voor mobiele apps)</small>', + 'form' => 'Web formulier (traditioneel, JavaScript vereist)', + 'http' => 'HTTP (voor gevorderde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'title' => 'Authenticatie', + 'title_reset' => 'Authenticatie terugzetten', + 'token' => 'Authenticatie teken', + 'token_help' => 'Sta toegang toe tot de RSS uitvoer van de standaard gebruiker zonder authenticatie:', + 'type' => 'Authenticatie methode', + 'unsafe_autologin' => 'Sta onveilige automatische log in toe met het volgende formaat: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Controleer de permissies van de <em>./data/cache</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'categories' => array( + 'nok' => 'Categorie tabel is slecht geconfigureerd.', + 'ok' => 'Categorie tabel is ok.', + ), + 'connection' => array( + 'nok' => 'Verbinding met de database kan niet worden gemaakt.', + 'ok' => 'Verbinding met de database is ok.', + ), + 'ctype' => array( + 'nok' => 'U mist de benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist de cURL (php-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer de permissies op de <em>./data</em> map. De HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de data map zijn in orde.', + ), + 'database' => 'Database installatie', + 'dom' => array( + 'nok' => 'U mist de benodigde bibliotheek voor het bladeren van DOM (php-xml package).', + 'ok' => 'U hebt de benodigde bibliotheek voor het bladeren van DOM.', + ), + 'entries' => array( + 'nok' => 'Invoertabel is slecht geconfigureerd.', + 'ok' => 'Invoertabel is ok.', + ), + 'favicons' => array( + 'nok' => 'Controleer de permissies op de <em>./data/favicons</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de favicons map zijn goed.', + ), + 'feeds' => array( + 'nok' => 'Feedtabel is slecht geconfigureerd.', + 'ok' => 'Feedtabel is ok.', + ), + 'fileinfo' => array( + 'nok' => 'U mist de PHP fileinfo (fileinfo package).', + 'ok' => 'U hebt de fileinfo uitbreiding.', + ), + 'files' => 'Bestanden installatie', + 'json' => array( + 'nok' => 'U mist JSON (php5-json package).', + 'ok' => 'U hebt JSON uitbreiding.', + ), + 'minz' => array( + 'nok' => 'U mist Minz framework.', + 'ok' => 'U hebt Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist de benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of een van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP installatie', + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Er zijn één of meer ontbrekende tabellen in de database.', + 'ok' => 'Alle tabellen zijn aanwezig in de database.', + ), + 'title' => 'Installatie controle', + 'tokens' => array( + 'nok' => 'Controleer de permissies op de <em>./data/tokens</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de tokens map zijn goed.', + ), + 'users' => array( + 'nok' => 'Controleer de permissies op de <em>./data/users</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de users map zijn goed.', + ), + 'zip' => array( + 'nok' => 'U mist ZIP uitbreiding (php-zip package).', + 'ok' => 'U hebt ZIP uitbreiding.', + ), + ), + 'extensions' => array( + 'disabled' => 'Uitgeschakeld', + 'empty_list' => 'Er zijn geïnstalleerde uitbreidingen', + 'enabled' => 'Ingeschakeld', + 'no_configure_view' => 'Deze uitbreiding kan niet worden geconfigureerd.', + 'system' => array( + '_' => 'Systeemuitbreidingen', + 'no_rights' => 'Systeemuitbreidingen (U hebt hier geen rechten op)', + ), + 'title' => 'Uitbreidingen', + 'user' => 'Gebruikersuitbreidingen', + 'community' => 'Gebruikersuitbreidingen beschikbaar', + 'name' => 'Naam', + 'version' => 'Versie', + 'description' => 'Beschrijving', + 'author' => 'Auteur', + 'latest' => 'Geïnstalleerd', + 'update' => 'Update beschikbaar', + ), + 'stats' => array( + '_' => 'Statistieken', + 'all_feeds' => 'Alle feeds', + 'category' => 'Categorie', + 'entry_count' => 'Invoer aantallen', + 'entry_per_category' => 'Aantallen per categorie', + 'entry_per_day' => 'Aantallen per dag (laatste 30 dagen)', + 'entry_per_day_of_week' => 'Per dag of week (gemiddeld: %.2f berichten)', + 'entry_per_hour' => 'Per uur (gemiddeld: %.2f berichten)', + 'entry_per_month' => 'Per maand (gemiddeld: %.2f berichten)', + 'entry_repartition' => 'Invoer verdeling', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categorie', + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'main_stream' => 'Overzicht', + 'menu' => array( + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'repartition' => 'Artikelen verdeling', + ), + 'no_idle' => 'Er is geen gepauzeerde feed!', + 'number_entries' => '%d artikelen', + 'percent_of_total' => '%% van totaal', + 'repartition' => 'Artikelverdeling', + 'status_favorites' => 'Favorieten', + 'status_read' => 'Gelezen', + 'status_total' => 'Totaal', + 'status_unread' => 'Ongelezen', + 'title' => 'Statistieken', + 'top_feed' => 'Top tien feeds', + ), + 'system' => array( + '_' => 'Systeem configuratie', + 'auto-update-url' => 'Automatische update server URL', + 'instance-name' => 'Voorbeeld naam', + 'max-categories' => 'Categoriën limiet per gebruiker', + 'max-feeds' => 'Feed limiet per gebruiker', + 'registration' => array( + 'help' => '0 betekent geen account limiet', + 'number' => 'Maximum aantal accounts', + ), + ), + 'update' => array( + '_' => 'Versie controle', + 'apply' => 'Toepassen', + 'check' => 'Controleer op nieuwe versies', + 'current_version' => 'Uw huidige versie van FreshRSS is %s.', + 'last' => 'Laatste controle: %s', + 'none' => 'Geen nieuwe versie om toe te passen', + 'title' => 'Vernieuw systeem', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'create' => 'Creëer nieuwe gebruiker', + 'language' => 'Taal', + 'number' => 'Er is %d accounts gemaakt', + 'numbers' => 'Er zijn %d accounts gemaakt', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier loginmethode)</small>', + 'password_format' => 'Ten minste 7 tekens', + 'registration' => array( + 'allow' => 'Sta het maken van nieuwe accounts toe', + 'help' => '0 betekent dat er geen accountlimiet is', + 'number' => 'Max aantal accounts', + ), + 'title' => 'Beheer gebruikers', + 'user_list' => 'Lijst van gebruikers ', + 'username' => 'Gebruikersnaam', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php new file mode 100644 index 000000000..e4db5ec3d --- /dev/null +++ b/app/i18n/nl/conf.php @@ -0,0 +1,174 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'archiving' => array( + '_' => 'Archivering', + 'advanced' => 'Geavanceerd', + 'delete_after' => 'Verwijder artikelen na', + 'help' => 'Meer opties zijn beschikbaar in de persoonlijke stroom instellingen', + 'keep_history_by_feed' => 'Minimum aantal te behouden artikelen in de feed', + 'optimize' => 'Optimaliseer database', + 'optimize_help' => 'Doe dit zo af en toe om de omvang van de database te verkleinen', + 'purge_now' => 'Schoon nu op', + 'title' => 'Archivering', + 'ttl' => 'Vernieuw niet automatisch meer dan', + ), + 'display' => array( + '_' => 'Opmaak', + 'icon' => array( + 'bottom_line' => 'Onderaan', + 'entry' => 'Artikel pictogrammen', + 'publication_date' => 'Publicatie datum', + 'related_tags' => 'Gerelateerde labels', + 'sharing' => 'Delen', + 'top_line' => 'Bovenaan', + ), + 'language' => 'Taal', + 'notif_html5' => array( + 'seconds' => 'seconden (0 betekent geen stop)', + 'timeout' => 'HTML5 notificatie stop', + ), + 'theme' => 'Thema', + 'title' => 'Opmaak', + 'width' => array( + 'content' => 'Inhoud breedte', + 'large' => 'Breed', + 'medium' => 'Normaal', + 'no_limit' => 'Geen limiet', + 'thin' => 'Smal', + ), + ), + 'query' => array( + '_' => 'Gebruikers queries (informatie aanvragen)', + 'deprecated' => 'Deze query (informatie aanvraag) is niet langer geldig. De bedoelde categorie of feed is al verwijderd.', + 'filter' => 'Filter toegepast:', + 'get_all' => 'Toon alle artikelen', + 'get_category' => 'Toon "%s" categorie', + 'get_favorite' => 'Toon favoriete artikelen', + 'get_feed' => 'Toon "%s" feed', + 'no_filter' => 'Geen filter', + 'none' => 'U hebt nog geen gebruikers query aangemaakt..', + 'number' => 'Query n°%d', + 'order_asc' => 'Toon oudste artikelen eerst', + 'order_desc' => 'Toon nieuwste artikelen eerst', + 'search' => 'Zoek naar "%s"', + 'state_0' => 'Toon alle artikelen', + 'state_1' => 'Toon gelezen artikelen', + 'state_2' => 'Toon ongelezen artikelen', + 'state_3' => 'Toon alle artikelen', + 'state_4' => 'Toon favoriete artikelen', + 'state_5' => 'Toon gelezen favoriete artikelen', + 'state_6' => 'Toon ongelezen favoriete artikelen', + 'state_7' => 'Toon favoriete artikelen', + 'state_8' => 'Toon niet favoriete artikelen', + 'state_9' => 'Toon gelezen niet favoriete artikelen', + 'state_10' => 'Toon ongelezen niet favoriete artikelen', + 'state_11' => 'Toon niet favoriete artikelen', + 'state_12' => 'Toon alle artikelen', + 'state_13' => 'Toon gelezen artikelen', + 'state_14' => 'Toon ongelezen artikelen', + 'state_15' => 'Toon alle artikelen', + 'title' => 'Gebruikers queries', + ), + 'profile' => array( + '_' => 'Profiel beheer', + 'delete' => array( + '_' => 'Account verwijderen', + 'warn' => 'Uw account en alle gerelateerde gegvens worden verwijderd.', + ), + 'password_api' => 'Wachtwoord API<br /><small>(e.g., voor mobiele apps)</small>', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier log in methode)</small>', + 'password_format' => 'Ten minste 7 tekens', + 'title' => 'Profiel', + ), + 'reading' => array( + '_' => 'Lezen', + 'after_onread' => 'Na “markeer alles als gelezen”,', + 'articles_per_page' => 'Aantal artikelen per pagina', + 'auto_load_more' => 'Laad volgende artikel onderaan de pagina', + 'auto_remove_article' => 'Verberg artikel na lezen', + 'confirm_enabled' => 'Toon een bevestigings dialoog op “markeer alles als gelezen” acties', + 'display_articles_unfolded' => 'Toon artikelen uitgeklapt als standaard', + 'display_categories_unfolded' => 'Toon categoriën ingeklapt als standaard', + 'hide_read_feeds' => 'Verberg categoriën en feeds zonder ongelezen artikelen (werkt niet met “Toon alle artikelen” configuratie)', + 'img_with_lazyload' => 'Gebruik "lazy load" methode om afbeeldingen te laden', + 'sides_close_article' => 'Sluit het artikel door buiten de artikeltekst te klikken', + 'jump_next' => 'Ga naar volgende ongelezen (feed of categorie)', + 'mark_updated_article_unread' => 'Markeer vernieuwd artikel als ongelezen', + 'number_divided_when_reader' => 'Gedeeld door 2 in de lees modus.', + 'read' => array( + 'article_open_on_website' => 'Als het artikel is geopend op de originele website', + 'article_viewed' => 'Als het artikel is bekeken', + 'scroll' => 'Tijdens scrollen', + 'upon_reception' => 'Tijdens ontvangst van het artikel', + 'when' => 'Markeer artikel als gelezen…', + ), + 'show' => array( + '_' => 'Artikelen om te tonen', + 'adaptive' => 'Pas weergave aan', + 'all_articles' => 'Bekijk alle artikelen', + 'unread' => 'Bekijk alleen ongelezen', + ), + 'sort' => array( + '_' => 'Sorteer volgorde', + 'newer_first' => 'Nieuwste eerst', + 'older_first' => 'Oudste eerst', + ), + 'sticky_post' => 'Koppel artikel aan de bovenkant als het geopend wordt', + 'title' => 'Lees modus', + 'view' => array( + 'default' => 'Standaard weergave', + 'global' => 'Globale weergave', + 'normal' => 'Normale weergave', + 'reader' => 'Lees weergave', + ), + ), + 'sharing' => array( + '_' => 'Delen', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Meer informatie', + 'print' => 'Afdrukken', + 'shaarli' => 'Shaarli', + 'share_name' => 'Gedeelde naam om weer te geven', + 'share_url' => 'Deel URL voor gebruik', + 'title' => 'Delen', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Artikel acties', + 'auto_share' => 'Delen', + 'auto_share_help' => 'Als er slechts één deel methode i, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + 'close_dropdown' => 'Sluit menu', + 'collapse_article' => 'Inklappen', + 'first_article' => 'Spring naar eerste artikel', + 'focus_search' => 'Toegang zoek venster', + 'help' => 'Toon documentatie', + 'javascript' => 'JavaScript moet geactiveerd zijn om verwijzingen te gebruiken', + 'last_article' => 'Spring naar laatste artikel', + 'load_more' => 'Laad meer artikelen', + 'mark_read' => 'Markeer als gelezen', + 'mark_favorite' => 'Markeer als favoriet', + 'navigation' => 'Navigatie', + 'navigation_help' => 'Met de "Shift" toets, kunt u navigatie verwijzingen voor feeds gebruiken.<br/>Met de "Alt" toets, kunt u navigatie verwijzingen voor categoriën gebruiken.', + 'next_article' => 'Spring naar volgende artikel', + 'other_action' => 'Andere acties', + 'previous_article' => 'Spring naar vorige artikel', + 'see_on_website' => 'Bekijk op originale website', + 'shift_for_all_read' => '+ <code>shift</code> om alle artikelen als gelezen te markeren', + 'title' => 'Verwijzingen', + 'user_filter' => 'Toegang gebruikers filters', + 'user_filter_help' => 'Als er slechts één gebruikers filter s, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'current' => 'Huidige gebruiker', + 'is_admin' => 'is beheerder', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/feedback.php b/app/i18n/nl/feedback.php new file mode 100644 index 000000000..cf1274767 --- /dev/null +++ b/app/i18n/nl/feedback.php @@ -0,0 +1,110 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'admin' => array( + 'optimization_complete' => 'Optimalisatie compleet', + ), + 'access' => array( + 'denied' => 'U hebt geen rechten om deze pagina te bekijken.', + 'not_found' => 'Deze pagina bestaat niet', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Er is een probleem opgetreden tijdens de controle van de systeemconfiguratie. Probeer het later nog eens.', + 'set' => 'Formulier is nu uw standaard authenticatie systeem.', + ), + 'login' => array( + 'invalid' => 'Login is ongeldig', + 'success' => 'U bent ingelogd', + ), + 'logout' => array( + 'success' => 'U bent uitgelogd', + ), + 'no_password_set' => 'Beheerderswachtwoord is niet ingesteld. Deze mogelijkheid is niet beschikbaar.', + ), + 'conf' => array( + 'error' => 'Er is een fout opgetreden tijdens het opslaan van de configuratie', + 'query_created' => 'Query "%s" is gemaakt.', + 'shortcuts_updated' => 'Verwijzingen zijn vernieuwd', + 'updated' => 'Configuratie is vernieuwd', + ), + 'extensions' => array( + 'already_enabled' => '%s is al ingeschakeld', + 'disable' => array( + 'ko' => '%s kan niet worden uitgeschakeld. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'ok' => '%s is nu uitgeschakeld', + ), + 'enable' => array( + 'ko' => '%s kan niet worden ingeschakeld. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'ok' => '%s is nn ingeschakeld', + ), + 'no_access' => 'U hebt geen toegang voor %s', + 'not_enabled' => '%s is nog niet ingeschakeld', + 'not_found' => '%s bestaat niet', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP uitbreiding is niet aanwezig op uw server. Exporteer a.u.b. uw bestanden één voor één.', + 'feeds_imported' => 'Uw feeds zijn geimporteerd en worden nu vernieuwd', + 'feeds_imported_with_errors' => 'Uw feeds zijn geimporteerd maar er zijn enige fouten opgetreden', + 'file_cannot_be_uploaded' => 'Bestand kan niet worden verzonden!', + 'no_zip_extension' => 'ZIP uitbreiding is niet aanwezig op uw server.', + 'zip_error' => 'Er is een fout opgetreden tijdens het imporeren van het ZIP bestand.', + ), + 'sub' => array( + 'actualize' => 'Actualiseren', + 'category' => array( + 'created' => 'Categorie %s is gemaakt.', + 'deleted' => 'Categorie is verwijderd.', + 'emptied' => 'Categorie is leeg gemaakt', + 'error' => 'Categorie kan niet worden vernieuwd', + 'name_exists' => 'Categorie naam bestaat al.', + 'no_id' => 'U moet de id specificeren of de categorie.', + 'no_name' => 'Categorie naam mag niet leeg zijn.', + 'not_delete_default' => 'U kunt de standaard categorie niet verwijderen!', + 'not_exist' => 'De categorie bestaat niet!', + 'over_max' => 'U hebt het maximale aantal categoriën bereikt (%d)', + 'updated' => 'Categorie is vernieuwd.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> is vernieuwd', + 'actualizeds' => 'RSS feeds zijn vernieuwd', + 'added' => 'RSS feed <em>%s</em> is toegevoegd', + 'already_subscribed' => 'U bent al geabonneerd op <em>%s</em>', + 'deleted' => 'Feed is verwijderd', + 'error' => 'Feed kan niet worden vernieuwd', + 'internal_problem' => 'De RSS feed kon niet worden toegevoegd. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'invalid_url' => 'URL <em>%s</em> is ongeldig', + 'marked_read' => 'Feeds zijn gemarkeerd als gelezen', + 'n_actualized' => '%d feeds zijn vernieuwd', + 'n_entries_deleted' => '%d artikelen zijn verwijderd', + 'no_refresh' => 'Er is geen feed om te vernieuwen…', + 'not_added' => '<em>%s</em> kon niet worden toegevoegd', + 'over_max' => 'U hebt het maximale aantal feeds bereikt(%d)', + 'updated' => 'Feed is vernieuwd', + ), + 'purge_completed' => 'Opschonen klaar (%d artikelen verwijderd)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS word nu vernieud naar <strong>versie %s</strong>.', + 'error' => 'Het vernieuwingsproces kwam een fout tegen: %s', + 'file_is_nok' => '<strong>Versie %s</strong>. Controleer permissies op <em>%s</em> map. HTTP server moet rechten hebben om er in te schrijven', + 'finished' => 'Vernieuwing compleet!', + 'none' => 'Geen vernieuwing om toe te passen', + 'server_not_found' => 'Vernieuwings server kan niet worden gevonden. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Gebruiker %s is aangemaakt', + 'error' => 'Gebruiker %s kan niet worden aangemaakt', + ), + 'deleted' => array( + '_' => 'Gebruiker %s is verwijderd', + 'error' => 'Gebruiker %s kan niet worden verwijderd', + ), + 'set_registration' => 'Het maximale aantal accounts is vernieuwd.', + ), + 'profile' => array( + 'error' => 'Uw profiel kan niet worden aangepast', + 'updated' => 'Uw profiel is aangepast', + ), +); diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php new file mode 100644 index 000000000..bccab8310 --- /dev/null +++ b/app/i18n/nl/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualiseren', + 'back_to_rss_feeds' => '← Ga terug naar je RSS feeds', + 'cancel' => 'Annuleren', + 'create' => 'Opslaan', + 'disable' => 'Uitzetten', + 'empty' => 'Leeg', + 'enable' => 'Aanzetten', + 'export' => 'Exporteren', + 'filter' => 'Filteren', + 'import' => 'Importeren', + 'manage' => 'Beheren', + 'mark_favorite' => 'Markeer als favoriet', + 'mark_read' => 'Markeer als gelezen', + 'remove' => 'Verwijder', + 'see_website' => 'Bekijk website', + 'submit' => 'Opslaan', + 'truncate' => 'Verwijder alle artikelen', + ), + 'auth' => array( + 'email' => 'Email adres', + 'keep_logged_in' => 'Ingelogd blijven voor <small>(%s dagen)</small>', + 'login' => 'Log in', + 'logout' => 'Log uit', + 'password' => array( + '_' => 'Wachtwoord', + 'format' => '<small>Ten minste 7 tekens</small>', + ), + 'registration' => array( + '_' => 'Nieuw account', + 'ask' => 'Maak een account?', + 'title' => 'Account maken', + ), + 'reset' => 'Authenticatie reset', + 'username' => array( + '_' => 'Gebruikersnaam', + 'admin' => 'Beheerdersgebruikersnaam', + 'format' => '<small>maximaal 16 alfanumerieke tekens</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t\\u\\s', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\i', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\i', + 'Jul' => '\\J\\u\\l\\i', + 'Jun' => '\\J\\u\\n\\i', + 'Mar' => '\\M\\a\\a\\r\\t', + 'May' => '\\M\\e\\i', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\k\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Ouder', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => 'j %s Y', + 'format_date_hour' => 'j %s Y \\o\\m H\\:i', + 'fri' => 'Vr', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Laatste drie maanden', + 'last_6_month' => 'Laatste zes maanden', + 'last_month' => 'Vorige maand', + 'last_week' => 'Vorige week', + 'last_year' => 'Vorig jaar', + 'mar' => 'mrt', + 'march' => 'Mrt', + 'may' => 'Mei', + 'may_' => 'Mei', + 'mon' => 'Ma', + 'month' => 'maanden', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'okt', + 'october' => 'Okt', + 'sat' => 'Za', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Zo', + 'thu' => 'Do', + 'today' => 'Vandaag', + 'tue' => 'Di', + 'wed' => 'Wo', + 'yesterday' => 'Gisteren', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Over FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Lege categorie', + 'confirm_action' => 'Weet u zeker dat u dit wilt doen? Het kan niet ongedaan worden gemaakt!', + 'confirm_action_feed_cat' => 'Weet u zeker dat u dit wilt doen? U verliest alle gereleteerde favorieten en gebruikers informatie. Het kan niet ongedaan worden gemaakt!', + 'feedback' => array( + 'body_new_articles' => 'Er zijn %%d nieuwe artikelen om te lezen op FreshRSS.', + 'request_failed' => 'Een opdracht is mislukt, mogelijk door Internet verbindings problemen.', + 'title_new_articles' => 'FreshRSS: nieuwe artikelen!', + ), + 'new_article' => 'Er zijn nieuwe artikelen beschikbaar. Klik om de pagina te vernieuwen.', + 'should_be_activated' => 'JavaScript moet aanstaan', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'Over', + 'admin' => 'Administratie', + 'archiving' => 'Archiveren', + 'authentication' => 'Authenticatie', + 'check_install' => 'Installatiecontrole', + 'configuration' => 'Configuratie', + 'display' => 'Opmaak', + 'extensions' => 'Uitbreidingen', + 'logs' => 'Log boeken', + 'queries' => 'Gebruikers informatie', + 'reading' => 'Lezen', + 'search' => 'Zoek woorden of #labels', + 'sharing' => 'Delen', + 'shortcuts' => 'Snelle toegang', + 'stats' => 'Statistieken', + 'system' => 'Systeemconfiguratie', + 'update' => 'Versiecontrole', + 'user_management' => 'Gebruikersbeheer', + 'user_profile' => 'Profiel', + ), + 'pagination' => array( + 'first' => 'Eerste', + 'last' => 'Laatste', + 'load_more' => 'Laad meer artikelen', + 'mark_all_read' => 'Markeer alle als gelezen', + 'next' => 'Volgende', + 'nothing_to_load' => 'Er zijn geen artikelen meer', + 'previous' => 'Vorige', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Attentie!', + 'blank_to_disable' => 'Laat leeg om uit te zetten', + 'by_author' => 'Door <em>%s</em>', + 'by_default' => 'Door standaard', + 'damn' => 'Potverdorie!', + 'default_category' => 'Niet ingedeeld', + 'no' => 'Nee', + 'not_applicable' => 'Niet aanwezig', + 'ok' => 'Ok!', + 'or' => 'of', + 'yes' => 'Ja', + ), +); diff --git a/app/i18n/nl/index.php b/app/i18n/nl/index.php new file mode 100644 index 000000000..e0184a0d0 --- /dev/null +++ b/app/i18n/nl/index.php @@ -0,0 +1,61 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'about' => array( + '_' => 'Over', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Rapporteer fouten', + 'credits' => 'Waarderingen', + 'credits_content' => 'Sommige ontwerp elementen komen van <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> alhoewel FreshRSS dit raamwerk niet gebruikt. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Pictogrammen</a> komen van het <a href="https://www.gnome.org/">GNOME project</a>. <em>De Open Sans</em> font police is gemaakt door <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is gebaseerd op <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, een PHP raamwerk. Nederlandse vertaling door Wanabo, <a href="http://www.nieuwskop.be" title="NieuwsKop">NieuwsKop.be</a>. Link naar de Nederlandse vertaling, <a href="https://github.com/Wanabo/FreshRSS-Dutch-translation/tree/master">FreshRSS-Dutch-translation</a>.', + 'freshrss_description' => 'FreshRSS is een RSS feed aggregator om zelf te hosten zoals <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> of <a href="http://projet.idleman.fr/leed/">Leed</a>. Het gebruikt weinig systeembronnen en is makkelijk te administreren terwijl het een krachtig en makkelijk te configureren programma is.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">op Github</a>', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'Over', + 'version' => 'Versie', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'U kunt wat feeds toevoegen.', + 'empty' => 'Er is geen artikel om te laten zien.', + 'rss_of' => 'RSS feed van %s', + 'title' => 'Overzicht RSS feeds', + 'title_global' => 'Globale weergave', + 'title_fav' => 'Uw favorieten', + ), + 'log' => array( + '_' => 'Log bestanden', + 'clear' => 'Leeg de log bestanden', + 'empty' => 'Log bestand is leeg', + 'title' => 'Log bestanden', + ), + 'menu' => array( + 'about' => 'Over FreshRSS', + 'add_query' => 'Voeg een query toe', + 'before_one_day' => 'Ouder dan een dag', + 'before_one_week' => 'Ouder dan een week', + 'favorites' => 'Favorieten (%s)', + 'global_view' => 'Globale weergave', + 'main_stream' => 'Overzicht', + 'mark_all_read' => 'Markeer alles als gelezen', + 'mark_cat_read' => 'Markeer categorie als gelezen', + 'mark_feed_read' => 'Markeer feed als gelezen', + 'newer_first' => 'Nieuwste eerst', + 'non-starred' => 'Laat alles zien behalve favorieten', + 'normal_view' => 'Normale weergave', + 'older_first' => 'Oudste eerst', + 'queries' => 'Gebruikers queries', + 'read' => 'Laat alleen gelezen zien', + 'reader_view' => 'Lees modus', + 'rss_view' => 'RSS feed', + 'search_short' => 'Zoeken', + 'starred' => 'Laat alleen favorieten zien', + 'stats' => 'Statistieken', + 'subscription' => 'Abonnementen beheer', + 'unread' => 'Laat alleen ongelezen zien', + ), + 'share' => 'Delen', + 'tag' => array( + 'related' => 'Verwante labels', + ), +); diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.php new file mode 100644 index 000000000..419ee4c9b --- /dev/null +++ b/app/i18n/nl/install.php @@ -0,0 +1,119 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'action' => array( + 'finish' => 'Completeer installatie', + 'fix_errors_before' => 'Repareer de fouten alvorens naar de volgende stap te gaan.', + 'keep_install' => 'Behoud de vorige installatie', + 'next_step' => 'Ga naar de volgende stap', + 'reinstall' => 'Installeer FreshRSS opnieuw', + ), + 'auth' => array( + 'form' => 'Web formulier (traditioneel, benodigd JavaScript)', + 'http' => 'HTTP (voor geavanceerde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier log in methode)</small>', + 'password_format' => 'Tenminste 7 tekens', + 'type' => 'Authenticatiemethode', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Database configuratie', + 'ko' => 'Controleer uw database informatie.', + 'ok' => 'Database configuratie is opgeslagen.', + ), + 'host' => 'Host', + 'prefix' => 'Tabel voorvoegsel', + 'password' => 'Database wachtwoord', + 'type' => 'Type database', + 'username' => 'Database gebruikersnaam', + ), + 'check' => array( + '_' => 'Controles', + 'already_installed' => 'We hebben geconstateerd dat FreshRSS al is geïnstallerd!', + 'cache' => array( + 'nok' => 'Controleer permissies van de <em>./data/cache</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'ctype' => array( + 'nok' => 'U mist een benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist cURL (php-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer permissies van de <em>./data</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de data map zijn goed.', + ), + 'dom' => array( + 'nok' => 'U mist een benodigde bibliotheek om te bladeren in de DOM.', + 'ok' => 'U hebt de benodigde bibliotheek om te bladeren in de DOM.', + ), + 'favicons' => array( + 'nok' => 'Controleer permissies van de <em>./data/favicons</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de favicons map zijn goed.', + ), + 'fileinfo' => array( + 'nok' => 'U mist PHP fileinfo (fileinfo package).', + 'ok' => 'U hebt de fileinfo uitbreiding.', + ), + 'http_referer' => array( + 'nok' => 'Controleer a.u.b. dat u niet uw HTTP REFERER wijzigd.', + 'ok' => 'Uw HTTP REFERER is bekend en komt overeen met uw server.', + ), + 'json' => array( + 'nok' => 'U mist een benodigede bibliotheek om JSON te gebruiken.', + 'ok' => 'U hebt de benodigde bibliotheek om JSON te gebruiken.', + ), + 'minz' => array( + 'nok' => 'U mist het Minz framework.', + 'ok' => 'U hebt het Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist een benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of één van de ondersteunde (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'users' => array( + 'nok' => 'Controleer permissies van de <em>./data/users</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de users map zijn goed.', + ), + 'xml' => array( + 'nok' => 'U mist de benodigde bibliotheek om XML te gebruiken.', + 'ok' => 'U hebt de benodigde bibliotheek om XML te gebruiken.', + ), + ), + 'conf' => array( + '_' => 'Algemene configuratie', + 'ok' => 'Algemene configuratie is opgeslagen.', + ), + 'congratulations' => 'Gefeliciteerd!', + 'default_user' => 'Gebruikersnaam van de standaardgebruiker <small>(maximaal 16 alfanumerieke tekens)</small>', + 'delete_articles_after' => 'Verwijder artikelen na', + 'fix_errors_before' => 'Repareer fouten alvorens U naar de volgende stap gaat.', + 'javascript_is_better' => 'FreshRSS werkt beter JavaScript ingeschakeld', + 'js' => array( + 'confirm_reinstall' => 'U zal uw vorige configuratie kwijtraken door FreshRSS opnieuw te installeren. Weet u zeker dat u verder wilt gaan?', + ), + 'language' => array( + '_' => 'Taal', + 'choose' => 'Kies een taal voor FreshRSS', + 'defined' => 'Taal is bepaald.', + ), + 'not_deleted' => 'Er ging iets fout! U moet het bestand <em>%s</em> handmatig verwijderen.', + 'ok' => 'De installatieprocedure is geslaagd.', + 'step' => 'stap %d', + 'steps' => 'Stappen', + 'title' => 'Installatie · FreshRSS', + 'this_is_the_end' => 'Dit is het einde', +); diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php new file mode 100644 index 000000000..ce446778c --- /dev/null +++ b/app/i18n/nl/sub.php @@ -0,0 +1,77 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'api' => array( + 'documentation' => 'Kopieer de volgende URL om hem in een externe toepassing te gebruiken.', + 'title' => 'API', + ), + 'bookmarklet' => array( + 'documentation' => 'Sleep deze knop naar je bladwijzerwerkbalk of klik erop met de rechtermuisknop en kies "Deze link aan bladwijzers toevoegen."', + 'label' => 'Abonneren', + 'title' => 'Bookmarklet', + ), + 'category' => array( + '_' => 'Categorie', + 'add' => 'Voeg categorie toe', + 'empty' => 'Lege categorie', + 'new' => 'Nieuwe categorie', + ), + 'feed' => array( + 'add' => 'Voeg een RSS feed toe', + 'advanced' => 'Geavanceerd', + 'archiving' => 'Archiveren', + 'auth' => array( + 'configuration' => 'Log in', + 'help' => 'Verbinding toestaan toegang te krijgen tot HTTP beveiligde RSS feeds', + 'http' => 'HTTP Authenticatie', + 'password' => 'HTTP wachtwoord', + 'username' => 'HTTP gebruikers naam', + ), + 'css_help' => 'Haalt verstoorde RSS feeds op (attentie, heeft meer tijd nodig!)', + 'css_path' => 'Artikelen CSS pad op originele website', + 'description' => 'Omschrijving', + 'empty' => 'Deze feed is leeg. Controleer of deze nog actueel is.', + 'error' => 'Deze feed heeft problemen. Verifieer a.u.b het doeladres en actualiseer het.', + 'in_main_stream' => 'Zichtbaar in het overzicht', + 'informations' => 'Informatie', + 'keep_history' => 'Minimum aantal artikelen om te houden', + 'moved_category_deleted' => 'Als u een categorie verwijderd, worden de feeds automatisch geclassificeerd onder <em>%s</em>.', + 'no_selected' => 'Geen feed geselecteerd.', + 'number_entries' => '%d artikelen', + 'pubsubhubbub' => 'Directe notificaties met PubSubHubbub', + 'stats' => 'Statistieken', + 'think_to_add' => 'Voeg wat feeds toe.', + 'title' => 'Titel', + 'title_add' => 'Voeg een RSS feed toe', + 'ttl' => 'Vernieuw automatisch niet vaker dan', + 'url' => 'Feed URL', + 'validator' => 'Controleer de geldigheid van de feed', + 'website' => 'Website URL', + ), + 'firefox' => array( + 'documentation' => 'Volg de stappen die <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">hier</a> beschreven wordem om FreshRSS aan de Firefox-nieuwslezerlijst toe te voegen.', + 'title' => 'Firefox-nieuwslezer', + ), + 'import_export' => array( + 'export' => 'Exporteer', + 'export_opml' => 'Exporteer lijst van feeds (OPML)', + 'export_starred' => 'Exporteer je fovorieten', + 'feed_list' => 'Lijst van %s artikelen', + 'file_to_import' => 'Bestand om te importeren<br />(OPML, JSON of ZIP)', + 'file_to_import_no_zip' => 'Bestand om te importeren<br />(OPML of JSON)', + 'import' => 'Importeer', + 'starred_list' => 'Lijst van favoriete artikelen', + 'title' => 'Importeren / exporteren', + ), + 'menu' => array( + 'bookmark' => 'Abonneer (FreshRSS bladwijzer)', + 'import_export' => 'Importeer / exporteer', + 'subscription_management' => 'Abonnementenbeheer', + 'subscription_tools' => 'Subscription tools',// TODO + ), + 'title' => array( + '_' => 'Abonnementenbeheer', + 'feed_management' => 'RSS-feedbeheer', + 'subscription_tools' => 'Subscription tools',// TODO + ), +); diff --git a/app/i18n/pt-br/admin.php b/app/i18n/pt-br/admin.php new file mode 100644 index 000000000..e62718e80 --- /dev/null +++ b/app/i18n/pt-br/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Permitir a leitura anónima dos artidos pelo usuário padrão (%s)', + 'allow_anonymous_refresh' => 'Permitir atualização anónima dos artigos', + 'api_enabled' => 'Permitir acesso à <abbr>API</abbr> <small>(Necessáiro para aplicativos móveis)</small>', + 'form' => 'Formulário Web(traditional, Necessita de JavaScript)', + 'http' => 'HTTP (Para usuários avançados com HTTPS)', + 'none' => 'Nenhum (Perigoso)', + 'title' => 'Autenticação', + 'title_reset' => 'Reset autenticação', + 'token' => 'Token de autenticação ', + 'token_help' => 'Permitir acesso a saída RSS para o usuário padrão sem autenticação', + 'type' => 'Método de autenticação', + 'unsafe_autologin' => 'Permitir login automática insegura usando o seguinte formato: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data/cache</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório cache estão corretos.', + ), + 'categories' => array( + 'nok' => 'Tabela Category está configurada incorretamente.', + 'ok' => 'Tabela Category está ok.', + ), + 'connection' => array( + 'nok' => 'Conexão ao banco de dados não pode ser estabelecida.', + 'ok' => 'Conexão ao banco de dados está ok.', + ), + 'ctype' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessária para verificação do tipo de caractere (php-ctype).', + 'ok' => 'Você tem a biblioteca necessária para verificação do tipo de caractere (ctype).', + ), + 'curl' => array( + 'nok' => 'Não foi possível encontrar a biblioteca cURL (php-curl).', + 'ok' => 'Você tem a biblioteca cURL.', + ), + 'data' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório data estão corretos.', + ), + 'database' => 'Instalação do banco de dados', + 'dom' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessária para navegar pelo DOM (php-xml).', + 'ok' => 'Você tem a biblioteca necessária para navegar pelo DOM.', + ), + 'entries' => array( + 'nok' => 'Tabela Entry está configurada incorretamente.', + 'ok' => 'Tabela Entry está ok.', + ), + 'favicons' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data/favicons</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório favicons estão corretos.', + ), + 'feeds' => array( + 'nok' => 'Tabela Feed está configurada incorretamente.', + 'ok' => 'Tabela Feed está ok.', + ), + 'fileinfo' => array( + 'nok' => 'Não foi possível encontrar a biblioteca fileinfo do PHP (fileinfo).', + 'ok' => 'Você tem a biblioteca fileinfo.', + ), + 'files' => 'Instalação de arquivos', + 'json' => array( + 'nok' => 'Não foi possível encontrar JSON (php5-json).', + 'ok' => 'Você tem a extensão JSON.', + ), + 'minz' => array( + 'nok' => 'Não foi possível encontrar o framework Minz.', + 'ok' => 'Você tem o framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessário para expressões regulares (php-pcre).', + 'ok' => 'Você tem a biblioteca necessária para expressões regulares (php-pcre).', + ), + 'pdo' => array( + 'nok' => 'Não foi encontrado o PDO ou um dos drivers suportados (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Você tem o PDO e ao menos um dos drivers suportados (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Instação do PHP', + 'nok' => 'Sua versão do PHP é %s mas FreshRSS requer ao menos a versão %s.', + 'ok' => 'Sua versão do PHP é %s, que é compatível com o FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Há uma ou mais tabelas inexistentes no banco de dados.', + 'ok' => 'As tabelas apropriadas existem no banco de dados.', + ), + 'title' => 'Verificação de instalação', + 'tokens' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data/tokens</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório tokens estão corretos.', + ), + 'users' => array( + 'nok' => 'Verifiquei as permissões no diretório <em>./data/users</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório users estão corretos.', + ), + 'zip' => array( + 'nok' => 'Não foi possível localizar a extensão ZIP (php-zip).', + 'ok' => 'Você tem a extensão ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Desabilitado', + 'empty_list' => 'Não há extensões instaladas', + 'enabled' => 'Habilitada', + 'no_configure_view' => 'Esta extensão não pode ser configurada.', + 'system' => array( + '_' => 'Extensões do sistema', + 'no_rights' => 'Extensões do sistema (Você não tem direitos para isto)', + ), + 'title' => 'Extensões', + 'user' => 'Extensões do usuário', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => 'Estatísticas', + 'all_feeds' => 'Todos os feeds', + 'category' => 'Categoria', + 'entry_count' => 'Contagem de entrada', + 'entry_per_category' => 'Entradas por categoria', + 'entry_per_day' => 'Entradas por dia (últimos 30 dias)', + 'entry_per_day_of_week' => 'Por dia da semana(média: %.2f mensagens)', + 'entry_per_hour' => 'Por hora (média: %.2f mensagens)', + 'entry_per_month' => 'Por mês(média: %.2f mensagens)', + 'entry_repartition' => 'Repartição de entradas', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds por categoria', + 'idle' => 'Feeds inativos', + 'main' => 'Estatísticas principais', + 'main_stream' => 'Stream principal', + 'menu' => array( + 'idle' => 'Feeds inativos', + 'main' => 'Estatísticas principais', + 'repartition' => 'Repartição de artigos', + ), + 'no_idle' => 'Não há nenhum feed inativo!', + 'number_entries' => '%d artigos', + 'percent_of_total' => '%% do total', + 'repartition' => 'Repartição de artigos', + 'status_favorites' => 'Favoritos', + 'status_read' => 'Lido', + 'status_total' => 'Total', + 'status_unread' => 'Não lidos', + 'title' => 'Estatísticas', + 'top_feed' => 'Top10 feeds', + ), + 'system' => array( + '_' => 'Configuração do sistema', + 'auto-update-url' => 'URL do servidor para atualização automática', + 'instance-name' => 'Nome da instância', + 'max-categories' => 'Limite de categorias por usuário', + 'max-feeds' => 'Limite de Feeds por usuário', + 'registration' => array( + 'help' => '0 significa que não há limite para a conta', + 'number' => 'Máximo número de contas', + ), + ), + 'update' => array( + '_' => 'Atualização do sistema', + 'apply' => 'Aplicar', + 'check' => 'Buscar por novas atualizações', + 'current_version' => 'Sua versão do FreshRSS é %s.', + 'last' => 'Última verificação: %s', + 'none' => 'Nenhuma atualização para se aplicar', + 'title' => 'Sistema de atualização', + ), + 'user' => array( + 'articles_and_size' => '%s artigos (%s)', + 'create' => 'Criar novo usuário', + 'language' => 'Idioma', + 'number' => 'Há %d conta criada', + 'numbers' => 'Há %d contas criadas', + 'password_form' => 'Senha<br /><small>(para o login pelo método do formulário)</small>', + 'password_format' => 'Ao menos 7 caracteres', + 'title' => 'Gerenciar usuários', + 'user_list' => 'Lista de usuários', + 'username' => 'Usuário', + 'users' => 'Usuários', + ), +); diff --git a/app/i18n/pt-br/conf.php b/app/i18n/pt-br/conf.php new file mode 100644 index 000000000..4eaf599db --- /dev/null +++ b/app/i18n/pt-br/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Arquivar', + 'advanced' => 'Avançado', + 'delete_after' => 'Remover artigos depois', + 'help' => 'Mais opções estão disponíveis nas configurações individuais do feed', + 'keep_history_by_feed' => 'Número mínimo de artigos para deixar no feed', + 'optimize' => 'Otimizar banco de dados', + 'optimize_help' => 'Faça ocasionalmente para reduzir o tamanho do banco de dados', + 'purge_now' => 'Purge agora', + 'title' => 'Arquivar', + 'ttl' => 'Não atualize automaticamente mais frequente que', + ), + 'display' => array( + '_' => 'Exibição', + 'icon' => array( + 'bottom_line' => 'Linha inferior', + 'entry' => 'Ícones de artigos', + 'publication_date' => 'Data da publicação', + 'related_tags' => 'Tags relacionadas', + 'sharing' => 'Compartilhar', + 'top_line' => 'Linha superior', + ), + 'language' => 'Ídioma', + 'notif_html5' => array( + 'seconds' => 'segundos (0 significa sem timeout)', + 'timeout' => 'Notificação em HTML5 de timeout', + ), + 'theme' => 'Tema', + 'title' => 'Exibição', + 'width' => array( + 'content' => 'Largura do conteúdo', + 'large' => 'Largo', + 'medium' => 'Médio', + 'no_limit' => 'Sem lmite', + 'thin' => 'Fino', + ), + ), + 'query' => array( + '_' => 'Queries do usuário', + 'deprecated' => 'Esta não é mais válida. A categoria ou feed relacionado foi deletado.', + 'filter' => 'Filtro aplicado:', + 'get_all' => 'Mostrar todos os artigos', + 'get_category' => 'Visualizar "%s" categoria', + 'get_favorite' => 'Visualizar artigos favoritos', + 'get_feed' => 'Visualizar "%s" feed', + 'no_filter' => 'Sem filtro', + 'none' => 'Você não criou nenhuma query de usuário ainda.', + 'number' => 'Query n°%d', + 'order_asc' => 'Exibir artigos mais antigos primeiro', + 'order_desc' => 'Exibir artigos mais novos primeiro', + 'search' => 'Busca por "%s"', + 'state_0' => 'Exibir todos os artigos', + 'state_1' => 'Exibir artigos lidos', + 'state_2' => 'Exibir artigos não lidos', + 'state_3' => 'Exibir todos os artigos', + 'state_4' => 'Exibir artigos favoritos', + 'state_5' => 'Exibir artigos favoritos lidos', + 'state_6' => 'Exibir artigos favoritos não lidos', + 'state_7' => 'Exibir artigos favoritos', + 'state_8' => 'Exibir artigos que não são favoritos', + 'state_9' => 'Exibir artigos que não são favoritos lidos', + 'state_10' => 'Exibir artigos que não são favoritos não lidos', + 'state_11' => 'Exibir artigos que não são favoritos', + 'state_12' => 'Exibir todos os artigos', + 'state_13' => 'Exibir artigos lidos', + 'state_14' => 'Exibir artigos não lidos', + 'state_15' => 'Exibir todos os artigos', + 'title' => 'Queries de usuários', + ), + 'profile' => array( + '_' => 'Gerenciamento de perfil', + 'delete' => array( + '_' => 'Remover conta', + 'warn' => 'Sua conta e todos os dados relacionados serão removidos.', + ), + 'password_api' => 'Senha da API<br /><small>(p.s., para aplicativos móveis)</small>', + 'password_form' => 'Senha<br /><small>(para o método de formulário web)</small>', + 'password_format' => 'Ao menos 7 caracteres', + 'title' => 'Perfil', + ), + 'reading' => array( + '_' => 'Leitura', + 'after_onread' => 'Depois de "marcar todos como lido",', + 'articles_per_page' => 'Número de artigos por página', + 'auto_load_more' => 'Carregar mais artigos no final da página', + 'auto_remove_article' => 'Esconder artigos depois de lidos', + 'mark_updated_article_unread' => 'Marcar artigos atualizados como não lidos', + 'confirm_enabled' => 'Exibir uma caixa de diálogo de confirmação quando acionar "marcar todos como lido"', + 'display_articles_unfolded' => 'Mostrar aritogs abertos por padrão', + 'display_categories_unfolded' => 'Mostrar artigos fechados por padrão', + 'hide_read_feeds' => 'Esconder categorias e feeds com nenhum artigo não lido (não funciona com a configuração "Mostrar todos os artigos”)', + 'img_with_lazyload' => 'Utilizar o modo "lazy load" para carregar as imagens', + 'sides_close_article' => 'Clicando fora da área do texto do artigo fecha o mesmo', + 'jump_next' => 'Vá para o próximo irmão não lido (feed ou categoria)', + 'number_divided_when_reader' => 'Dividido por 2 no modo de leitura .', + 'read' => array( + 'article_open_on_website' => 'quando o artigo é aberto no site original', + 'article_viewed' => 'Quando o artigo é visualizado', + 'scroll' => 'enquando scrolling', + 'upon_reception' => 'ao receber um artigo', + 'when' => 'Marcar artigo como lido…', + ), + 'show' => array( + '_' => 'Artigos para exibir', + 'adaptive' => 'Ajustar visualização', + 'all_articles' => 'Exibir todos os artigos', + 'unread' => 'Exibir apenas não lido', + ), + 'sort' => array( + '_' => 'Ordem de visualização', + 'newer_first' => 'Novos primeiro', + 'older_first' => 'Antigos primeiro', + ), + 'sticky_post' => 'Coloque o artigo no topo quando aberto', + 'title' => 'Lendo', + 'view' => array( + 'default' => 'Visualização padrão', + 'global' => 'Visualização global', + 'normal' => 'Visualização normal', + 'reader' => 'Visualização de leitura', + ), + ), + 'sharing' => array( + '_' => 'Compartilhando', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Mais informação', + 'print' => 'Imprimir', + 'shaarli' => 'Shaarli', + 'share_name' => 'Nome de visualização para compartilhar', + 'share_url' => 'URL utilizada para compartilhar', + 'title' => 'Compartilhando', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Atalhos', + 'article_action' => 'Ações no artigo', + 'auto_share' => 'Compartilhar', + 'auto_share_help' => 'Se há apenas um modo de compartilhamento, ele é usado. Caso contrário, serão acessíveis pelo seu número.', + 'close_dropdown' => 'Fechar menus', + 'collapse_article' => 'Fechar', + 'first_article' => 'Ir para o primeiro artigo', + 'focus_search' => 'Acessar a caixa de busca', + 'help' => 'Mostrar documentação', + 'javascript' => 'JavaScript deve ser habilitado para utilizar atalhos', + 'last_article' => 'Ir para o último artigo', + 'load_more' => 'Carregar mais artigos', + 'mark_read' => 'Marcar como lido', + 'mark_favorite' => 'Marcar como favorito', + 'navigation' => 'Navegação', + 'navigation_help' => 'Com o modificador "Shift", atalhos de navegação aplicam aos feeds.<br/>Com o "Alt" modificador, atalhos de navegação aplicam as categorias.', + 'next_article' => 'Pule para o próximo artigo', + 'other_action' => 'Outras ações', + 'previous_article' => 'Pule para o artigo anterior', + 'see_on_website' => 'Visualize o site original', + 'shift_for_all_read' => '+ <code>shift</code> para marcar todos os artigos como lido', + 'title' => 'Atalhos', + 'user_filter' => 'Acesse filtros de usuário', + 'user_filter_help' => 'Se há apenas um filtro, ele é utilizado. Caso contrário, os filtros serão acessíveis pelos seus números.', + ), + 'user' => array( + 'articles_and_size' => '%s artigos (%s)', + 'current' => 'Usuário atual', + 'is_admin' => 'é administrador', + 'users' => 'Usuários', + ), +); diff --git a/app/i18n/pt-br/feedback.php b/app/i18n/pt-br/feedback.php new file mode 100644 index 000000000..0959ad38e --- /dev/null +++ b/app/i18n/pt-br/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Otimização Completa', + ), + 'access' => array( + 'denied' => 'Você não tem permissão para acessar esta página', + 'not_found' => 'VocÊ está buscando por uma página que não existe', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Um problema ocorreu durante o sistema de configuração para autenticação. Por favor tente mais tarde.', + 'set' => 'Formulário é agora seu sistema de autenticação padrão.', + ), + 'login' => array( + 'invalid' => 'Login está incorreto', + 'success' => 'Vocé está conectado', + ), + 'logout' => array( + 'success' => 'Você está desconectado', + ), + 'no_password_set' => 'A senha do administrador não foi definida. Este recurso não está disponível.', + ), + 'conf' => array( + 'error' => 'Um erro ocorreu durante o salvamento das configurações', + 'query_created' => 'Query "%s" foi criada.', + 'shortcuts_updated' => 'Atalhos foram criados', + 'updated' => 'Configuração foi atualizada', + ), + 'extensions' => array( + 'already_enabled' => '%s já está habilitado', + 'disable' => array( + 'ko' => '%s não pode ser desabilitado. <a href="%s">verifique os logs do FressRSS</a> para detalhes.', + 'ok' => '%s agora está desabilitado', + ), + 'enable' => array( + 'ko' => '%s não pode ser habilitado. <a href="%s">verifique os logs do FressRSS</a> para detalhes.', + 'ok' => '%s agora está habilitado', + ), + 'no_access' => 'Você não tem acesso ao %s', + 'not_enabled' => '%s não está habilitado', + 'not_found' => '%s não existe', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'extensão ZIP não está presente em seu servidor. Por favor tente exportar os arquivos um por vez.', + 'feeds_imported' => 'Seus feeds foram importados e serão atualizados agora', + 'feeds_imported_with_errors' => 'Seus feeds foram importados, mas alguns erros ocorreram', + 'file_cannot_be_uploaded' => 'Arquivo não pôde ser enviado', + 'no_zip_extension' => 'extensão ZIP não está presente em seu servidor.', + 'zip_error' => 'Um erro ocorreu durante a importação do arquivo ZIP.', + ), + 'sub' => array( + 'actualize' => 'Atualizando', + 'category' => array( + 'created' => 'Categoria %s foi criada.', + 'deleted' => 'Categoria foi deletada.', + 'emptied' => 'Categoria foi esvaziada', + 'error' => 'Categoria não pode ser atualizada', + 'name_exists' => 'Este nome de categoria já existe.', + 'no_id' => 'Você precisa especificar um id para a categoria.', + 'no_name' => 'Nome da categoria não pode ser vazio.', + 'not_delete_default' => 'Você não pode deletar uma categoria vazia!', + 'not_exist' => 'A categoria não existe!', + 'over_max' => 'Você atingiu seu limite de categorias (%d)', + 'updated' => 'Categoria foi atualizada.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> foi atualizado', + 'actualizeds' => 'RSS feeds foi atualizado', + 'added' => 'RSS feed <em>%s</em> foi adicionado', + 'already_subscribed' => 'Você já está inscrito no <em>%s</em>', + 'deleted' => 'o Feed foi deletado', + 'error' => 'O feed não pode ser atualizado', + 'internal_problem' => 'O RSS feed não pôde ser adicionado. <a href="%s">Verifique os FressRSS logs</a> para detalhes.', + 'invalid_url' => 'URL <em>%s</em> é inválida', + 'marked_read' => 'Feeds foram marcados como lidos', + 'n_actualized' => '%d feeds foram atualizados', + 'n_entries_deleted' => '%d artigos foram deletados', + 'no_refresh' => 'Não há feed para atualizar…', + 'not_added' => '<em>%s</em> não pode ser atualizado', + 'over_max' => 'Você atingiu seu limite de feeds (%d)', + 'updated' => 'Feed foram atualizados', + ), + 'purge_completed' => 'Limpeza completa (%d artigos deletados)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS será atualizado para a <strong>versão %s</strong>.', + 'error' => 'O processo de atualização encontrou um erro: %s', + 'file_is_nok' => 'Nova <strong>versão %s</strong> disponível, mas verifique as permissões no diretório <em>%s</em>. Servidor HTTP deve ter direitos para escrever dentro', + 'finished' => 'Atualização completa!', + 'none' => 'Nenhuma atualização para aplicar', + 'server_not_found' => 'Servidor de atualização não pôde ser localizado. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Usuário %s foi criado', + 'error' => 'Usuário %s não pode ser criado', + ), + 'deleted' => array( + '_' => 'Usuário %s foi deletado', + 'error' => 'Usuário %s não pode ser deletado', + ), + ), + 'profile' => array( + 'error' => 'Your profile cannot be modified', + 'updated' => 'Your profile has been modified', + ), +); diff --git a/app/i18n/pt-br/gen.php b/app/i18n/pt-br/gen.php new file mode 100644 index 000000000..e313b0d8b --- /dev/null +++ b/app/i18n/pt-br/gen.php @@ -0,0 +1,189 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Atualizar', + 'back_to_rss_feeds' => '← Volte para o seu feeds RSS', + 'cancel' => 'Cancelar', + 'create' => 'Criar', + 'disable' => 'Desabilitar', + 'empty' => 'Vazio', + 'enable' => 'Habilitar', + 'export' => 'Exportar', + 'filter' => 'Filtrar', + 'import' => 'Importar', + 'manage' => 'Gerenciar', + 'mark_favorite' => 'Marcar como favorito', + 'mark_read' => 'Marcar como lido', + 'remove' => 'Remover', + 'see_website' => 'Ver o site', + 'submit' => 'Enviar', + 'truncate' => 'Deletar todos os artigos', + ), + 'auth' => array( + 'email' => 'Endereço de e-mail', + 'keep_logged_in' => 'Mantenha logado por <small>(%s days)</small>', + 'login' => 'Login', + 'logout' => 'Logout', + 'password' => array( + '_' => 'Senha', + 'format' => '<small>Ao menos 7 caracteres</small>', + ), + 'registration' => array( + '_' => 'Nova conta', + 'ask' => 'Criar novoa conta?', + 'title' => 'Criação de conta', + ), + 'reset' => 'Reset autenticação', + 'username' => array( + '_' => 'Usuário', + 'admin' => 'Usuário administrador', + 'format' => '<small>máximo 16 caracteres alphanumericos</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\b\\r\\i\\l', + 'Aug' => '\\A\\g\\o\\s\\t\\o', + 'Dec' => '\\D\\e\\z\\e\\m\\b\\r\\o', + 'Feb' => '\\F\\e\\v\\e\\r\\e\\i\\r\\o', + 'Jan' => '\\J\\a\\n\\e\\i\\r\\o', + 'Jul' => '\\J\\u\\l\\h\\o', + 'Jun' => '\\J\\u\\n\\h\\o', + 'Mar' => '\\M\\a\\r\\ç\\o', + 'May' => '\\M\\a\\i\\o', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\r\\o', + 'Oct' => '\\O\\u\\t\\u\\b\\r\\o', + 'Sep' => '\\S\\e\\t\\e\\m\\b\\r\\o', + 'apr' => 'abr', + 'april' => 'Abr', + 'aug' => 'ago', + 'august' => 'Ago', + 'before_yesterday' => 'Antes de ontem', + 'dec' => 'dez', + 'december' => 'Dez', + 'feb' => 'fev', + 'february' => 'Fev', + 'format_date' => 'j \\d\\e %s \\d\\e Y', + 'format_date_hour' => 'j \\d\\e %s \\d\\e Y\\, H\\:i', + 'fri' => 'Sex', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Últimos três meses', + 'last_6_month' => 'Últimos seis meses', + 'last_month' => 'Últimos mês', + 'last_week' => 'Última semana', + 'last_year' => 'Último ano', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'Mai', + 'mon' => 'Seg', + 'month' => 'meses', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'out', + 'october' => 'Out', + 'sat' => 'Sab', + 'sep' => 'set', + 'september' => 'Set', + 'sun' => 'Dom', + 'thu' => 'Qui', + 'today' => 'Hoje', + 'tue' => 'Ter', + 'wed' => 'Qua', + 'yesterday' => 'Ontem', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Sobre FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Categoria vazia', + 'confirm_action' => 'Você tem certeza que deseja efetuar esta ação? Ela não poderá ser cancelada!', + 'confirm_action_feed_cat' => 'Você tem certeza que deseja efetuar esta ação ? Você irá perder favoritos e queries de usuários. Não poderá ser cancelado!', + 'feedback' => array( + 'body_new_articles' => 'Há %%d novos artigos para ler no FreshRSS.', + 'request_failed' => 'Uma solicitação falhou, isto pode ter sido causado por problemas de conexão com a internet.', + 'title_new_articles' => 'FreshRSS: novos artigos!', + ), + 'new_article' => 'Há novos artigos disponíveis, clique para atualizar a página.', + 'should_be_activated' => 'JavaScript precisa estar ativo', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'Sobre', + 'admin' => 'Administração', + 'archiving' => 'Arquivar', + 'authentication' => 'Autenticação', + 'check_install' => 'Verificação de instalação', + 'configuration' => 'Configuração', + 'display' => 'Visualização', + 'extensions' => 'Extensões', + 'logs' => 'Logs', + 'queries' => 'Queries de usuário', + 'reading' => 'Leitura', + 'search' => 'Procurar por palavras ou #tags', + 'sharing' => 'Compartilhamento', + 'shortcuts' => 'Atalhos', + 'stats' => 'Estatísticas', + 'system' => 'Configuração do sistema', + 'update' => 'Atualização', + 'user_management' => 'Gerenciamento de usuários', + 'user_profile' => 'Perfil', + ), + 'pagination' => array( + 'first' => 'Primeiro', + 'last' => 'Último', + 'load_more' => 'Carregar mais artigos', + 'mark_all_read' => 'Marcar todos como lidos', + 'next' => 'Próximo', + 'nothing_to_load' => 'Não há mais artigos', + 'previous' => 'Anterior', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Imprimir', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Atencão!', + 'blank_to_disable' => 'Deixe em branco para desativar', + 'by_author' => 'Por <em>%s</em>', + 'by_default' => 'Por padrão', + 'damn' => 'Buumm!', + 'default_category' => 'Sem categoria', + 'no' => 'Não', + 'not_applicable' => 'Não disponível', + 'ok' => 'Ok!', + 'or' => 'ou', + 'yes' => 'Sim', + ), +); diff --git a/app/i18n/pt-br/index.php b/app/i18n/pt-br/index.php new file mode 100644 index 000000000..610f00840 --- /dev/null +++ b/app/i18n/pt-br/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Sobre', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Reportar Bugs', + 'credits' => 'Créditos', + 'credits_content' => 'Alguns elementos de design vieram do <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> Embora FreshRRS não utiliza este framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Ícones</a> vieram do <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police foi criada por <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS é baseado no <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, um framework PHP.', + 'freshrss_description' => 'FreshRSS é um RSS feeds aggregator para um host próprio como o <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. É leve e fácil de utilizar enquanto é uma ferramenta poderosa e configurável. ', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">no Github</a>', + 'license' => 'licença', + 'project_website' => 'Site do projeto', + 'title' => 'Sobre', + 'version' => 'Versão', + 'website' => 'Site', + ), + 'feed' => array( + 'add' => 'Você pode adicionar alguns feeds.', + 'empty' => 'Não há nenhum artigo para mostrar.', + 'rss_of' => 'RSS feed do %s', + 'title' => 'Seus RSS feeds', + 'title_global' => 'Visualização Global', + 'title_fav' => 'Seus favoritos', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Limpar logs', + 'empty' => 'Arquivo de log está vazio', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'Sobre o FreshRSS', + 'add_query' => 'Adicionar uma query', + 'before_one_day' => 'Antes de um dia', + 'before_one_week' => 'Antes de uma semana', + 'favorites' => 'Favoritos (%s)', + 'global_view' => 'Visualização global', + 'main_stream' => 'Stream principal', + 'mark_all_read' => 'Marcar todos como lidos', + 'mark_cat_read' => 'Marcar categoria como lida', + 'mark_feed_read' => 'Marcar feed com lido', + 'newer_first' => 'Novos primeiro', + 'non-starred' => 'Mostrar todos, exceto favoritos', + 'normal_view' => 'visualização normal', + 'older_first' => 'Antigos primeiro', + 'queries' => 'Queries do usuário', + 'read' => 'Mostrar apenas lidos', + 'reader_view' => 'Visualização de leitura', + 'rss_view' => 'RSS feed', + 'search_short' => 'Buscar', + 'starred' => 'Mostrar apenas os favoritos', + 'stats' => 'Estatísticas', + 'subscription' => 'Gerenciamento de inscrições', + 'unread' => 'Mostrar apenas os não lidos', + ), + 'share' => 'Compartilhar', + 'tag' => array( + 'related' => 'Tags relacionadas', + ), +); diff --git a/app/i18n/pt-br/install.php b/app/i18n/pt-br/install.php new file mode 100644 index 000000000..3ca5fb854 --- /dev/null +++ b/app/i18n/pt-br/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Instalação completa', + 'fix_errors_before' => 'Por favor resolva os erros antes de ir para o próximo passo.', + 'keep_install' => 'Mantenha as configurações anteriores', + 'next_step' => 'Vá para o próximo passo', + 'reinstall' => 'Reinstale o FreshRSS', + ), + 'auth' => array( + 'form' => 'Formulário web(tradicional, necessita JavaScript)', + 'http' => 'HTTP (Para usuários avançados com HTTPS)', + 'none' => 'None (perigoso)', + 'password_form' => 'Senha<br /><small>(Para o método do login pelo formulário)</small>', + 'password_format' => 'Ao menos 7 caracteres', + 'type' => 'Método de autenticação', + ), + 'bdd' => array( + '_' => 'Banco de dados', + 'conf' => array( + '_' => 'Configuração do banco de dados', + 'ko' => 'Verifique as informações do seu banco de dados.', + 'ok' => 'Configurações do banco de dados foram salvas.', + ), + 'host' => 'Host', + 'prefix' => 'Prefixo da tabela', + 'password' => 'Senha do banco de dados', + 'type' => 'Tipo do banco de dados', + 'username' => 'Usuário do banco de dados', + ), + 'check' => array( + '_' => 'Verificações', + 'already_installed' => 'Verificamos que o FreshRSS já está instalado!', + 'cache' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data/cache</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório cache estão corretos.', + ), + 'ctype' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessária para verificação do tipo de caractere (php-ctype).', + 'ok' => 'Você tem a biblioteca necessária para verificação do tipo de caractere (ctype).', + ), + 'curl' => array( + 'nok' => 'Não foi possível encontrar a biblioteca cURL (php-curl).', + 'ok' => 'Você tem a biblioteca cURL.', + ), + 'data' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório data estão corretos.', + ), + 'dom' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessária para navegar pelo DOM (php-xml).', + 'ok' => 'Você tem a biblioteca necessária para navegar pelo DOM.', + ), + 'favicons' => array( + 'nok' => 'Verifique as permissões no diretório <em>./data/favicons</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório favicons estão corretos.', + ), + 'fileinfo' => array( + 'nok' => 'Não foi possível encontrar a biblioteca fileinfo do PHP (fileinfo).', + 'ok' => 'Você tem a biblioteca fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Por favor verifique se você não está alterando seu HTTP REFERER.', + 'ok' => 'Seu HTTP REFERER é conhecido e corresponde ao seu servidor.', + ), + 'json' => array( + 'nok' => 'Não foi possível encontrar JSON (php5-json).', + 'ok' => 'Você tem a extensão JSON.', + ), + 'minz' => array( + 'nok' => 'Não foi possível encontrar o framework Minz.', + 'ok' => 'Você tem o framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Não foi possível encontrar uma biblioteca necessário para expressões regulares (php-pcre).', + 'ok' => 'Você tem a biblioteca necessária para expressões regulares (php-pcre).', + ), + 'pdo' => array( + 'nok' => 'Não foi encontrado o PDO ou um dos drivers suportados (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Você tem o PDO e ao menos um dos drivers suportados (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Sua versão do PHP é %s mas FreshRSS requer ao menos a versão %s.', + 'ok' => 'Sua versão do PHP é %s, que é compatível com o FreshRSS.', + ), + 'users' => array( + 'nok' => 'Verifiquei as permissões no diretório <em>./data/users</em>. O servidor HTTP deve ter direitos para escrever dentro desta pasta.', + 'ok' => 'Permissões no diretório users estão corretos.', + ), + 'xml' => array( + 'nok' => 'Não foi possível encontrar a biblioteca necessária para parse o XML.', + 'ok' => 'Você tem a biblioteca necessária para parse o XML.', + ), + ), + 'conf' => array( + '_' => 'Configurações gerais', + 'ok' => 'Configurações gerais foram salvas.', + ), + 'congratulations' => 'Parabéns!', + 'default_user' => 'Usuário do usuário padrão <small>(máximo de 16 caracteres alphanumericos)</small>', + 'delete_articles_after' => 'Remover artigos depois', + 'fix_errors_before' => 'Por favor solucione os erros antes de ir para o próximo passo.', + 'javascript_is_better' => 'FreshRSS é mais agradável com o JavaScript ativo', + 'js' => array( + 'confirm_reinstall' => 'Você irá perder suas configurações anteriores ao reinstalar o FreshRSS. Você está certo que deseja continuar?', + ), + 'language' => array( + '_' => 'Idioma', + 'choose' => 'Escolhar o idioma para o FreshRSS', + 'defined' => 'Idioma foi definido.', + ), + 'not_deleted' => 'Algo deu errado; você deve deletar o arquivo <em>%s</em> manualmente.', + 'ok' => 'O processo de instalação foi um sucesso.', + 'step' => 'passo %d', + 'steps' => 'Passos', + 'title' => 'Instalação · FreshRSS', + 'this_is_the_end' => 'Este é o final', +); diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php new file mode 100644 index 000000000..4249dcabf --- /dev/null +++ b/app/i18n/pt-br/sub.php @@ -0,0 +1,71 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), + 'category' => array( + '_' => 'Categoria', + 'add' => 'Adicionar uma categoria', + 'empty' => 'Categoria vazia', + 'new' => 'Nova categoria', + ), + 'feed' => array( + 'add' => 'Adicionar um RSS feed', + 'advanced' => 'Avançado', + 'archiving' => 'Arquivar', + 'auth' => array( + 'configuration' => 'Login', + 'help' => 'Permite acesso a feeds RSS protegidos por HTTP', + 'http' => 'Autenticação HTTP', + 'password' => 'Senha HTTP', + 'username' => 'Usuário HTTP', + ), + 'css_help' => 'Retorna RSS feeds truncados (atenção, requer mais tempo!)', + 'css_path' => 'Caminho do CSS do artigo no site original', + 'description' => 'Descrição', + 'empty' => 'Este feed está vazio. Por favor verifique ele ainda é mantido.', + 'error' => 'Este feed encontra-se com problema. Por favor verifique se ele ainda está disponível e atualize-o.', + 'in_main_stream' => 'Mostrar na tela principal', + 'informations' => 'Informações', + 'keep_history' => 'Número mínimo de artigos para manter', + 'moved_category_deleted' => 'Quando você deleta uma categoria, seus feeds são automaticamente classificados como <em>%s</em>.', + 'no_selected' => 'Nenhum feed selecionado.', + 'number_entries' => '%d artigos', + 'stats' => 'Estatísticas', + 'think_to_add' => 'Você deve adicionar alguns feeds.', + 'title' => 'Título', + 'title_add' => 'Adicionar o RSS feed', + 'ttl' => 'Não atualize automáticamente mais que', + 'url' => 'Feed URL', + 'validator' => 'Verifique a validade do feed', + 'website' => 'URL do site', + 'pubsubhubbub' => 'Notificação instantânea com PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Exportar', + 'export_opml' => 'Exporta a lista dos feeds (OPML)', + 'export_starred' => 'Exportar seus favoritos', + 'feed_list' => 'Lista dos %s artigos', + 'file_to_import' => 'Arquivo para importar<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'Arquivo para importar<br />(OPML or JSON)', + 'import' => 'Importar', + 'starred_list' => 'Listar artigos favoritos', + 'title' => 'Importar / exportar', + ), + 'menu' => array( + 'bookmark' => 'Inscreva-se (FreshRSS favoritos)', + 'import_export' => 'Importar / exportar', + 'subscription_management' => 'Gerenciamento de inscrições', + ), + 'title' => array( + '_' => 'Gerenciamento de inscrições', + 'feed_management' => 'Gerenciamento dos RSS feeds', + ), +); diff --git a/app/i18n/ru/admin.php b/app/i18n/ru/admin.php new file mode 100644 index 000000000..d877c5006 --- /dev/null +++ b/app/i18n/ru/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Разрешить анонимное чтение статей для пользователя по умолчанию (%s)', + 'allow_anonymous_refresh' => 'Разрешить анонимное обновление статей', + 'api_enabled' => 'Включить доступ к <abbr>API</abbr> <small>(необходимо для мобильных приложений)</small>', + 'form' => 'На основе веб-формы (традиционный, необходим JavaScript)', + 'http' => 'HTTP (для продвинутых пользователей - по HTTPS)', + 'none' => 'Без аутентификации (небезопасный)', + 'title' => 'Аутентификации', + 'title_reset' => 'Сброс аутентицикации', + 'token' => 'Токен аутентификации', + 'token_help' => 'Разрешает доступ к RSS ленте пользователя по умолчанию без аутентификации:', + 'type' => 'Метод аутентификации', + 'unsafe_autologin' => 'Разрешить небезопасный автоматический вход с использованием следующего формата: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/cache</em>. Сервер HTTP должен иметь права на запись в эту папку', + 'ok' => 'Права на <em>./data/cache</em> в порядке.', + ), + 'categories' => array( + 'nok' => 'Таблица категорий настроена неправильно.', + 'ok' => 'Таблица категорий настроена правильно.', + ), + 'connection' => array( + 'nok' => 'Подключение к базе данных не может быть установлено.', + 'ok' => 'Подключение к базе данных в порядке.', + ), + 'ctype' => array( + 'nok' => 'У вас не установлена библиотека для проверки типов символов (php-ctype).', + 'ok' => 'У вас не установлена библиотека для проверки типов символов (ctype).', + ), + 'curl' => array( + 'nok' => 'У вас не установлено расширение cURL (пакет php-curl).', + 'ok' => 'У вас установлено расширение cURL.', + ), + 'data' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на <em>./data/</em> в порядке.', + ), + 'database' => 'Установка базы данных', + 'dom' => array( + 'nok' => 'У вас не установлена библиотека для просмотра DOM (пакет php-xml).', + 'ok' => 'У вас установлена библиотека для просмотра DOM.', + ), + 'entries' => array( + 'nok' => 'Таблица статей (entry) неправильно настроена.', + 'ok' => 'Таблица статей (entry) настроена правильно.', + ), + 'favicons' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/favicons</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку значков в порядке.', + ), + 'feeds' => array( + 'nok' => 'Таблица подписок (feed) неправильно настроена.', + 'ok' => 'Таблица подписок (feed) настроена правильно.', + ), + 'fileinfo' => array( + 'nok' => 'У вас не установлено расширение PHP fileinfo (пакет fileinfo).', + 'ok' => 'У вас установлено расширение fileinfo.', + ), + 'files' => 'Установка файлов', + 'json' => array( + 'nok' => 'У вас не установлена библиотека для работы с JSON (пакет php5-json).', + 'ok' => 'У вас установлена библиотека для работы с JSON.', + ), + 'minz' => array( + 'nok' => 'У вас не установлен фрейворк Minz.', + 'ok' => 'У вас установлен фрейворк Minz.', + ), + 'pcre' => array( + 'nok' => 'У вас не установлена необходимая библиотека для работы с регулярными выражениями (php-pcre).', + 'ok' => 'У вас установлена необходимая библиотека для работы с регулярными выражениями (PCRE).', + ), + 'pdo' => array( + 'nok' => 'У вас не установлен PDO или один из необходимых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'У вас установлен PDO и как минимум один из поддерживаемых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP installation', + 'nok' => 'У вас установлен PHP версии %s, но FreshRSS необходима версия не ниже %s.', + 'ok' => 'У вас установлен PHP версии %s, который совместим с FreshRSS.', + ), + 'tables' => array( + 'nok' => 'В базе данных отсуствует одна или больше таблица.', + 'ok' => 'Все таблицы есть в базе данных.', + ), + 'title' => 'Проверка установки и настройки', + 'tokens' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/tokens</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку tokens в порядке.', + ), + 'users' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/users</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку users в порядке.', + ), + 'zip' => array( + 'nok' => 'You lack ZIP extension (php-zip package).', + 'ok' => 'You have ZIP extension.', + ), + ), + 'extensions' => array( + 'disabled' => 'Отключены', + 'empty_list' => 'Расширения не установлены', + 'enabled' => 'Включены', + 'no_configure_view' => 'Это расширение нельзя настроить.', + 'system' => array( + '_' => 'Системные расширения', + 'no_rights' => 'Системные расширения (у вас нет к ним доступа)', + ), + 'title' => 'Расширения', + 'user' => 'Расширения пользователя', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => 'Статистика', + 'all_feeds' => 'Все подписки', + 'category' => 'Категория', + 'entry_count' => 'Количество статей', + 'entry_per_category' => 'Статей в категории', + 'entry_per_day' => 'Статей за день (за последние 30 дней)', + 'entry_per_day_of_week' => 'За неделю (в среднем - %.2f сообщений)', + 'entry_per_hour' => 'За час (в среднем - %.2f сообщений)', + 'entry_per_month' => 'За месяц (в среднем - %.2f сообщений)', + 'entry_repartition' => 'Перерасределение статей', + 'feed' => 'Подписка', + 'feed_per_category' => 'Подписок в категории', + 'idle' => 'Неактивные подписки', + 'main' => 'Основная статистика', + 'main_stream' => 'Основной поток', + 'menu' => array( + 'idle' => 'Неактивные подписки', + 'main' => 'Основная статистика', + 'repartition' => 'Перерасределение статей', + ), + 'no_idle' => 'Нет неактивных подписок!', + 'number_entries' => 'статей: %d', + 'percent_of_total' => '%% от всего', + 'repartition' => 'Перераспределение статей', + 'status_favorites' => 'Избранное', + 'status_read' => 'Читать', + 'status_total' => 'Всего', + 'status_unread' => 'Не прочитано', + 'title' => 'Статистика', + 'top_feed' => '10 лучших подписок', + ), + 'system' => array( + '_' => 'Системные настройки', + 'auto-update-url' => 'Адрес сервера для автоматического обновления', + 'instance-name' => 'Название этого сервера', + 'max-categories' => 'Количество категорий на пользователя', + 'max-feeds' => 'Количество статей на пользователя', + 'registration' => array( + 'help' => '0 означает неограниченное количество пользователей', + 'number' => 'Максимальное количество пользователей', + ), + ), + 'update' => array( + '_' => 'Обновление системы', + 'apply' => 'Применить', + 'check' => 'Проверить обновления', + 'current_version' => 'Ваша текущая версия FreshRSS: %s.', + 'last' => 'Последняя проверка: %s', + 'none' => 'Нечего обновлять', + 'title' => 'Обновить систему', + ), + 'user' => array( + 'articles_and_size' => '%s статей (%s)', + 'create' => 'Создать нового пользователя', + 'language' => 'Язык', + 'number' => 'На данный момент создан %d аккаунт', + 'numbers' => 'На данный момент аккаунтов создано: %d', + 'password_form' => 'Пароль<br /><small>(для входа через Веб-форму)</small>', + 'password_format' => 'Минимум 7 символов', + 'title' => 'Управление пользователями', + 'user_list' => 'Список пользователей', + 'username' => 'Имя пользователя', + 'users' => 'Пользователи', + ), +); diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php new file mode 100644 index 000000000..9c61754ae --- /dev/null +++ b/app/i18n/ru/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Архивация', + 'advanced' => 'Продвинутые настройки', + 'delete_after' => 'Удалять статьи после', + 'help' => 'Каждую подписку можно настроить более гибко', + 'keep_history_by_feed' => 'Minimum number of articles to keep by feed', + 'optimize' => 'Оптимизировать базу данных', + 'optimize_help' => 'To do occasionally to reduce the size of the database', + 'purge_now' => 'Очистить сейчас', + 'title' => 'Архивация', + 'ttl' => 'Не обновлять чаще чем', + ), + 'display' => array( + '_' => 'Display', + 'icon' => array( + 'bottom_line' => 'Bottom line', + 'entry' => 'Article icons', + 'publication_date' => 'Date of publication', + 'related_tags' => 'Related tags', + 'sharing' => 'Sharing', + 'top_line' => 'Top line', + ), + 'language' => 'Язык', + 'notif_html5' => array( + 'seconds' => 'seconds (0 means no timeout)', + 'timeout' => 'HTML5 notification timeout', + ), + 'theme' => 'Тема', + 'title' => 'Display', + 'width' => array( + 'content' => 'Content width', + 'large' => 'Large', + 'medium' => 'Medium', + 'no_limit' => 'No limit', + 'thin' => 'Thin', + ), + ), + 'query' => array( + '_' => 'User queries', + 'deprecated' => 'This query is no longer valid. The referenced category or feed has been deleted.', + 'filter' => 'Filter applied:', + 'get_all' => 'Display all articles', + 'get_category' => 'Display "%s" category', + 'get_favorite' => 'Display favorite articles', + 'get_feed' => 'Display "%s" feed', + 'no_filter' => 'No filter', + 'none' => 'You haven’t created any user query yet.', + 'number' => 'Query n°%d', + 'order_asc' => 'Display oldest articles first', + 'order_desc' => 'Display newest articles first', + 'search' => 'Search for "%s"', + 'state_0' => 'Display all articles', + 'state_1' => 'Display read articles', + 'state_2' => 'Display unread articles', + 'state_3' => 'Display all articles', + 'state_4' => 'Display favorite articles', + 'state_5' => 'Display read favorite articles', + 'state_6' => 'Display unread favorite articles', + 'state_7' => 'Display favorite articles', + 'state_8' => 'Display not favorite articles', + 'state_9' => 'Display read not favorite articles', + 'state_10' => 'Display unread not favorite articles', + 'state_11' => 'Display not favorite articles', + 'state_12' => 'Display all articles', + 'state_13' => 'Display read articles', + 'state_14' => 'Display unread articles', + 'state_15' => 'Display all articles', + 'title' => 'User queries', + ), + 'profile' => array( + '_' => 'Profile management', + 'delete' => array( + '_' => 'Account deletion', + 'warn' => 'Your account and all the related data will be deleted.', + ), + 'password_api' => 'Password API<br /><small>(e.g., for mobile apps)</small>', + 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', + 'password_format' => 'At least 7 characters', + 'title' => 'Profile', + ), + 'reading' => array( + '_' => 'Reading', + 'after_onread' => 'After “mark all as read”,', + 'articles_per_page' => 'Number of articles per page', + 'auto_load_more' => 'Load next articles at the page bottom', + 'auto_remove_article' => 'Hide articles after reading', + 'mark_updated_article_unread' => 'Mark updated articles as unread', + 'confirm_enabled' => 'Display a confirmation dialog on “mark all as read” actions', + 'display_articles_unfolded' => 'Show articles unfolded by default', + 'display_categories_unfolded' => 'Show categories folded by default', + 'hide_read_feeds' => 'Hide categories & feeds with no unread article (does not work with “Show all articles” configuration)', + 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', + 'sides_close_article' => 'Clicking outside of article text area closes the article', //TODO + 'jump_next' => 'jump to next unread sibling (feed or category)', + 'number_divided_when_reader' => 'Divided by 2 in the reading view.', + 'read' => array( + 'article_open_on_website' => 'when article is opened on its original website', + 'article_viewed' => 'when article is viewed', + 'scroll' => 'while scrolling', + 'upon_reception' => 'upon reception of the article', + 'when' => 'Mark article as read…', + ), + 'show' => array( + '_' => 'Articles to display', + 'adaptive' => 'Adjust showing', + 'all_articles' => 'Show all articles', + 'unread' => 'Show only unread', + ), + 'sort' => array( + '_' => 'Sort order', + 'newer_first' => 'Newer first', + 'older_first' => 'Oldest first', + ), + 'sticky_post' => 'Stick the article to the top when opened', + 'title' => 'Reading', + 'view' => array( + 'default' => 'Default view', + 'global' => 'Global view', + 'normal' => 'Normal view', + 'reader' => 'Reading view', + ), + ), + 'sharing' => array( + '_' => 'Sharing', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'More information', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'share_name' => 'Share name to display', + 'share_url' => 'Share URL to use', + 'title' => 'Sharing', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Article actions', + 'auto_share' => 'Share', + 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', + 'close_dropdown' => 'Close menus', + 'collapse_article' => 'Collapse', + 'first_article' => 'Skip to the first article', + 'focus_search' => 'Access search box', + 'help' => 'Display documentation', + 'javascript' => 'JavaScript must be enabled in order to use shortcuts', + 'last_article' => 'Skip to the last article', + 'load_more' => 'Load more articles', + 'mark_read' => 'Mark as read', + 'mark_favorite' => 'Mark as favourite', + 'navigation' => 'Navigation', + 'navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.', + 'next_article' => 'Skip to the next article', + 'other_action' => 'Other actions', + 'previous_article' => 'Skip to the previous article', + 'see_on_website' => 'See on original website', + 'shift_for_all_read' => '+ <code>shift</code> to mark all articles as read', + 'title' => 'Shortcuts', + 'user_filter' => 'Access user filters', + 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'current' => 'Current user', + 'is_admin' => 'is administrator', + 'users' => 'Users', + ), +); diff --git a/app/i18n/ru/feedback.php b/app/i18n/ru/feedback.php new file mode 100644 index 000000000..ffebd6dc9 --- /dev/null +++ b/app/i18n/ru/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimisation complete', //TODO + ), + 'access' => array( + 'denied' => 'You don’t have permission to access this page', //TODO + 'not_found' => 'You are looking for a page which doesn’t exist', //TODO + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'A problem occured during authentication system configuration. Please retry later.', //TODO + 'set' => 'Form is now your default authentication system.', //TODO + ), + 'login' => array( + 'invalid' => 'Login is invalid', //TODO + 'success' => 'You are connected', //TODO + ), + 'logout' => array( + 'success' => 'You are disconnected', //TODO + ), + 'no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', //TODO + ), + 'conf' => array( + 'error' => 'An error occurred during configuration saving', //TODO + 'query_created' => 'Query "%s" has been created.', //TODO + 'shortcuts_updated' => 'Shortcuts have been updated', //TODO + 'updated' => 'Configuration has been updated', //TODO + ), + 'extensions' => array( + 'already_enabled' => '%s is already enabled', //TODO + 'disable' => array( + 'ko' => '%s cannot be disabled. <a href="%s">Check FressRSS logs</a> for details.', //TODO + 'ok' => '%s is now disabled', //TODO + ), + 'enable' => array( + 'ko' => '%s cannot be enabled. <a href="%s">Check FressRSS logs</a> for details.', //TODO + 'ok' => '%s is now enabled', //TODO + ), + 'no_access' => 'You have no access on %s', //TODO + 'not_enabled' => '%s is not enabled yet', //TODO + 'not_found' => '%s does not exist', //TODO + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', //TODO + 'feeds_imported' => 'Your feeds have been imported and will now be updated', //TODO + 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', //TODO + 'file_cannot_be_uploaded' => 'File cannot be uploaded!', //TODO + 'no_zip_extension' => 'ZIP extension is not present on your server.', //TODO + 'zip_error' => 'An error occured during ZIP import.', //TODO + ), + 'sub' => array( + 'actualize' => 'Actualise', //TODO + 'category' => array( + 'created' => 'Category %s has been created.', //TODO + 'deleted' => 'Category has been deleted.', //TODO + 'emptied' => 'Category has been emptied', //TODO + 'error' => 'Category cannot be updated', //TODO + 'name_exists' => 'Category name already exists.', //TODO + 'no_id' => 'You must precise the id of the category.', //TODO + 'no_name' => 'Category name cannot be empty.', //TODO + 'not_delete_default' => 'You cannot delete the default category!', //TODO + 'not_exist' => 'The category does not exist!', //TODO + 'over_max' => 'You have reached your limit of categories (%d)', //TODO + 'updated' => 'Category has been updated.', //TODO + ), + 'feed' => array( + 'actualized' => '<em>%s</em> has been updated', //TODO + 'actualizeds' => 'RSS feeds have been updated', //TODO + 'added' => 'RSS feed <em>%s</em> has been added', //TODO + 'already_subscribed' => 'You have already subscribed to <em>%s</em>', //TODO + 'deleted' => 'Feed has been deleted', //TODO + 'error' => 'Feed cannot be updated', //TODO + 'internal_problem' => 'The RSS feed could not be added. <a href="%s">Check FressRSS logs</a> for details.', //TODO + 'invalid_url' => 'URL <em>%s</em> is invalid', //TODO + 'marked_read' => 'Feeds have been marked as read', //TODO + 'n_actualized' => '%d feeds have been updated', //TODO + 'n_entries_deleted' => '%d articles have been deleted', //TODO + 'no_refresh' => 'There is no feed to refresh…', //TODO + 'not_added' => '<em>%s</em> could not be added', //TODO + 'over_max' => 'You have reached your limit of feeds (%d)', //TODO + 'updated' => 'Feed has been updated', //TODO + ), + 'purge_completed' => 'Purge completed (%d articles deleted)', //TODO + ), + 'update' => array( + 'can_apply' => 'FreshRSS will now be updated to the <strong>version %s</strong>.', //TODO + 'error' => 'The update process has encountered an error: %s', //TODO + 'file_is_nok' => 'New <strong>version %s</strong> available, but check permissions on <em>%s</em> directory. HTTP server must have rights to write into', //TODO + 'finished' => 'Update completed!', //TODO + 'none' => 'No update to apply', //TODO + 'server_not_found' => 'Update server cannot be found. [%s]', //TODO + ), + 'user' => array( + 'created' => array( + '_' => 'User %s has been created', //TODO + 'error' => 'User %s cannot be created', //TODO + ), + 'deleted' => array( + '_' => 'User %s has been deleted', //TODO + 'error' => 'User %s cannot be deleted', //TODO + ), + ), + 'profile' => array( + 'error' => 'Your profile cannot be modified', //TODO + 'updated' => 'Your profile has been modified', //TODO + ), +); diff --git a/app/i18n/ru/gen.php b/app/i18n/ru/gen.php new file mode 100644 index 000000000..3283731df --- /dev/null +++ b/app/i18n/ru/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualize', + 'back_to_rss_feeds' => '← Go back to your RSS feeds', + 'cancel' => 'Cancel', + 'create' => 'Create', + 'disable' => 'Disable', + 'empty' => 'Empty', + 'enable' => 'Enable', + 'export' => 'Export', + 'filter' => 'Filter', + 'import' => 'Import', + 'manage' => 'Manage', + 'mark_favorite' => 'Mark as favourite', + 'mark_read' => 'Mark as read', + 'remove' => 'Remove', + 'see_website' => 'See website', + 'submit' => 'Submit', + 'truncate' => 'Delete all articles', + ), + 'auth' => array( + 'email' => 'Email address', + 'keep_logged_in' => 'Keep me logged in <small>(%s дней)</small>', + 'login' => 'Login', + 'logout' => 'Logout', + 'password' => array( + '_' => 'Password', + 'format' => '<small>At least 7 characters</small>', + ), + 'registration' => array( + '_' => 'New account', + 'ask' => 'Create an account?', + 'title' => 'Account creation', + ), + 'reset' => 'Authentication reset', + 'username' => array( + '_' => 'Username', + 'admin' => 'Administrator username', + 'format' => '<small>maximum 16 alphanumeric characters</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Before yesterday', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + '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', + 'fri' => 'Fri', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Last three months', + 'last_6_month' => 'Last six months', + 'last_month' => 'Last month', + 'last_week' => 'Last week', + 'last_year' => 'Last year', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'may_' => 'May', + 'mon' => 'Mon', + 'month' => 'months', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'oct', + 'october' => 'Oct', + 'sat' => 'Sat', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Today', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Yesterday', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'About FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Empty category', + 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favorites and user queries. It cannot be cancelled!', + 'feedback' => array( + 'body_new_articles' => 'There are %%d new articles to read on FreshRSS.', + 'request_failed' => 'A request has failed, it may have been caused by Internet connection problems.', + 'title_new_articles' => 'FreshRSS: new articles!', + ), + 'new_article' => 'There are new available articles, click to refresh the page.', + 'should_be_activated' => 'JavaScript must be enabled', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'About', + 'admin' => 'Administration', + 'archiving' => 'Archiving', + 'authentication' => 'Authentication', + 'check_install' => 'Installation checking', + 'configuration' => 'Configuration', + 'display' => 'Display', + 'extensions' => 'Extensions', + 'logs' => 'Logs', + 'queries' => 'User queries', + 'reading' => 'Reading', + 'search' => 'Search words or #tags', + 'sharing' => 'Sharing', + 'shortcuts' => 'Shortcuts', + 'stats' => 'Statistics', + 'system' => 'System configuration', + 'update' => 'Update', + 'user_management' => 'Manage users', + 'user_profile' => 'Profile', + ), + 'pagination' => array( + 'first' => 'First', + 'last' => 'Last', + 'load_more' => 'Load more articles', + 'mark_all_read' => 'Mark all as read', + 'next' => 'Next', + 'nothing_to_load' => 'There are no more articles', + 'previous' => 'Previous', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Warning!', + 'blank_to_disable' => 'Leave blank to disable', + 'by_author' => 'By <em>%s</em>', + 'by_default' => 'By default', + 'damn' => 'Damn!', + 'default_category' => 'Uncategorized', + 'no' => 'No', + 'not_applicable' => 'Not available', + 'ok' => 'Ok!', + 'or' => 'or', + 'yes' => 'Yes', + ), +); diff --git a/app/i18n/ru/index.php b/app/i18n/ru/index.php new file mode 100644 index 000000000..eb6413e3c --- /dev/null +++ b/app/i18n/ru/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'About', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bugs reports', + '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 has been created by <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.', + '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.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'About', + 'version' => 'Version', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'You may add some feeds.', + 'empty' => 'There is no article to show.', + 'rss_of' => 'RSS feed of %s', + 'title' => 'Your RSS feeds', + 'title_global' => 'Global view', + 'title_fav' => 'Your favourites', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Clear the logs', + 'empty' => 'Log file is empty', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'About FreshRSS', + 'add_query' => 'Add a query', + 'before_one_day' => 'Before one day', + 'before_one_week' => 'Before one week', + 'favorites' => 'Favourites (%s)', + 'global_view' => 'Global view', + 'main_stream' => 'Main stream', + 'mark_all_read' => 'Mark all as read', + 'mark_cat_read' => 'Mark category as read', + 'mark_feed_read' => 'Mark feed as read', + 'newer_first' => 'Newer first', + 'non-starred' => 'Show all but favorites', + 'normal_view' => 'Normal view', + 'older_first' => 'Oldest first', + 'queries' => 'User queries', + 'read' => 'Show only read', + 'reader_view' => 'Reading view', + 'rss_view' => 'RSS feed', + 'search_short' => 'Search', + 'starred' => 'Show only favorites', + 'stats' => 'Statistics', + 'subscription' => 'Subscriptions management', + 'unread' => 'Show only unread', + ), + 'share' => 'Share', + 'tag' => array( + 'related' => 'Related tags', + ), +); diff --git a/app/i18n/ru/install.php b/app/i18n/ru/install.php new file mode 100644 index 000000000..1dea2cd66 --- /dev/null +++ b/app/i18n/ru/install.php @@ -0,0 +1,111 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Завершить установку', + 'fix_errors_before' => 'Пожалуйста, исправьте ошибки прежде чем переходить к следующему этапу.', + 'keep_install' => 'Сохранить предыдущую установку', + 'next_step' => 'Перейти к следующему этапу', + 'reinstall' => 'Переустановить FreshRSS', + ), + 'auth' => array( + 'form' => 'Вэб-форма (традиционный, необходим JavaScript)', + 'http' => 'HTTP (для продвинутых пользователей с HTTPS)', + 'none' => 'Никакого (опасно)', + 'password_form' => 'Пароль<br /><small>(для метода аутентификации на Вэб-формах)</small>', + 'password_format' => 'Как минимум 7 букв', + 'type' => 'Метод аутентификации', + ), + 'bdd' => array( + '_' => 'База данных', + 'conf' => array( + '_' => 'Конфигурация базы данныхDatabase configuration', + 'ko' => 'Проверьте конфигурацию базы данных.', + 'ok' => 'Конфигурация базы данных сохранена.', + ), + 'host' => 'Хост', + 'prefix' => 'Префикс таблицы', + 'password' => 'Пароль базы данных', + 'type' => 'Тип базы данных', + 'username' => 'Имя пользователя базы данных', + ), + 'check' => array( + '_' => 'Проверки', + 'already_installed' => 'Обнаружена предыдущая установка FreshRSS!', + 'cache' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/cache</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку кэша в порядке.', + ), + 'ctype' => array( + 'nok' => 'У вас не установлена необходимая библиотека для проверки типов символов (php-ctype).', + 'ok' => 'У вас установлена необходимая библиотека для проверки типов символов (ctype).', + ), + 'curl' => array( + 'nok' => 'У вас нет расширения cURL (пакет php-curl).', + 'ok' => 'У вас установлено расширение cURL.', + ), + 'data' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на <em>./data/</em> в порядке.', + ), + 'dom' => array( + 'nok' => 'У вас не установлена необходимая библиотека для просмотра DOM (пакет php-xml).', + 'ok' => 'У вас установлена необходимая библиотека для просмотра DOM.', + ), + 'favicons' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/favicons</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку значков в порядке.', + ), + 'fileinfo' => array( + 'nok' => 'У вас нет расширения PHP fileinfo (пакет fileinfo).', + 'ok' => 'У вас установлено расширение fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Убедитесь, что вы не изменяете ваш HTTP REFERER.', + 'ok' => 'Ваш HTTP REFERER известен и соотвествует вашему серверу.', + ), + 'minz' => array( + 'nok' => 'У вас не установлен фрейворк Minz.', + 'ok' => 'У вас установлен фрейворк Minz.', + ), + 'pcre' => array( + 'nok' => 'У вас не установлена необходимая библиотека для работы с регулярными выражениями (php-pcre).', + 'ok' => 'У вас установлена необходимая библиотека для работы с регулярными выражениями (PCRE).', + ), + 'pdo' => array( + 'nok' => 'У вас не установлен PDO или один из необходимых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'У вас установлен PDO и как минимум один из поддерживаемых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'У вас установлен PHP версии %s, но FreshRSS необходима версия не ниже %s.', + 'ok' => 'У вас установлен PHP версии %s, который совместим с FreshRSS.', + ), + 'users' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/users</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку users в порядке.', + ), + ), + 'conf' => array( + '_' => 'Общие настройки', + 'ok' => 'Общие настройки были сохранены.', + ), + 'congratulations' => 'Поздравляем!', + 'default_user' => 'Имя пользователя по умолчанию <small>(максимум 16 латинских букв и/или цифр)</small>', + 'delete_articles_after' => 'Удалять статьи после', + 'fix_errors_before' => 'Пожалуйста, исправьте ошибки прежде чем переходить к следующему этапу..', + 'javascript_is_better' => 'FreshRSS принесёт больше удовольствия, если включить JavaScript', + 'js' => array( + 'confirm_reinstall' => 'Переустанавливая FreshRSS, вы потеряете предыдущую конфигурацию. Вы хотите продолжить?', + ), + 'language' => array( + '_' => 'Язык', + 'choose' => 'Выберите язык для FreshRSS', + 'defined' => 'Язык выбран.', + ), + 'not_deleted' => 'Что-то пошло не так; удалите файл <em>%s</em> вручную.', + 'ok' => 'Установка успешна.', + 'step' => '%d этап', + 'steps' => 'Этапы', + 'title' => 'Установка · FreshRSS', + 'this_is_the_end' => 'Это конец', +); diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php new file mode 100644 index 000000000..6a5530de0 --- /dev/null +++ b/app/i18n/ru/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), + 'category' => array( + '_' => 'Category',// TODO + 'add' => 'Add a category',// TODO + 'empty' => 'Empty category',// TODO + 'new' => 'New category',// TODO + ), + 'feed' => array( + 'add' => 'Add a RSS feed',// TODO + 'advanced' => 'Advanced',// TODO + 'archiving' => 'Archivage',// TODO + 'auth' => array( + 'configuration' => 'Login',// TODO + 'help' => 'Connection allows to access HTTP protected RSS feeds',// TODO + 'http' => 'HTTP Authentication',// TODO + 'password' => 'HTTP password',// TODO + 'username' => 'HTTP username',// TODO + ), + 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',// TODO + 'css_path' => 'Articles CSS path on original website',// TODO + 'description' => 'Description',// TODO + 'empty' => 'This feed is empty. Please verify that it is still maintained.',// TODO + 'error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.',// TODO + 'in_main_stream' => 'Show in main stream',// TODO + 'informations' => 'Information',// TODO + 'keep_history' => 'Minimum number of articles to keep',// TODO + 'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.',// TODO + 'no_selected' => 'No feed selected.',// TODO + 'number_entries' => '%d articles',// TODO + 'stats' => 'Statistics',// TODO + 'think_to_add' => 'You may add some feeds.',// TODO + 'title' => 'Title',// TODO + 'title_add' => 'Add a RSS feed',// TODO + 'ttl' => 'Do not automatically refresh more often than',// TODO + 'url' => 'Feed URL',// TODO + 'validator' => 'Check the validity of the feed',// TODO + 'website' => 'Website URL',// TODO + 'pubsubhubbub' => 'Instant notification with PubSubHubbub',// TODO + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.',// TODO + 'title' => 'Firefox feed reader',// TODO + ), + 'import_export' => array( + 'export' => 'Export',// TODO + 'export_opml' => 'Export list of feeds (OPML)',// TODO + 'export_starred' => 'Export your favourites',// TODO + 'feed_list' => 'List of %s articles',// TODO + 'file_to_import' => 'File to import<br />(OPML, JSON or ZIP)',// TODO + 'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)',// TODO + 'import' => 'Import',// TODO + 'starred_list' => 'List of favourite articles',// TODO + 'title' => 'Import / export',// TODO + ), + 'menu' => array( + 'bookmark' => 'Subscribe (FreshRSS bookmark)',// TODO + 'import_export' => 'Import / export',// TODO + 'subscription_management' => 'Subscriptions management',// TODO + 'subscription_tools' => 'Subscription tools',// TODO + ), + 'title' => array( + '_' => 'Subscriptions management',// TODO + 'feed_management' => 'RSS feeds management',// TODO + 'subscription_tools' => 'Subscription tools',// TODO + ), +); diff --git a/app/i18n/tr/admin.php b/app/i18n/tr/admin.php new file mode 100644 index 000000000..aa3aad7b7 --- /dev/null +++ b/app/i18n/tr/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Öntanımlı kullanıcının makalelerinin anonim okunmasına izin ver (%s)', + 'allow_anonymous_refresh' => 'Anonim makale yenilemesine izin ver', + 'api_enabled' => '<abbr>API</abbr> erişimine izin ver <small>(mobil uygulamalar için gerekli)</small>', + 'form' => 'Web formu (geleneksel, JavaScript gerektirir)', + 'http' => 'HTTP (ileri kullanıcılar için, HTTPS)', + 'none' => 'Hiçbiri (tehlikeli)', + 'title' => 'Kimlik doğrulama', + 'title_reset' => 'Kimlik doğrulama sıfırla', + 'token' => 'Kimlik doğrulama işareti', + 'token_help' => 'Kimlik doğrulama olmaksızın öntanımlı kullanıcının RSS çıktısına erişime izin ver:', + 'type' => 'Kimlik doğrulama yöntemi', + 'unsafe_autologin' => 'Güvensiz otomatik girişe izin ver: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => '<em>./data/cache</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Önbellek klasörü yetkileri sorunsuz.', + ), + 'categories' => array( + 'nok' => 'Kategori tablosu kötü yapılandırılmış.', + 'ok' => 'Kategori tablosu sorunsuz.', + ), + 'connection' => array( + 'nok' => 'Veritabanı ile bağlantı kurulamıyor.', + 'ok' => 'Veritabanı ile bağlantı sorunsuz.', + ), + 'ctype' => array( + 'nok' => 'Karakter yazım kontrolü için kütüphane eksik (php-ctype).', + 'ok' => 'Karakter yazım kontrolü için kütüphane sorunsuz (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL eksik (php-curl package).', + 'ok' => 'cURL eklentisi sorunsuz.', + ), + 'data' => array( + 'nok' => '<em>./data</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Veri klasörü yetkileri sorunsuz.', + ), + 'database' => 'Veritabanı kurulumu', + 'dom' => array( + 'nok' => 'DOM kütüpbanesi eksik (php-xml package).', + 'ok' => 'DOM kütüphanesi sorunsuz.', + ), + 'entries' => array( + 'nok' => 'Giriş tablosu kötü yapılandırılmış.', + 'ok' => 'Giriş tablosu sorunsuz.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Site ikonu klasörü yetkileri sorunsuz.', + ), + 'feeds' => array( + 'nok' => 'Akış tablosu kötü yapılandırılmış.', + 'ok' => 'Akış tablosu sorunsuz.', + ), + 'fileinfo' => array( + 'nok' => 'PHP fileinfo eksik (fileinfo package).', + 'ok' => 'fileinfo eklentisi sorunsuz.', + ), + 'files' => 'Dosya kurulumu', + 'json' => array( + 'nok' => 'JSON eklentisi eksik (php5-json package).', + 'ok' => 'JSON eklentisi sorunsuz.', + ), + 'minz' => array( + 'nok' => 'Minz framework eksik.', + 'ok' => 'Minz framework sorunsuz.', + ), + 'pcre' => array( + 'nok' => 'Düzenli ifadeler kütüphanesi eksik (php-pcre).', + 'ok' => 'Düzenli ifadeler kütüphanesi sorunsuz (PCRE).', + ), + 'pdo' => array( + 'nok' => 'PDO veya PDO destekli bir sürücü eksik (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO sorunsuz (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP kurulumu', + 'nok' => 'PHP versiyonunuz %s fakat FreshRSS için gerekli olan en düşük sürüm %s.', + 'ok' => 'PHP versiyonunuz %s, FreshRSS ile tam uyumlu.', + ), + 'tables' => array( + 'nok' => 'Veritabanında bir veya daha fazla tablo eksik.', + 'ok' => 'Veritabanı tabloları sorunsuz.', + ), + 'title' => 'Kurulum kontrolü', + 'tokens' => array( + 'nok' => '<em>./data/tokens</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'İşaretler klasörü yetkileri sorunsuz..', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Kullanıcılar klasörü yetkileri sorunsuz.', + ), + 'zip' => array( + 'nok' => 'ZIP eklentisi eksik (php-zip package).', + 'ok' => 'ZIP eklentisi sorunsuz.', + ), + ), + 'extensions' => array( + 'disabled' => 'Pasif', + 'empty_list' => 'Yüklenmiş eklenti bulunmamaktadır', + 'enabled' => 'Aktif', + 'no_configure_view' => 'Bu eklenti yapılandırılamaz.', + 'system' => array( + '_' => 'Sistem eklentileri', + 'no_rights' => 'Sistem eklentileri (düzenleme hakkınız yok)', + ), + 'title' => 'Eklentiler', + 'user' => 'Kullanıcı eklentileri', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => 'İstatistikler', + 'all_feeds' => 'Tüm akış', + 'category' => 'Kategori', + 'entry_count' => 'Makale sayısı', + 'entry_per_category' => 'Kategori başı makale sayısı', + 'entry_per_day' => 'Günlük makale sayısı (last 30 days)', + 'entry_per_day_of_week' => 'Haftanın günü (ortalama: %.2f makale)', + 'entry_per_hour' => 'Saatlik (ortalama: %.2f makale)', + 'entry_per_month' => 'Aylık (average: %.2f makale)', + 'entry_repartition' => 'Giriş dağılımı', + 'feed' => 'Akış', + 'feed_per_category' => 'Kategoriye göre akışlar', + 'idle' => 'Boştaki akışlar', + 'main' => 'Ana istatistikler', + 'main_stream' => 'Ana akış', + 'menu' => array( + 'idle' => 'Boştaki akışlar', + 'main' => 'Ana istatistikler', + 'repartition' => 'Makale dağılımı', + ), + 'no_idle' => 'Boşta akış yok!', + 'number_entries' => '%d makale', + 'percent_of_total' => '%% toplamın yüzdesi', + 'repartition' => 'Makale dağılımı', + 'status_favorites' => 'Favoriler', + 'status_read' => 'Okunmuş', + 'status_total' => 'Toplam', + 'status_unread' => 'Okunmamış', + 'title' => 'İstatistikler', + 'top_feed' => 'İlk 10 akış', + ), + 'system' => array( + '_' => 'Sistem yapılandırması', + 'auto-update-url' => 'Otomatik güncelleme sunucu URL', + 'instance-name' => 'Örnek isim', + 'max-categories' => 'Kullanıcı başına kategori limiti', + 'max-feeds' => 'Kullanıcı başına akış limiti', + 'registration' => array( + 'help' => '0 sınır yok anlamındadır', + 'number' => 'En fazla hesap sayısı', + ), + ), + 'update' => array( + '_' => 'Sistem güncelleme', + 'apply' => 'Uygula', + 'check' => 'Güncelleme kontrolü', + 'current_version' => 'Mevcut FreshRSS sürümünüz %s.', + 'last' => 'Son kontrol: %s', + 'none' => 'Yeni güncelleme yok', + 'title' => 'Sistem güncelleme', + ), + 'user' => array( + 'articles_and_size' => '%s makale (%s)', + 'create' => 'Yeni kullanıcı oluştur', + 'language' => 'Dil', + 'number' => 'Oluşturulmuş %d hesap var', + 'numbers' => 'Oluşturulmuş %d hesap var', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'title' => 'Kullanıcıları yönet', + 'user_list' => 'Kullanıcı listesi', + 'username' => 'Kullanıcı adı', + 'users' => 'Kullanıcılar', + ), +); diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php new file mode 100644 index 000000000..e4c094be2 --- /dev/null +++ b/app/i18n/tr/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Arşiv', + 'advanced' => 'Gelişmiş', + 'delete_after' => 'Makelelerin tutulacağı süre', + 'help' => 'Akış ayarlarında daha çok ayar bulabilirsiniz', + 'keep_history_by_feed' => 'Akışta en az tutulacak makale sayısı', + 'optimize' => 'Veritabanı optimize et', + 'optimize_help' => 'Bu işlem bazen veritabanı boyutunu düşürmeye yardımcı olur', + 'purge_now' => 'Şimdi temizle', + 'title' => 'Arşiv', + 'ttl' => 'Şu süreden sık otomatik yenileme yapma', + ), + 'display' => array( + '_' => 'Görünüm', + 'icon' => array( + 'bottom_line' => 'Alt çizgi', + 'entry' => 'Makale ikonları', + 'publication_date' => 'Yayınlama Tarihi', + 'related_tags' => 'İlgili etiketler', + 'sharing' => 'Paylaşım', + 'top_line' => 'Üst çizgi', + ), + 'language' => 'Dil', + 'notif_html5' => array( + 'seconds' => 'saniye (0 zaman aşımı yok demektir)', + 'timeout' => 'HTML5 bildirim zaman aşımı', + ), + 'theme' => 'Tema', + 'title' => 'Görünüm', + 'width' => array( + 'content' => 'İçerik genişliği', + 'large' => 'Geniş', + 'medium' => 'Orta', + 'no_limit' => 'Sınırsız', + 'thin' => 'Zayıf', + ), + ), + 'query' => array( + '_' => 'Kullanıcı sorguları', + 'deprecated' => 'Bu sorgu artık geçerli değil. İlgili akış veya kategori silinmiş.', + 'filter' => 'Filtre uygulandı:', + 'get_all' => 'Tüm makaleleri göster', + 'get_category' => '"%s" kategorisini göster', + 'get_favorite' => 'Favori makaleleri göster', + 'get_feed' => '"%s" akışını göster', + 'no_filter' => 'Filtre yok', + 'none' => 'Henüz hiç kullanıcı sorgusu oluşturmadınız.', + 'number' => 'Sorgu n°%d', + 'order_asc' => 'Önce eski makaleleri göster', + 'order_desc' => 'Önce yeni makaleleri göster', + 'search' => '"%s" için arama', + 'state_0' => 'Tüm makaleleri göster', + 'state_1' => 'Okunmuş makaleleri göster', + 'state_2' => 'Okunmamış makaleleri göster', + 'state_3' => 'Tüm makaleleri göster', + 'state_4' => 'Favori makaleleri göster', + 'state_5' => 'Okunmuş favori makaleleri göster', + 'state_6' => 'Okunmamış favori makaleleri göster', + 'state_7' => 'Favori makaleleri göster', + 'state_8' => 'Favori olmayan makaleleri göster', + 'state_9' => 'Favori olmayan okunmuş makaleleri göster', + 'state_10' => 'Favori olmayan okunmamış makaleleri göster', + 'state_11' => 'Favori olmayan makaleleri göster', + 'state_12' => 'Tüm makaleleri göster', + 'state_13' => 'Okunmuş makaleleri göster', + 'state_14' => 'Okunmamış makaleleri göster', + 'state_15' => 'Tüm makaleleri göster', + 'title' => 'Kullanıcı sorguları', + ), + 'profile' => array( + '_' => 'Profil yönetimi', + 'delete' => array( + '_' => 'Hesap silme', + 'warn' => 'Hesabınız ve tüm verileriniz silinecek.', + ), + 'password_api' => 'API Şifresi<br /><small>(ör. mobil uygulamalar için)</small>', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Okuma', + 'after_onread' => '"Hepsini okundu say" dedinten sonra,', + 'articles_per_page' => 'Sayfa başına makale sayısı', + 'auto_load_more' => 'Sayfa sonunda yeni makaleleri yükle', + 'auto_remove_article' => 'Okuduktan sonra makaleleri gizle', + 'mark_updated_article_unread' => 'Güncellenen makaleleri okundu olarak işaretle', + 'confirm_enabled' => '"Hepsini okundu say" eylemi için onay iste', + 'display_articles_unfolded' => 'Show articles unfolded by default', + 'display_categories_unfolded' => 'Show categories folded by default', + 'hide_read_feeds' => 'Okunmamış makalesi olmayan kategori veya akışı gizle ("Tüm makaleleri göster" komutunda çalışmaz)', + 'img_with_lazyload' => 'Resimleri yüklemek için "tembel modu" kullan', + 'sides_close_article' => 'Clicking outside of article text area closes the article', //TODO + 'jump_next' => 'Bir sonraki benzer okunmamışa geç (akış veya kategori)', + 'number_divided_when_reader' => 'Okuma modunda ikiye bölünecek.', + 'read' => array( + 'article_open_on_website' => 'orijinal makale sitesi açıldığında', + 'article_viewed' => 'makale görüntülendiğinde', + 'scroll' => 'kaydırma yapılırken', + 'upon_reception' => 'makale üzerinde gelince', + 'when' => 'Makaleyi okundu olarak işaretle…', + ), + 'show' => array( + '_' => 'Gösterilecek makaleler', + 'adaptive' => 'Ayarlanmış gösterim', + 'all_articles' => 'Tüm makaleleri göster', + 'unread' => 'Sadece okunmamış makaleleri göster', + ), + 'sort' => array( + '_' => 'Sıralama', + 'newer_first' => 'Önce yeniler', + 'older_first' => 'Önce eskiler', + ), + 'sticky_post' => 'Makale açıldığında yukarı getir', + 'title' => 'Okuma', + 'view' => array( + 'default' => 'Öntanımlı görünüm', + 'global' => 'Global görünüm', + 'normal' => 'Normal görünüm', + 'reader' => 'Okuma görünümü', + ), + ), + 'sharing' => array( + '_' => 'Paylaşım', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Daha fazla bilgi', + 'print' => 'Yazdır', + 'shaarli' => 'Shaarli', + 'share_name' => 'Paylaşım ismi', + 'share_url' => 'Paylaşım URL si', + 'title' => 'Paylaşım', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Kısayollar', + 'article_action' => 'Makale eylemleri', + 'auto_share' => 'Paylaş', + 'auto_share_help' => 'Sadece 1 paylaşım modu varsa bu kullanılır. Yoksa kendi paylaşım numaraları ile kullanılır.', + 'close_dropdown' => 'Menüleri kapat', + 'collapse_article' => 'Kapat', + 'first_article' => 'İlk makaleyi atla', + 'focus_search' => 'Arama kutusuna eriş', + 'help' => 'Dokümantasyonu göster', + 'javascript' => 'Kısayolları kullanabilmek için JavaScript aktif olmalıdır', + 'last_article' => 'Son makaleyi atla', + 'load_more' => 'Daha fazla makale yükle', + 'mark_read' => 'Okundu olarak işaretle', + 'mark_favorite' => 'Favori olarak işaretle', + 'navigation' => 'Genel eylemler', + 'navigation_help' => '"Shift" tuşu ile kısayollar akışlar için geçerli olur.<br/>"Alt" tuşu ile kısayollar kategoriler için geçerli olur.', + 'next_article' => 'Sonraki makaleye geç', + 'other_action' => 'Diğer eylemler', + 'previous_article' => 'Önceki makaleye geç', + 'see_on_website' => 'Orijinal sitede göster', + 'shift_for_all_read' => '+ <code>shift</code> tuşu ile tüm makaleler okundu olarak işaretlenir', + 'title' => 'Kısayollar', + 'user_filter' => 'Kullanıcı filtrelerine eriş', + 'user_filter_help' => 'Eğer tek filtre varsa o kullanılır. Yoksa filtrelerin kendi numaralarıyla kullanılır.', + ), + 'user' => array( + 'articles_and_size' => '%s makale (%s)', + 'current' => 'Mevcut kullanıcı', + 'is_admin' => 'yöneticidir', + 'users' => 'Kullanıcılar', + ), +); diff --git a/app/i18n/tr/feedback.php b/app/i18n/tr/feedback.php new file mode 100644 index 000000000..be79630be --- /dev/null +++ b/app/i18n/tr/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimizasyon tamamlandı', + ), + 'access' => array( + 'denied' => 'Bu sayfaya erişim yetkiniz yok', + 'not_found' => 'Varolmayan bir sayfa arıyorsunuz', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Sistem yapılandırma kimlik doğrulaması sırasında hata oldu. Lütfen daha sonra tekrar deneyin.', + 'set' => 'Kimlik doğrulama sistemi tamamnaldı.', + ), + 'login' => array( + 'invalid' => 'Giriş geçersiz', + 'success' => 'Bağlantı kuruldu', + ), + 'logout' => array( + 'success' => 'Bağlantı koptu', + ), + 'no_password_set' => 'Yönetici şifresi ayarlanmadı. Bu özellik kullanıma uygun değil.', + ), + 'conf' => array( + 'error' => 'Yapılandırma ayarları kaydedilirken hata oluştu', + 'query_created' => 'Sorgu "%s" oluşturuldu.', + 'shortcuts_updated' => 'Kısayollar yenilendi', + 'updated' => 'Yapılandırm ayarları yenilendi', + ), + 'extensions' => array( + 'already_enabled' => '%s zaten aktif', + 'disable' => array( + 'ko' => '%s gösterilemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'ok' => '%s pasif', + ), + 'enable' => array( + 'ko' => '%s aktifleştirilemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'ok' => '%s aktif', + ), + 'no_access' => '%s de yetkiniz yok', + 'not_enabled' => '%s henüz aktif değil', + 'not_found' => '%s bulunmamaktadır', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP eklentisi mevcut sunucunuzda yer almıyor. Lütfen başka dosya formatında dışarı aktarmayı deneyin.', + 'feeds_imported' => 'Akışlarınız içe aktarıldı ve şimdi güncellenecek', + 'feeds_imported_with_errors' => 'Akışlarınız içeri aktarıldı ama bazı hatalar meydana geldi', + 'file_cannot_be_uploaded' => 'Dosya yüklenemedi!', + 'no_zip_extension' => 'ZIP eklentisi mevcut sunucunuzda yer almıyor.', + 'zip_error' => 'ZIP içe aktarımı sırasında hata meydana geldi.', + ), + 'sub' => array( + 'actualize' => 'Güncelleme', + 'category' => array( + 'created' => 'Kategori %s oluşturuldu.', + 'deleted' => 'Kategori silindi.', + 'emptied' => 'Kategori boşaltıldı', + 'error' => 'Kategori güncellenemedi', + 'name_exists' => 'Kategori ismi zaten bulunmakta.', + 'no_id' => 'Kategori id sinden emin olmalısınız.', + 'no_name' => 'Kategori ismi boş olamaz.', + 'not_delete_default' => 'Öntanımlı kategoriyi silemezsiniz!', + 'not_exist' => 'Kategori bulunmamakta!', + 'over_max' => 'Kategori limitini aştınız (%d)', + 'updated' => 'Karegori güncellendi.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> güncellendi', + 'actualizeds' => 'RSS akışları güncellendi', + 'added' => '<em>%s</em> RSS akışı eklendi', + 'already_subscribed' => '<em>%s</em> için zaten aboneliğiniz bulunmakta', + 'deleted' => 'Akış silindi', + 'error' => 'Akış güncellenemiyor', + 'internal_problem' => 'RSS akışı eklenemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'invalid_url' => 'URL <em>%s</em> geçersiz', + 'marked_read' => 'Akışlar okundu olarak işaretlendi', + 'n_actualized' => '%d akışları güncellendi', + 'n_entries_deleted' => '%d makaleleri silindi', + 'no_refresh' => 'Yenilenecek akış yok…', + 'not_added' => '<em>%s</em> eklenemedi', + 'over_max' => 'Akış limitini aştınız (%d)', + 'updated' => 'Akış güncellendi', + ), + 'purge_completed' => 'Temizleme tamamlandı (%d makale silindi)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS <strong>%s versiyonuna</strong> güncellenecek.', + 'error' => 'Güncelleme işlemi sırasında hata: %s', + 'file_is_nok' => '<strong>%s versiyonuna</strong>. <em>%s</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'finished' => 'Güncelleme tamamlandı!', + 'none' => 'Güncelleme yok', + 'server_not_found' => 'Güncelleme sunucusu bulunamadı. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => '%s kullanıcısı oluşturuldu', + 'error' => '%s kullanıcısı oluşturulamadı', + ), + 'deleted' => array( + '_' => '%s kullanıcısı silindi', + 'error' => '%s kullanıcısı silinemedi', + ), + ), + 'profile' => array( + 'error' => 'Profiliniz düzenlenemedi', + 'updated' => 'Profiliniz düzenlendi', + ), +); diff --git a/app/i18n/tr/gen.php b/app/i18n/tr/gen.php new file mode 100644 index 000000000..535563542 --- /dev/null +++ b/app/i18n/tr/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Yenile', + 'back_to_rss_feeds' => '← RSS akışlarınız için geri gidin', + 'cancel' => 'İptal', + 'create' => 'Oluştur', + 'disable' => 'Pasif', + 'empty' => 'Boş', + 'enable' => 'Aktif', + 'export' => 'Dışa Aktar', + 'filter' => 'Filtrele', + 'import' => 'İçe Aktar', + 'manage' => 'Yönet', + 'mark_favorite' => 'Favoriye ekle', + 'mark_read' => 'Okundu olarak işaretle', + 'remove' => 'Sil', + 'see_website' => 'Siteyi gör', + 'submit' => 'Onayla', + 'truncate' => 'Tüm makaleleri sil', + ), + 'auth' => array( + 'email' => 'Email adresleri', + 'keep_logged_in' => '<small>(%s günler)</small> oturumu açık tut', + 'login' => 'Giriş', + 'logout' => 'Çıkış', + 'password' => array( + '_' => 'Şifre', + 'format' => '<small>En az 7 karakter</small>', + ), + 'registration' => array( + '_' => 'Yeni hesap', + 'ask' => 'Yeni bir hesap oluştur', + 'title' => 'Hesap oluşturma', + ), + 'reset' => 'Kimlik doğrulama sıfırla', + 'username' => array( + '_' => 'Kullancı adı', + 'admin' => 'Yönetici kullanıcı adı', + 'format' => '<small>en fazla 16 alfanümerik karakter</small>', + ), + ), + 'date' => array( + 'Apr' => '\\N\\i\\s\\a\\n', + 'Aug' => '\\A\\ğ\\u\\s\\t\\o\\s', + 'Dec' => '\\A\\r\\a\\l\\ı\\k', + 'Feb' => '\\Ş\\u\\b\\a\\t', + 'Jan' => '\\O\\c\\a\\k', + 'Jul' => '\\T\\e\\m\\m\\u\\z', + 'Jun' => '\\H\\a\\z\\i\\r\\a\\n', + 'Mar' => '\\M\\a\\r\\t', + 'May' => '\\M\\a\\y\\ı\\s', + 'Nov' => '\\K\\a\\s\\ı\\m', + 'Oct' => '\\E\\k\\i\\m', + 'Sep' => '\\E\\y\\l\\ü\\l', + 'apr' => 'nis', + 'april' => 'Nis', + 'aug' => 'ağu', + 'august' => 'Ağu', + 'before_yesterday' => 'Dünden önceki gün', + 'dec' => 'ara', + 'december' => 'Ara', + 'feb' => 'şub', + 'february' => 'Şub', + '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', + 'fri' => 'Cum', + 'jan' => 'oca', + 'january' => 'Oca', + 'jul' => 'tem', + 'july' => 'Tem', + 'jun' => 'haz', + 'june' => 'Haz', + 'last_3_month' => 'Son 3 ay', + 'last_6_month' => 'Son 6 ay', + 'last_month' => 'Geçen ay', + 'last_week' => 'Geçen hafta', + 'last_year' => 'Geçen yıl', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'Mayıs', + 'may_' => 'May', + 'mon' => 'Pzt', + 'month' => 'ay', + 'nov' => 'kas', + 'november' => 'Kas', + 'oct' => 'ekm', + 'october' => 'Ekm', + 'sat' => 'Cts', + 'sep' => 'eyl', + 'september' => 'Eyl', + 'sun' => 'Pzr', + 'thu' => 'Per', + 'today' => 'Bugün', + 'tue' => 'Sal', + 'wed' => 'Çar', + 'yesterday' => 'Dün', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'FreshRSS hakkında', + ), + 'js' => array( + 'category_empty' => 'Boş kategori', + 'confirm_action' => 'Bunu yapmak istediğinize emin misiniz ? Daha sonra iptal edilemez!', + 'confirm_action_feed_cat' => 'Bunu yapmak istediğinize emin misiniz ? Favorileriniz ve sorgularınız silinecek. Daha sonra iptal edilemez!', + 'feedback' => array( + 'body_new_articles' => 'FreshRSS de okunmaz üzere %%d yeni makale var.', + 'request_failed' => 'Hata. İnternet bağlantınızı kontrol edin.', + 'title_new_articles' => 'FreshRSS: yeni makaleler!', + ), + 'new_article' => 'Yeni makaleler mevcut. Sayfayı yenilemek için tıklayın.', + 'should_be_activated' => 'JavaScript aktif olmalıdır.', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => 'Hakkında', + 'admin' => 'Yönetim', + 'archiving' => 'Arşiv', + 'authentication' => 'Kimlik doğrulama', + 'check_install' => 'Kurulum kontrolü', + 'configuration' => 'Yapılandırma', + 'display' => 'Görünüm', + 'extensions' => 'Eklentiler', + 'logs' => 'Log kayıtları', + 'queries' => 'Kullanıcı sorguları', + 'reading' => 'Okuma', + 'search' => 'Kelime veya #etiket ara', + 'sharing' => 'Paylaşım', + 'shortcuts' => 'Kısayollar', + 'stats' => 'İstatistikler', + 'system' => 'Sistem yapılandırması', + 'update' => 'Güncelleme', + 'user_management' => 'Kullanıcıları yönet', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'İlk', + 'last' => 'Son', + 'load_more' => 'Daha fazla makale yükle', + 'mark_all_read' => 'Tümünü okundu say', + 'next' => 'Sonraki', + 'nothing_to_load' => 'Başka makale yok', + 'previous' => 'Önceki', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Tehlike!', + 'blank_to_disable' => 'Devredışı bırakmak için boş bırakın', + 'by_author' => '<em>%s</em> tarafından', + 'by_default' => 'Öntanımlı', + 'damn' => 'Hay aksi!', + 'default_category' => 'Kategorisiz', + 'no' => 'Hayır', + 'not_applicable' => 'Uygun değil', + 'ok' => 'Tamam!', + 'or' => 'ya da', + 'yes' => 'Evet', + ), +); diff --git a/app/i18n/tr/index.php b/app/i18n/tr/index.php new file mode 100644 index 000000000..cb36d6717 --- /dev/null +++ b/app/i18n/tr/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Hakkında', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Hata raporu', + 'credits' => 'Tanıtım', + 'credits_content' => 'Bu frameworkü kullanmamasına rağmen FreshRSS bazı tasarım ögelerini <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> dan almıştır. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">İkonlar</a> <a href="https://www.gnome.org/">GNOME projesinden</a> alınmıştır. <em>Open Sans</em> yazı tipi <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a> tarafından oluşturulmuştur. FreshRSS bir PHP framework olan <a href="https://github.com/marienfressinaud/MINZ">Minz</a> i temel alır.', + 'freshrss_description' => 'FreshRSS <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> veya <a href="http://projet.idleman.fr/leed/">Leed</a> gibi kendi hostunuzda çalışan bir RSS akış toplayıcısıdır. Güçlü ve yapılandırılabilir araçlarıyla basit ve kullanımı kolay bir uygulamadır.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">Github sayfası</a>', + 'license' => 'Lisans', + 'project_website' => 'Proje sayfası', + 'title' => 'Hakkında', + 'version' => 'Versiyon', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'Akış ekleyebilirsin.', + 'empty' => 'Gösterilecek makale yok.', + 'rss_of' => 'RSS feed of %s', + 'title' => 'RSS akışlarınız', + 'title_global' => 'Global görünüm', + 'title_fav' => 'Favorilerin', + ), + 'log' => array( + '_' => 'Log Kayıtları', + 'clear' => 'Log kayıt dosyasını temizle', + 'empty' => 'Log kayır dosyası boş', + 'title' => 'Log Kayıtları', + ), + 'menu' => array( + 'about' => 'FreshRSS hakkında', + 'add_query' => 'Sorgu ekle', + 'before_one_day' => 'Bir gün önce', + 'before_one_week' => 'Bir hafta önce', + 'favorites' => 'Favoriler (%s)', + 'global_view' => 'Global görünüm', + 'main_stream' => 'Ana akış', + 'mark_all_read' => 'Hepsini okundu olarak işaretle', + 'mark_cat_read' => 'Kategoriyi okundu olarak işaretle', + 'mark_feed_read' => 'Akışı okundu olarak işaretle', + 'newer_first' => 'Önce yeniler', + 'non-starred' => 'Favori dışındakileri göster', + 'normal_view' => 'Normal görünüm', + 'older_first' => 'Önce eskiler', + 'queries' => 'Kullanıcı sorguları', + 'read' => 'Okunmuşları göster', + 'reader_view' => 'Okuma görünümü', + 'rss_view' => 'RSS akışı', + 'search_short' => 'Ara', + 'starred' => 'Favorileri göster', + 'stats' => 'İstatistikler', + 'subscription' => 'Abonelik yönetimi', + 'unread' => 'Okunmamışları göster', + ), + 'share' => 'Share', + 'tag' => array( + 'related' => 'İlgili etiketler', + ), +); diff --git a/app/i18n/tr/install.php b/app/i18n/tr/install.php new file mode 100644 index 000000000..d5564297b --- /dev/null +++ b/app/i18n/tr/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Kurulumu tamamla', + 'fix_errors_before' => 'Lütfen sonraki adıma geçmek için hataları düzeltin.', + 'keep_install' => 'Önceki kuruluma devam et', + 'next_step' => 'Sonraki adım', + 'reinstall' => 'FreshRSS i yeniden yükle', + ), + 'auth' => array( + 'form' => 'Web formu (geleneksel, JavaScript gerektirir)', + 'http' => 'HTTP (ileri kullanıcılar için, HTTPS)', + 'none' => 'Hiçbiri (tehlikeli)', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'type' => 'Kimlik doğrulama yöntemi', + ), + 'bdd' => array( + '_' => 'Veritabanı', + 'conf' => array( + '_' => 'Veritabanı yapılandırılması', + 'ko' => 'Veritabanı bilginizi doğrulayın.', + 'ok' => 'Veritabanı yapılandırılması kayıt edildi.', + ), + 'host' => 'Sunucu', + 'prefix' => 'Tablo ön eki', + 'password' => 'Veritabanı şifresi', + 'type' => 'Veritabanı türü', + 'username' => 'Veritabanı kullanıcı adı', + ), + 'check' => array( + '_' => 'Kontroller', + 'already_installed' => 'FreshRSS zaten yüklü!', + 'cache' => array( + 'nok' => '<em>./data/cache</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Önbellek klasörü yetkileri sorunsuz.', + ), + 'ctype' => array( + 'nok' => 'Karakter yazım kontrolü için kütüphane eksik (php-ctype).', + 'ok' => 'Karakter yazım kontrolü için kütüphane sorunsuz (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL eksik (php-curl package).', + 'ok' => 'cURL eklentisi sorunsuz.', + ), + 'data' => array( + 'nok' => '<em>./data</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Veri klasörü yetkileri sorunsuz.', + ), + 'dom' => array( + 'nok' => 'DOM kütüpbanesi eksik.', + 'ok' => 'DOM kütüphanesi sorunsuz.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Site ikonu klasörü yetkileri sorunsuz.', + ), + 'fileinfo' => array( + 'nok' => 'PHP fileinfo eksik (fileinfo package).', + 'ok' => 'fileinfo eklentisi sorunsuz.', + ), + 'http_referer' => array( + 'nok' => 'Lütfen HTTP REFERER değiştirmediğinize emin olun.', + 'ok' => 'HTTP REFERER ve sunucunuz arası iletişim sorunsuz.', + ), + 'json' => array( + 'nok' => 'Tavsiye edilen JSON çözümleme kütüphanesi eksik.', + 'ok' => 'Tavsiye edilen JSON çözümleme kütüphanesi sorunsuz.', + ), + 'minz' => array( + 'nok' => 'Minz framework eksik.', + 'ok' => 'Minz framework sorunsuz.', + ), + 'pcre' => array( + 'nok' => 'Düzenli ifadeler kütüphanesi eksik (php-pcre).', + 'ok' => 'Düzenli ifadeler kütüphanesi sorunsuz (PCRE).', + ), + 'pdo' => array( + 'nok' => 'PDO veya PDO destekli bir sürücü eksik (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO sorunsuz (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'PHP versiyonunuz %s fakat FreshRSS için gerekli olan en düşük sürüm %s.', + 'ok' => 'PHP versiyonunuz %s, FreshRSS ile tam uyumlu.', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Kullanıcılar klasörü yetkileri sorunsuz.', + ), + 'xml' => array( + 'nok' => 'You lack the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), + ), + 'conf' => array( + '_' => 'Genel yapılandırma', + 'ok' => 'Genel yapılandırma ayarları kayıt edildi.', + ), + 'congratulations' => 'Tebrikler!', + 'default_user' => 'Öntanımlı kullanıcı adı <small>(en fazla 16 alfanümerik karakter)</small>', + 'delete_articles_after' => 'Makaleleri şu süre sonunda sil', + 'fix_errors_before' => 'Lütfen sonraki adıma geçmek için hataları düzeltin.', + 'javascript_is_better' => 'FreshRSS JavaScript ile daha işlevseldir', + 'js' => array( + 'confirm_reinstall' => 'FressRSS i yeniden kurarak önceki yapılandırma ayarlarınızı kaybedeceksiniz. Devam etmek istiyor musunuz ?', + ), + 'language' => array( + '_' => 'Dil', + 'choose' => 'FreshRSS için bir dil seçin', + 'defined' => 'Dil belirlendi.', + ), + 'not_deleted' => 'Hata meydana geldi; <em>%s</em> dosyasını elle silmelisiniz.', + 'ok' => 'Kurulum başarıyla tamamlandı.', + 'step' => 'adım %d', + 'steps' => 'Adımlar', + 'title' => 'Kurulum · FreshRSS', + 'this_is_the_end' => 'Son Adım', +); diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php new file mode 100644 index 000000000..0bbaeec5b --- /dev/null +++ b/app/i18n/tr/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => 'Copy the following URL to use it within an external tool.',// TODO + 'title' => 'API',// TODO + ), + 'bookmarklet' => array( + 'documentation' => 'Drag this button to your bookmarks toolbar or right-click it and choose "Bookmark This Link". Then click "Subscribe" button in any page you want to subscribe to.',// TODO + 'label' => 'Subscribe',// TODO + 'title' => 'Bookmarklet',// TODO + ), + 'category' => array( + '_' => 'Kategori', + 'add' => 'Kategori ekle', + 'empty' => 'Boş kategori', + 'new' => 'Yeni kategori', + ), + 'feed' => array( + 'add' => 'RSS akışı ekle', + 'advanced' => 'Gelişmiş', + 'archiving' => 'Arşiv', + 'auth' => array( + 'configuration' => 'Giriş', + 'help' => 'HTTP korumalı RSS akışlarına bağlantı izni sağlar', + 'http' => 'HTTP Kimlik Doğrulama', + 'password' => 'HTTP şifre', + 'username' => 'HTTP kullanıcı adı', + ), + 'css_help' => 'Dikkat, daha çok zaman gerekir!', + 'css_path' => 'Makaleleri kendi CSS görünümü ile göster', + 'description' => 'Tanım', + 'empty' => 'Bu akış boş. Lütfen akışın aktif olduğuna emin olun.', + 'error' => 'Bu akışda bir hatayla karşılaşıldı. Lütfen akışın sürekli ulaşılabilir olduğuna emin olun.', + 'in_main_stream' => 'Ana akışda göster', + 'informations' => 'Bilgi', + 'keep_history' => 'En az tutulacak makale sayısı', + 'moved_category_deleted' => 'Bir kategoriyi silerseniz, içerisindeki akışlar <em>%s</em> içerisine yerleşir.', + 'no_selected' => 'Hiçbir akış seçilmedi.', + 'number_entries' => '%d makale', + 'stats' => 'İstatistikler', + 'think_to_add' => 'Akış ekleyebilirsiniz.', + 'title' => 'Başlık', + 'title_add' => 'RSS akışı ekle', + 'ttl' => 'Şu kadar süreden fazla otomatik yenileme yapma', + 'url' => 'Akış URL', + 'validator' => 'Akış geçerliliğini kontrol edin', + 'website' => 'Site URL', + 'pubsubhubbub' => 'PubSubHubbub ile anlık bildirim', + ), + 'firefox' => array( + 'documentation' => 'Follow the steps described <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">here</a> to add FreshRSS to Firefox feed reader list.',// TODO + 'title' => 'Firefox feed reader',// TODO + ), + 'import_export' => array( + 'export' => 'Dışa aktar', + 'export_opml' => 'Akış listesini dışarı aktar (OPML)', + 'export_starred' => 'Favorileri dışarı aktar', + 'feed_list' => '%s makalenin listesi', + 'file_to_import' => 'Dosyadan içe aktar<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'Dosyadan içe aktar<br />(OPML or JSON)', + 'import' => 'İçe aktar', + 'starred_list' => 'Favori makaleleirn listesi', + 'title' => 'İçe / dışa aktar', + ), + 'menu' => array( + 'bookmark' => 'Abonelik (FreshRSS yer imleri)', + 'import_export' => 'İçe / dışa aktar', + 'subscription_management' => 'Abonelik yönetimi', + 'subscription_tools' => 'Subscription tools',// TODO + ), + 'title' => array( + '_' => 'Abonelik yönetimi', + 'feed_management' => 'RSS akış yönetimi', + 'subscription_tools' => 'Subscription tools',// TODO + ), +); diff --git a/app/i18n/zh-cn/admin.php b/app/i18n/zh-cn/admin.php new file mode 100644 index 000000000..ca18bf63d --- /dev/null +++ b/app/i18n/zh-cn/admin.php @@ -0,0 +1,188 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => '允许匿名阅读默认用户 (%s) 的文章', + 'allow_anonymous_refresh' => '允许匿名刷新文章', + 'api_enabled' => '允许 <abbr>API</abbr> 访问 <small>(用于手机 APP)</small>', + 'form' => 'Web form (传统方式, 需要 JavaScript)', + 'http' => 'HTTP (面向启用 HTTPS 的高级用户)', + 'none' => '无 (危险)', + 'title' => '认证', + 'title_reset' => '密码重置', + 'token' => '认证口令', + 'token_help' => '用于不经认证访问默认用户的 RSS 输出:', + 'type' => '认证方式', + 'unsafe_autologin' => '允许不安全的自动登陆方式:', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => '请检查 <em>./data/cache</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'cache 目录权限正常。', + ), + 'categories' => array( + 'nok' => 'Category 表配置错误。', + 'ok' => 'Category 表正常。', + ), + 'connection' => array( + 'nok' => '数据库连接失败。', + 'ok' => '数据库连接正常。', + ), + 'ctype' => array( + 'nok' => '找不到字符类型检测库 (php-ctype) 。', + 'ok' => '已找到字符类型检测库 (ctype) 。', + ), + 'curl' => array( + 'nok' => '找不到 cURL 库 (php-curl package) 。', + 'ok' => '已找到 cURL 库。', + ), + 'data' => array( + 'nok' => '请检查 <em>./data</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'data 目录权限正常。', + ), + 'database' => '数据库相关', + 'dom' => array( + 'nok' => '找不到用于浏览 DOM 的库 (php-xml) 。', + 'ok' => '已找到用于浏览 DOM 的库。', + ), + 'entries' => array( + 'nok' => 'Entry 表配置错误。', + 'ok' => 'Entry 表正常。', + ), + 'favicons' => array( + 'nok' => '请检查 <em>./data/favicons</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'favicons 目录权限正常。', + ), + 'feeds' => array( + 'nok' => 'Feed 表配置错误。', + 'ok' => 'Feed 表正常。', + ), + 'fileinfo' => array( + 'nok' => '找不到 PHP fileinfo 库 (fileinfo) 。', + 'ok' => '已找到 fileinfo 库。', + ), + 'files' => '文件相关', + 'json' => array( + 'nok' => '找不到 JSON 扩展 (php5-json ) 。', + 'ok' => '已找到 JSON 扩展', + ), + 'minz' => array( + 'nok' => '找不到 Minz 框架。', + 'ok' => '已找到 Minz 框架。', + ), + 'pcre' => array( + 'nok' => '找不到正则表达式解析库 (php-pcre) 。', + 'ok' => '已找到正则表达式解析库 (PCRE) 。', + ), + 'pdo' => array( + 'nok' => '找不到 PDO 或支持的驱动 (pdo_mysql, pdo_sqlite, pdo_pgsql) 。', + 'ok' => '已找到 PDO 和支持的至少一种驱动 (pdo_mysql, pdo_sqlite, pdo_pgsql) 。', + ), + 'php' => array( + '_' => 'PHP 相关', + 'nok' => '你的 PHP 版本为 %s,但 FreshRSS 最低需要 %s。', + 'ok' => '你的 PHP 版本为 %s,与 FreshRSS 兼容。', + ), + 'tables' => array( + 'nok' => '数据库中缺少一个或多个表。', + 'ok' => '数据库中相关表存在。', + ), + 'title' => '环境检查', + 'tokens' => array( + 'nok' => '请检查 <em>./data/tokens</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'tokens 目录权限正常。', + ), + 'users' => array( + 'nok' => '请检查 <em>./data/users</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'users 目录权限正常。', + ), + 'zip' => array( + 'nok' => '找不到 ZIP 扩展 (php-zip) 。', + 'ok' => '已找到 ZIP 扩展。', + ), + ), + 'extensions' => array( + 'disabled' => '已禁用', + 'empty_list' => '没有已安装的扩展', + 'enabled' => '已启用', + 'no_configure_view' => '此扩展不能配置。', + 'system' => array( + '_' => '系统扩展', + 'no_rights' => '系统扩展 (你不能修改它)', + ), + 'title' => '扩展', + 'user' => '用户扩展', + 'community' => 'Available community extensions', // @todo translate + 'name' => 'Name', // @todo translate + 'version' => 'Version', // @todo translate + 'description' => 'Description', // @todo translate + 'author' => 'Author', // @todo translate + 'latest' => 'Installed', // @todo translate + 'update' => 'Update available', // @todo translate + ), + 'stats' => array( + '_' => '统计', + 'all_feeds' => '所有 RSS 源', + 'category' => '分类', + 'entry_count' => '条目数', + 'entry_per_category' => '每分类条目数', + 'entry_per_day' => '每天条目数 (最近 30 天)', + 'entry_per_day_of_week' => '周内每天 (平均: %.2f 条消息)', + 'entry_per_hour' => '每小时 (平均: %.2f 条消息)', + 'entry_per_month' => '每月 (平均: %.2f 条消息)', + 'entry_repartition' => '条目分布', + 'feed' => 'RSS 源', + 'feed_per_category' => '每分类 RSS 源', + 'idle' => '闲置 RSS 源', + 'main' => '主要统计', + 'main_stream' => '首页', + 'menu' => array( + 'idle' => '闲置 RSS 源', + 'main' => '主要统计', + 'repartition' => '文章分布', + ), + 'no_idle' => '无闲置 RSS 源!', + 'number_entries' => '%d 篇文章', + 'percent_of_total' => '%%', + 'repartition' => '文章分布', + 'status_favorites' => '收藏', + 'status_read' => '已读', + 'status_total' => '总计', + 'status_unread' => '未读', + 'title' => '统计', + 'top_feed' => '前十 RSS 源', + ), + 'system' => array( + '_' => '系统配置', + 'auto-update-url' => '自动升级服务器 URL', + 'instance-name' => '实例名称', + 'max-categories' => '每用户分类限制', + 'max-feeds' => '每用户 RSS 源限制', + 'registration' => array( + 'help' => '0 表示无账户数限制', + 'number' => '最大账户数', + ), + ), + 'update' => array( + '_' => '更新系统', + 'apply' => '应用', + 'check' => '检查更新', + 'current_version' => '当前 FreshRSS 版本为 %s.', + 'last' => '上一次检查: %s', + 'none' => '没有可用更新', + 'title' => '更新系统', + ), + 'user' => array( + 'articles_and_size' => '%s 篇文章 (%s)', + 'create' => '创建新用户', + 'language' => '语言', + 'number' => '已有 %d 个帐户', + 'numbers' => '已有 %d 个帐户', + 'password_form' => '密码<br /><small>(用于 Web-form 登录方式)</small>', + 'password_format' => '至少 7 个字符', + 'title' => '用户管理', + 'user_list' => '用户列表', + 'username' => '用户名', + 'users' => '用户', + ), +); diff --git a/app/i18n/zh-cn/conf.php b/app/i18n/zh-cn/conf.php new file mode 100644 index 000000000..1b52ac38f --- /dev/null +++ b/app/i18n/zh-cn/conf.php @@ -0,0 +1,174 @@ +<?php + +return array( + 'archiving' => array( + '_' => '存档', + 'advanced' => '高级', + 'delete_after' => '文章保留', + 'help' => '详细选项位于单独的 RSS 源设置', + 'keep_history_by_feed' => '至少保存的文章数', + 'optimize' => '优化数据库', + 'optimize_help' => '偶尔执行优化可以减少数据库大小', + 'purge_now' => '立即清除', + 'title' => '存档', + 'ttl' => '最小自动更新时间', + ), + 'display' => array( + '_' => '显示', + 'icon' => array( + 'bottom_line' => '底栏', + 'entry' => '文章图标', + 'publication_date' => '更新日期', + 'related_tags' => '相关标签', + 'sharing' => '分享', + 'top_line' => '顶栏', + ), + 'language' => '语言', + 'notif_html5' => array( + 'seconds' => '秒 (0 表示不超时)', + 'timeout' => 'HTML5 通知超时时间', + ), + 'theme' => '主题', + 'title' => '显示', + 'width' => array( + 'content' => '内容宽度', + 'large' => '大', + 'medium' => '中', + 'no_limit' => '无限制', + 'thin' => '小', + ), + ), + 'query' => array( + '_' => '自定义查询', + 'deprecated' => '此查询不再有效。相关的分类或 RSS 源已被删除。', + 'filter' => '生效的过滤器:', + 'get_all' => '显示所有文章', + 'get_category' => '显示分类 "%s"', + 'get_favorite' => '显示收藏文章', + 'get_feed' => '显示RSS 源 "%s"', + 'no_filter' => '无过滤器', + 'none' => '你未创建任何自定义查询。', + 'number' => '查询 n°%d', + 'order_asc' => '由旧到新显示文章', + 'order_desc' => '由新到旧显示文章', + 'search' => '搜索 "%s"', + 'state_0' => '显示所有文章', + 'state_1' => '显示已读文章', + 'state_2' => '显示未读文章', + 'state_3' => '显示所有文章', + 'state_4' => '显示收藏文章', + 'state_5' => '显示已读的收藏文章', + 'state_6' => '显示未读的收藏文章', + 'state_7' => '显示收藏文章', + 'state_8' => '显示未收藏文章', + 'state_9' => '显示已读的未收藏文章', + 'state_10' => '显示未读的未收藏文章', + 'state_11' => '显示未收藏文章', + 'state_12' => '显示所有文章', + 'state_13' => '显示已读文章', + 'state_14' => '显示未读文章', + 'state_15' => '显示所有文章', + 'title' => '自定义查询', + ), + 'profile' => array( + '_' => '帐户管理', + 'delete' => array( + '_' => '账户删除', + 'warn' => '你的帐户和所有相关数据都将被删除。', + ), + 'password_api' => 'API 密码<br /><small>(例如,用于手机 APP)</small>', + 'password_form' => '密码<br /><small>(用于 Web-form 登录方式)</small>', + 'password_format' => '至少 7 个字符', + 'title' => '用户帐户', + ), + 'reading' => array( + '_' => '阅读', + 'after_onread' => '“全部设为已读”后,', + 'articles_per_page' => '每页文章数', + 'auto_load_more' => '在页面底部载入下一篇文章', + 'auto_remove_article' => '阅读后隐藏文章', + 'mark_updated_article_unread' => '有更新的文章设为未读', + 'confirm_enabled' => '“全部设为已读”时显示确认对话框', + 'display_articles_unfolded' => '默认展开文章', + 'display_categories_unfolded' => '默认展开分类', + 'hide_read_feeds' => '隐藏没有未读文章的分类或 RSS 源 (启用“显示所有文章”时不生效))', + 'img_with_lazyload' => '延迟加载图片', + 'sides_close_article' => '点击文章外区域以关闭文章', + 'jump_next' => '跳转到下一未读项 (RSS 源或分类)', + 'number_divided_when_reader' => '阅读视图中显示一半', + 'read' => array( + 'article_open_on_website' => '在打开原文章后', + 'article_viewed' => '在文章被浏览后', + 'scroll' => '在滚动浏览后', + 'upon_reception' => '在接收文章后', + 'when' => '将文章设为已读…', + ), + 'show' => array( + '_' => '文章显示', + 'adaptive' => '智能显示', + 'all_articles' => '显示所有文章', + 'unread' => '只显示未读', + ), + 'sort' => array( + '_' => '排列顺序', + 'newer_first' => '由新到旧', + 'older_first' => '由旧到新', + ), + 'sticky_post' => '打开文章时将其置顶', + 'title' => '阅读', + 'view' => array( + 'default' => '默认视图', + 'global' => '全屏视图', + 'normal' => '普通视图', + 'reader' => '阅读视图', + ), + ), + 'sharing' => array( + '_' => '分享', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => '更多信息', + 'print' => '打印', + 'shaarli' => 'Shaarli', + 'share_name' => '名称', + 'share_url' => '地址', + 'title' => '分享', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => '快捷键', + 'article_action' => '文章操作', + 'auto_share' => '分享', + 'auto_share_help' => '如果有多种分享模式,则会按照它们的编号依次访问。', + 'close_dropdown' => '关闭菜单', + 'collapse_article' => '收起文章', + 'first_article' => '跳转到第一篇文章', + 'focus_search' => '聚焦到搜索框', + 'help' => '显示帮助文档', + 'javascript' => '若要使用快捷键,必须启用 JavaScript', + 'last_article' => '跳转到最后一篇文章', + 'load_more' => '载入更多文章', + 'mark_read' => '设为已读', + 'mark_favorite' => '加入收藏', + 'navigation' => '浏览', + 'navigation_help' => '搭配 "Shift" 键,浏览快捷键将生效于 RSS 源。<br/>搭配 "Alt" 键,浏览快捷键将生效于分类。', + 'next_article' => '跳转到下一篇文章', + 'other_action' => '其他操作', + 'previous_article' => '跳转到上一篇文章', + 'see_on_website' => '在原网站上查看', + 'shift_for_all_read' => '+ <code>shift</code> 可以将全部文章设为已读', + 'title' => '快捷键', + 'user_filter' => '显示自定义查询', + 'user_filter_help' => '如果有多个自定义过滤器,则会按照它们的编号依次访问。', + ), + 'user' => array( + 'articles_and_size' => '%s 篇文章 (%s)', + 'current' => '当前用户', + 'is_admin' => '此用户为管理员', + 'users' => '用户', + ), +); diff --git a/app/i18n/zh-cn/feedback.php b/app/i18n/zh-cn/feedback.php new file mode 100644 index 000000000..4ec833668 --- /dev/null +++ b/app/i18n/zh-cn/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => '优化完成', + ), + 'access' => array( + 'denied' => '你无权访问此页面', + 'not_found' => '你寻找的页面不存在', + ), + 'auth' => array( + 'form' => array( + 'not_set' => '配置认证方式时出错。请稍后重试。', + 'set' => 'Form 是你当前默认的认证方式。', + ), + 'login' => array( + 'invalid' => '用户名或密码无效', + 'success' => '登录成功', + ), + 'logout' => array( + 'success' => '登出成功', + ), + 'no_password_set' => '管理员密码尚未设置。此特性不可用。', + ), + 'conf' => array( + 'error' => '保存配置时出错', + 'query_created' => '查询 "%s" 已创建。', + 'shortcuts_updated' => '快捷键已更新', + 'updated' => '配置已更新', + ), + 'extensions' => array( + 'already_enabled' => '%s 已启用', + 'disable' => array( + 'ko' => '%s 禁用失败。<a href="%s">检查 FressRSS 日志</a> 查看详情。', + 'ok' => '%s 现已禁用', + ), + 'enable' => array( + 'ko' => '%s 启用失败。<a href="%s">检查 FressRSS 日志</a> 查看详情。', + 'ok' => '%s 现已禁用', + ), + 'no_access' => '你无权访问 %s', + 'not_enabled' => '%s 未启用', + 'not_found' => '%s 不存在', + ), + 'import_export' => array( + 'export_no_zip_extension' => '服务器未启用 ZIP 扩展。请尝试逐个导出文件。', + 'feeds_imported' => '你的 RSS 源已导入,即将更新', + 'feeds_imported_with_errors' => '你的 RSS 源已导入,但发生错误', + 'file_cannot_be_uploaded' => '文件未能上传!', + 'no_zip_extension' => '服务器未启用 ZIP 扩展。', + 'zip_error' => '导入 ZIP 文件时出错', + ), + 'sub' => array( + 'actualize' => '获取', + 'category' => array( + 'created' => '分类 %s 已创建。', + 'deleted' => '分类已删除。', + 'emptied' => '分类已清空。', + 'error' => '分类更新失败。', + 'name_exists' => '分类名已存在。', + 'no_id' => '你必须明确分类 ID', + 'no_name' => '分类名不能为空。', + 'not_delete_default' => '你不能删除默认分类!', + 'not_exist' => '分类不存在!', + 'over_max' => '你已达到分类数限制 (%d)', + 'updated' => '分类已更新。', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> 已更新', + 'actualizeds' => 'RSS 源已更新', + 'added' => 'RSS 源 <em>%s</em> 已添加', + 'already_subscribed' => '你已订阅 <em>%s</em>', + 'deleted' => 'RSS 源已删除', + 'error' => 'RSS 源更新失败', + 'internal_problem' => 'RSS 源添加失败。<a href="%s">检查 FressRSS 日志</a> 查看详情。', + 'invalid_url' => 'URL <em>%s</em> 无效', + 'marked_read' => 'RSS 源已被设为已读', + 'n_actualized' => '%d 个 RSS 源已更新', + 'n_entries_deleted' => '%d 篇文章已删除', + 'no_refresh' => '没有可刷新的 RSS 源…', + 'not_added' => '<em>%s</em> 添加失败', + 'over_max' => '你已达到 RSS 源数限制 (%d)', + 'updated' => 'RSS 源已更新', + ), + 'purge_completed' => '清除完成 (%d 篇文章已删除)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS 将更新到 <strong>版本 %s</strong>.', + 'error' => '更新出错:%s', + 'file_is_nok' => '请检查 <em>%s</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'finished' => '更新完成!', + 'none' => '没有可用更新', + 'server_not_found' => '找不到更新服务器 [%s]', + ), + 'user' => array( + 'created' => array( + '_' => '用户 %s 已创建', + 'error' => '用户 %s 创建失败', + ), + 'deleted' => array( + '_' => '用户 %s 已删除', + 'error' => '用户 %s 删除失败', + ), + ), + 'profile' => array( + 'error' => '你的帐户修改失败', + 'updated' => '你的帐户已修改', + ), +); diff --git a/app/i18n/zh-cn/gen.php b/app/i18n/zh-cn/gen.php new file mode 100644 index 000000000..84be9f4ba --- /dev/null +++ b/app/i18n/zh-cn/gen.php @@ -0,0 +1,190 @@ +<?php + +return array( + 'action' => array( + 'actualize' => '获取', + 'back_to_rss_feeds' => '← 返回', + 'cancel' => '取消', + 'create' => '创建', + 'disable' => '禁用', + 'empty' => '清空', + 'enable' => '启用', + 'export' => '导出', + 'filter' => '过滤器', + 'import' => '导入', + 'manage' => '管理', + 'mark_favorite' => '加入收藏', + 'mark_read' => '设为已读', + 'remove' => '删除', + 'see_website' => '查看网站', + 'submit' => '提交', + 'truncate' => '删除所有文章', + ), + 'auth' => array( + 'email' => 'Email 地址', + 'keep_logged_in' => '自动登录<small>(%s 天)</small>', + 'login' => '登录', + 'logout' => '登出', + 'password' => array( + '_' => '密码', + 'format' => '<small>至少 7 个字符</small>', + ), + 'registration' => array( + '_' => '新账户', + 'ask' => '创建新账户?', + 'title' => '账户创建', + ), + 'reset' => '密码重置', + 'username' => array( + '_' => '用户名', + 'admin' => '管理员用户名', + 'format' => '<small>最大 16 个数字或字母</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => '四月', + 'april' => '四月', + 'aug' => '八月', + 'august' => '八月', + 'before_yesterday' => '昨天以前', + 'dec' => '十二月', + 'december' => '十二月', + 'feb' => '二月', + 'february' => '二月', + 'format_date' => 'Y\\年n\\月j\\日', + 'format_date_hour' => 'Y\\年n\\月j\\日 H\\:i', + 'fri' => '周五', + 'jan' => '一月', + 'january' => '一月', + 'jul' => '七月', + 'july' => '七月', + 'jun' => '六月', + 'june' => '六月', + 'last_3_month' => '最近三个月', + 'last_6_month' => '最近六个月', + 'last_month' => '上月', + 'last_week' => '上周', + 'last_year' => '去年', + 'mar' => '三月', + 'march' => '三月', + 'may' => '五月', + 'may_' => '五月', + 'mon' => '周一', + 'month' => '个月', + 'nov' => '十一月', + 'november' => '十一月', + 'oct' => '十月', + 'october' => '十月', + 'sat' => '周日', + 'sep' => '九月', + 'september' => '九月', + 'sun' => '周日', + 'thu' => '周四', + 'today' => '今天', + 'tue' => '周二', + 'wed' => '周三', + 'yesterday' => '昨天', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => '关于 FreshRSS', + ), + 'js' => array( + 'category_empty' => '清空分类', + 'confirm_action' => '你确定要执行此操作吗?这将不可撤销!', + 'confirm_action_feed_cat' => '你确定要执行此操作吗?你将丢失相关的收藏和自定义查询。这将不可撤销!', + 'feedback' => array( + 'body_new_articles' => 'FreshRSS 中有 %%d 篇文章等待阅读。', + 'request_failed' => '请求失败,这可能是因为网络连接问题。', + 'title_new_articles' => 'FreshRSS: 新文章!', + ), + 'new_article' => '发现新文章,点击刷新页面。', + 'should_be_activated' => 'JavaScript 必须启用', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'es' => 'Español', + 'fr' => 'Français', + 'it' => 'Italiano', + 'kr' => '한국어', + 'nl' => 'Nederlands', + 'pt-br' => 'Português (Brasil)', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + 'zh-cn' => '简体中文', + ), + 'menu' => array( + 'about' => '关于', + 'admin' => '管理', + 'archiving' => '存档', + 'authentication' => '认证', + 'check_install' => '环境检查', + 'configuration' => '配置', + 'display' => '显示', + 'extensions' => '扩展', + 'logs' => '日志', + 'queries' => '自定义查询', + 'reading' => '阅读', + 'search' => '搜索内容或#标签', + 'sharing' => '分享', + 'shortcuts' => '快捷键', + 'stats' => '统计', + 'system' => '系统配置', + 'update' => '更新', + 'user_management' => '用户管理', + 'user_profile' => '用户帐户', + ), + 'pagination' => array( + 'first' => '第一页', + 'last' => '最后一页', + 'load_more' => '载入更多文章', + 'mark_all_read' => '全部设为已读', + 'next' => '下一页', + 'nothing_to_load' => '没有更多文章了', + 'previous' => '上一页', + ), + 'share' => array( + 'Known' => 'Known based sites', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'gnusocial' => 'GNU social', + 'jdh' => 'Journal du hacker', + 'mastodon' => 'Mastodon', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => '警告!', + 'blank_to_disable' => '留空以禁用', + 'by_author' => '作者 <em>%s</em>', + 'by_default' => '默认', + 'damn' => '错误!', + 'default_category' => '未分类', + 'no' => '否', + 'not_applicable' => '不可用', + 'ok' => '正常!', + 'or' => '或', + 'yes' => '是', + ), +); diff --git a/app/i18n/zh-cn/index.php b/app/i18n/zh-cn/index.php new file mode 100644 index 000000000..0d6e8e82d --- /dev/null +++ b/app/i18n/zh-cn/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => '关于', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bug 报告', + 'credits' => '致谢', + 'credits_content' => '某些设计元素来自于 <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> ,尽管 FreshRSS 并没有使用此框架。<a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">图标</a> 来自于 <a href="https://www.gnome.org/">GNOME 项目</a>。<em>Open Sans</em> 字体出自 <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a> 之手。FreshRSS 基于 PHP 框架 <a href="https://github.com/marienfressinaud/MINZ">Minz</a>。', + 'freshrss_description' => 'FreshRSS 是一个自托管的 RSS 聚合服务,类似于 <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> 或 <a href="http://projet.idleman.fr/leed/">Leed</a>。 它不仅轻快又易用,而且强大又易于配置。', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">Github Issues</a>', + 'license' => '授权', + 'project_website' => '项目网站', + 'title' => '关于', + 'version' => '版本', + 'website' => '网站', + ), + 'feed' => array( + 'add' => '你可以添加一些 RSS 源。', + 'empty' => '暂时没有文章可显示。', + 'rss_of' => '%s 的 RSS 源', + 'title' => '首页', + 'title_global' => '全屏视图', + 'title_fav' => '收藏', + ), + 'log' => array( + '_' => '日志', + 'clear' => '清除日志', + 'empty' => '日志文件为空', + 'title' => '日志', + ), + 'menu' => array( + 'about' => '关于 FreshRSS', + 'add_query' => '添加查询', + 'before_one_day' => '一天前', + 'before_one_week' => '一周前', + 'favorites' => '收藏 (%s)', + 'global_view' => '全屏视图', + 'main_stream' => '首页', + 'mark_all_read' => '全部设为已读', + 'mark_cat_read' => '此分类设为已读', + 'mark_feed_read' => '此源设为已读', + 'newer_first' => '由新到旧', + 'non-starred' => '不显示收藏', + 'normal_view' => '普通视图', + 'older_first' => '由旧到新', + 'queries' => '自定义查询', + 'read' => '只显示已读', + 'reader_view' => '阅读视图', + 'rss_view' => 'RSS 源', + 'search_short' => '搜索', + 'starred' => '只显示收藏', + 'stats' => '统计', + 'subscription' => '订阅管理', + 'unread' => '只显示未读', + ), + 'share' => '分享', + 'tag' => array( + 'related' => '相关标签', + ), +); diff --git a/app/i18n/zh-cn/install.php b/app/i18n/zh-cn/install.php new file mode 100644 index 000000000..1e172f0d5 --- /dev/null +++ b/app/i18n/zh-cn/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => '完成安装', + 'fix_errors_before' => '请在继续下一步前修复错误。', + 'keep_install' => '保留以前配置', + 'next_step' => '下一步', + 'reinstall' => '重新安装 FreshRSS', + ), + 'auth' => array( + 'form' => 'Web form (传统方式, 需要 JavaScript)', + 'http' => 'HTTP (面向启用 HTTPS 的高级用户)', + 'none' => '无 (危险)', + 'password_form' => '密码<br /><small>(用于 Web-form 登录方式)</small>', + 'password_format' => '至少 7 个字符', + 'type' => '认证方式', + ), + 'bdd' => array( + '_' => '数据库', + 'conf' => array( + '_' => '数据库配置', + 'ko' => '请验证你的数据库信息。', + 'ok' => '数据库配置已保存。', + ), + 'host' => '主机', + 'prefix' => '表前缀', + 'password' => '密码', + 'type' => '数据库类型', + 'username' => '用户名', + ), + 'check' => array( + '_' => '检查', + 'already_installed' => '我们检测到 FreshRSS 已经安装!', + 'cache' => array( + 'nok' => '请检查 <em>./data/cache</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'cache 目录权限正常。', + ), + 'ctype' => array( + 'nok' => '找不到字符类型检测库 (php-ctype) 。', + 'ok' => '已找到字符类型检测库 (ctype) 。', + ), + 'curl' => array( + 'nok' => '找不到 cURL 库 (php-curl package) 。', + 'ok' => '已找到 cURL 库。', + ), + 'data' => array( + 'nok' => '请检查 <em>./data</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'data 目录权限正常。', + ), + 'dom' => array( + 'nok' => '找不到用于浏览 DOM 的库 (php-xml) 。', + 'ok' => '已找到用于浏览 DOM 的库。', + ), + 'favicons' => array( + 'nok' => '请检查 <em>./data/favicons</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'favicons 目录权限正常。', + ), + 'fileinfo' => array( + 'nok' => '找不到 PHP fileinfo 库 (fileinfo) 。', + 'ok' => '已找到 fileinfo 库。', + ), + 'http_referer' => array( + 'nok' => '请检查你是否修改了 HTTP REFERER。', + 'ok' => '你的 HTTP REFERER 已知且与服务器一致。', + ), + 'json' => array( + 'nok' => '找不到推荐的 JSON 解析库。', + 'ok' => '已找到推荐的 JSON 解析库。', + ), + 'minz' => array( + 'nok' => '找不到 Minz 框架。', + 'ok' => '已找到 Minz 框架。', + ), + 'pcre' => array( + 'nok' => '找不到正则表达式解析库 (php-pcre) 。', + 'ok' => '已找到正则表达式解析库 (PCRE) 。', + ), + 'pdo' => array( + 'nok' => '找不到 PDO 或支持的驱动 (pdo_mysql, pdo_sqlite, pdo_pgsql) 。', + 'ok' => '已找到 PDO 和支持的至少一种驱动 (pdo_mysql, pdo_sqlite, pdo_pgsql) 。', + ), + 'php' => array( + 'nok' => '你的 PHP 版本为 %s,但 FreshRSS 最低需要 %s。', + 'ok' => '你的 PHP 版本为 %s,与 FreshRSS 兼容。', + ), + 'users' => array( + 'nok' => '请检查 <em>./data/users</em> 目录权限。HTTP 服务器必须有其写入权限。', + 'ok' => 'users 目录权限正常。', + ), + 'xml' => array( + 'nok' => '找不到用于 XML 解析库。', + 'ok' => '已找到 XML 解析库。', + ), + ), + 'conf' => array( + '_' => '常规配置', + 'ok' => '常规配置已保存。', + ), + 'congratulations' => '恭喜!', + 'default_user' => '默认用户名 <small>(最大 16 个数字或字母)</small>', + 'delete_articles_after' => '保留文章', + 'fix_errors_before' => '请在继续下一步前修复错误。', + 'javascript_is_better' => '启用 JavaScript 会使 FreshRSS 工作得更好', + 'js' => array( + 'confirm_reinstall' => '重新安装 FreshRSS 将会重置之前的配置。你确定要继续吗?', + ), + 'language' => array( + '_' => '语言', + 'choose' => '为 FreshRSS 选择语言', + 'defined' => '语言已指定。', + ), + 'not_deleted' => '出错!你必须手动删除文件 <em>%s</em>。', + 'ok' => '安装成功。', + 'step' => '步骤 %d', + 'steps' => '步骤', + 'title' => '安装 FreshRSS', + 'this_is_the_end' => '最后一步', +); diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php new file mode 100644 index 000000000..026f436d7 --- /dev/null +++ b/app/i18n/zh-cn/sub.php @@ -0,0 +1,77 @@ +<?php + +return array( + 'api' => array( + 'documentation' => '复制以下地址,可供外部工具使用', + 'title' => 'API', + ), + 'bookmarklet' => array( + 'documentation' => '拖动此书签到你的书签栏或者右键选择“收藏此链接”,然后在你想要订阅的页面上点击“订阅”按钮', + 'label' => '订阅', + 'title' => '书签应用', + ), + 'category' => array( + '_' => '分类', + 'add' => '添加分类', + 'empty' => '空分类', + 'new' => '新分类', + ), + 'feed' => array( + 'add' => '添加 RSS 源', + 'advanced' => '高级', + 'archiving' => '存档', + 'auth' => array( + 'configuration' => '认证', + 'help' => '用于连接启用 HTTP 认证的 RSS 源', + 'http' => 'HTTP 认证', + 'password' => 'HTTP 密码', + 'username' => 'HTTP 用户名', + ), + 'css_help' => '用于获取全文(注意,这将耗费更多时间!)', + 'css_path' => '原文的 CSS 选择器', + 'description' => '描述', + 'empty' => '此源为空。请确认它是否正常更新。', + 'error' => '此源遇到一些问题。请在确认是否能正常访问后重试。', + 'in_main_stream' => '在首页中显示', + 'informations' => '信息', + 'keep_history' => '至少保存的文章数', + 'moved_category_deleted' => '删除分类时,其中的 RSS 源会自动归类到 <em>%s</em>', + 'no_selected' => '未选择 RSS 源。', + 'number_entries' => '%d 篇文章', + 'stats' => '统计', + 'think_to_add' => '你可以添加一些 RSS 源。', + 'title' => '标题', + 'title_add' => '添加 RSS 源', + 'ttl' => '最小自动更新时间', + 'url' => '源 URL', + 'validator' => '检查 RSS 源有效性', + 'website' => '网站 URL', + 'pubsubhubbub' => 'PubSubHubbub 即时通知', + ), + 'firefox' => array( + 'documentation' => '按照 <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox#Adding_a_new_feed_reader_manually">这里</a> 描述的步骤可将 FreshRSS 添加到 Firefox 阅读器列表', + 'title' => 'Firefox RSS 阅读器', + ), + 'import_export' => array( + 'export' => '导出', + 'export_opml' => '导出 RSS 源列表 (OPML)', + 'export_starred' => '导出你的收藏', + 'feed_list' => '%s 文章列表', + 'file_to_import' => '需要导入的文件<br />(OPML, JSON 或 ZIP)', + 'file_to_import_no_zip' => '需要导入的文件<br />(OPML 或 JSON)', + 'import' => '导入', + 'starred_list' => '收藏文章列表', + 'title' => '导入/导出', + ), + 'menu' => array( + 'bookmark' => '订阅 (FreshRSS 书签)', + 'import_export' => '导入/导出', + 'subscription_management' => '订阅管理', + 'subscription_tools' => '订阅工具', + ), + 'title' => array( + '_' => '订阅管理', + 'feed_management' => 'RSS 源管理', + 'subscription_tools' => '订阅工具', + ), +); diff --git a/app/install.php b/app/install.php index 177173fdb..870c93908 100644 --- a/app/install.php +++ b/app/install.php @@ -2,21 +2,20 @@ if (function_exists('opcache_reset')) { opcache_reset(); } +header("Content-Security-Policy: default-src 'self'"); -define('BCRYPT_COST', 9); +require(LIB_PATH . '/lib_install.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',(int)$_GET['step']); + define('STEP', (int)$_GET['step']); } else { define('STEP', 0); } -define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); - if (STEP === 3 && isset($_POST['type'])) { $_SESSION['bd_type'] = $_POST['type']; } @@ -24,10 +23,13 @@ if (STEP === 3 && isset($_POST['type'])) { if (isset($_SESSION['bd_type'])) { switch ($_SESSION['bd_type']) { case 'mysql': - include(APP_PATH . '/SQL/install.sql.mysql.php'); + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); break; case 'sqlite': - include(APP_PATH . '/SQL/install.sql.sqlite.php'); + include_once(APP_PATH . '/SQL/install.sql.sqlite.php'); + break; + case 'pgsql': + include_once(APP_PATH . '/SQL/install.sql.pgsql.php'); break; } } @@ -76,51 +78,80 @@ function saveLanguage() { } } +function saveStep1() { + if (isset($_POST['freshrss-keep-install']) && + $_POST['freshrss-keep-install'] === '1') { + // We want to keep our previous installation of FreshRSS + // so we need to make next steps valid by setting $_SESSION vars + // with values from the previous installation + + // First, we try to get previous configurations + Minz_Configuration::register('system', + join_path(DATA_PATH, 'config.php'), + join_path(FRESHRSS_PATH, 'config.default.php')); + $system_conf = Minz_Configuration::get('system'); + + $current_user = $system_conf->default_user; + Minz_Configuration::register('user', + join_path(USERS_PATH, $current_user, 'config.php'), + join_path(FRESHRSS_PATH, 'config-user.default.php')); + $user_conf = Minz_Configuration::get('user'); + + // Then, we set $_SESSION vars + $_SESSION['title'] = $system_conf->title; + $_SESSION['auth_type'] = $system_conf->auth_type; + $_SESSION['old_entries'] = $user_conf->old_entries; + $_SESSION['default_user'] = $current_user; + $_SESSION['passwordHash'] = $user_conf->passwordHash; + + $db = $system_conf->db; + $_SESSION['bd_type'] = $db['type']; + $_SESSION['bd_host'] = $db['host']; + $_SESSION['bd_user'] = $db['user']; + $_SESSION['bd_password'] = $db['password']; + $_SESSION['bd_base'] = $db['base']; + $_SESSION['bd_prefix'] = $db['prefix']; + $_SESSION['bd_error'] = ''; + + header('Location: index.php?step=4'); + } +} + function saveStep2() { + $user_default_config = Minz_Configuration::get('default_user'); if (!empty($_POST)) { - $_SESSION['title'] = substr(trim(param('title', _t('gen.freshrss'))), 0, 25); - $_SESSION['old_entries'] = param('old_entries', 3); + $system_default_config = Minz_Configuration::get('default_system'); + $_SESSION['title'] = $system_default_config->title; + $_SESSION['old_entries'] = param('old_entries', $user_default_config->old_entries); $_SESSION['auth_type'] = param('auth_type', 'form'); - $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', param('default_user', '')), 0, 16); - $_SESSION['mail_login'] = filter_var(param('mail_login', ''), FILTER_VALIDATE_EMAIL); + $_SESSION['default_user'] = substr(preg_replace('/[^0-9a-zA-Z_]/', '', param('default_user', '')), 0, 38); $password_plain = param('passwordPlain', false); - if ($password_plain !== false) { - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($password_plain, PASSWORD_BCRYPT, array('cost' => BCRYPT_COST)); - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $_SESSION['passwordHash'] = $passwordHash; + if ($password_plain !== false && cryptAvailable()) { + $_SESSION['passwordHash'] = FreshRSS_user_Controller::hashPassword($password_plain); } - if (empty($_SESSION['title']) || - empty($_SESSION['old_entries']) || + if (empty($_SESSION['old_entries']) || empty($_SESSION['auth_type']) || empty($_SESSION['default_user'])) { return false; } - if (($_SESSION['auth_type'] === 'form' && empty($_SESSION['passwordHash'])) || - ($_SESSION['auth_type'] === 'persona' && empty($_SESSION['mail_login']))) { + if ($_SESSION['auth_type'] === 'form' && empty($_SESSION['passwordHash'])) { return false; } - $_SESSION['salt'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); + $_SESSION['salt'] = generateSalt(); if ((!ctype_digit($_SESSION['old_entries'])) ||($_SESSION['old_entries'] < 1)) { - $_SESSION['old_entries'] = 3; + $_SESSION['old_entries'] = $user_default_config->old_entries; } $token = ''; - if ($_SESSION['mail_login']) { - $token = sha1($_SESSION['salt'] . $_SESSION['mail_login']); - } $config_array = array( 'language' => $_SESSION['language'], - 'theme' => 'Origine', + 'theme' => $user_default_config->theme, 'old_entries' => $_SESSION['old_entries'], - 'mail_login' => $_SESSION['mail_login'], 'passwordHash' => $_SESSION['passwordHash'], 'token' => $token, ); @@ -132,13 +163,7 @@ function saveStep2() { recursive_unlink($user_dir); mkdir($user_dir); - file_put_contents($user_config_path, "<?php\n return " . var_export($config_array, true) . ';'); - - if ($_SESSION['mail_login'] != '') { - $personaFile = join_path(DATA_PATH, 'persona', $_SESSION['mail_login'] . '.txt'); - @unlink($personaFile); - file_put_contents($personaFile, $_SESSION['default_user']); - } + file_put_contents($user_config_path, "<?php\n return " . var_export($config_array, true) . ";\n"); header('Location: index.php?step=3'); } @@ -165,12 +190,17 @@ function saveStep3() { $_SESSION['bd_user'] = $_POST['user']; $_SESSION['bd_password'] = $_POST['pass']; $_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16); - $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] .(empty($_SESSION['default_user']) ? '' :($_SESSION['default_user'] . '_')); + $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); + } + if ($_SESSION['bd_type'] === 'pgsql') { + $_SESSION['bd_base'] = strtolower($_SESSION['bd_base']); } + // We use dirname to remove the /i part + $base_url = dirname(Minz_Request::guessBaseUrl()); $config_array = array( - 'environment' => 'production', 'salt' => $_SESSION['salt'], + 'base_url' => $base_url, 'title' => $_SESSION['title'], 'default_user' => $_SESSION['default_user'], 'auth_type' => $_SESSION['auth_type'], @@ -181,59 +211,36 @@ function saveStep3() { 'password' => $_SESSION['bd_password'], 'base' => $_SESSION['bd_base'], 'prefix' => $_SESSION['bd_prefix'], + 'pdo_options' => array(), ), + 'pubsubhubbub_enabled' => server_is_public($base_url), ); @unlink(join_path(DATA_PATH, 'config.php')); //To avoid access-rights problems - file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config_array, true) . ';'); + file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config_array, true) . ";\n"); - $res = checkBD(); + $config_array['db']['default_user'] = $config_array['default_user']; + $config_array['db']['prefix_user'] = $_SESSION['bd_prefix_user']; + $ok = checkDb($config_array['db']) && checkDbUser($config_array['db']); + if (!$ok) { + @unlink(join_path(DATA_PATH, 'config.php')); + } - if ($res) { + if ($ok) { $_SESSION['bd_error'] = ''; header('Location: index.php?step=4'); - } elseif (empty($_SESSION['bd_error'])) { - $_SESSION['bd_error'] = 'Unknown error!'; + } else { + $_SESSION['bd_error'] = empty($config_array['db']['error']) ? 'Unknown error!' : $config_array['db']['error']; } } invalidateHttpCache(); } -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:' . join_path(USERS_PATH, $_SESSION['default_user'], 'db.sqlite'); - $driver_options = array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ); - break; - default: - return false; - } - return new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); -} - -function deleteInstall() { - $res = unlink(join_path(DATA_PATH, 'do-install.txt')); - - if (!$res) { - return false; - } - - header('Location: index.php'); -} - /*** VÉRIFICATIONS ***/ function checkStep() { $s0 = checkStep0(); - $s1 = checkStep1(); + $s1 = checkRequirements(); $s2 = checkStep2(); $s3 = checkStep3(); if (STEP > 0 && $s0['all'] != 'ok') { @@ -259,49 +266,35 @@ function checkStep0() { ); } -function checkStep1() { - $php = version_compare(PHP_VERSION, '5.2.1') >= 0; - $minz = file_exists(join_path(LIB_PATH, 'Minz')); - $curl = extension_loaded('curl'); - $pdo_mysql = extension_loaded('pdo_mysql'); - $pdo_sqlite = extension_loaded('pdo_sqlite'); - $pdo = $pdo_mysql || $pdo_sqlite; - $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); - $users = USERS_PATH && is_writable(USERS_PATH); - $favicons = is_writable(join_path(DATA_PATH, 'favicons')); - $persona = is_writable(join_path(DATA_PATH, 'persona')); - $http_referer = is_referer_from_same_domain(); +function freshrss_already_installed() { + $conf_path = join_path(DATA_PATH, 'config.php'); + if (!file_exists($conf_path)) { + return false; + } - return array( - 'php' => $php ? 'ok' : 'ko', - 'minz' => $minz ? 'ok' : 'ko', - 'curl' => $curl ? 'ok' : 'ko', - 'pdo-mysql' => $pdo_mysql ? 'ok' : 'ko', - 'pdo-sqlite' => $pdo_sqlite ? 'ok' : 'ko', - 'pdo' => $pdo ? 'ok' : 'ko', - 'pcre' => $pcre ? 'ok' : 'ko', - 'ctype' => $ctype ? 'ok' : 'ko', - 'dom' => $dom ? 'ok' : 'ko', - 'data' => $data ? 'ok' : 'ko', - 'cache' => $cache ? 'ok' : 'ko', - 'users' => $users ? 'ok' : 'ko', - 'favicons' => $favicons ? 'ok' : 'ko', - 'persona' => $persona ? 'ok' : 'ko', - 'http_referer' => $http_referer ? 'ok' : 'ko', - 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && - $data && $cache && $users && $favicons && $persona && $http_referer ? - 'ok' : 'ko' - ); + // A configuration file already exists, we try to load it. + $system_conf = null; + try { + Minz_Configuration::register('system', $conf_path); + $system_conf = Minz_Configuration::get('system'); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, the global conf exists... but what about default user conf? + $current_user = $system_conf->default_user; + try { + Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php')); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, ok, default user exists too! + return true; } function checkStep2() { - $conf = !empty($_SESSION['title']) && - !empty($_SESSION['old_entries']) && - isset($_SESSION['mail_login']) && + $conf = !empty($_SESSION['old_entries']) && !empty($_SESSION['default_user']); $form = ( @@ -309,11 +302,6 @@ function checkStep2() { ($_SESSION['auth_type'] != 'form' || !empty($_SESSION['passwordHash'])) ); - $persona = ( - isset($_SESSION['auth_type']) && - ($_SESSION['auth_type'] != 'persona' || !empty($_SESSION['mail_login'])) - ); - $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user']; if ($defaultUser === null) { $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; @@ -323,9 +311,8 @@ function checkStep2() { return array( 'conf' => $conf ? 'ok' : 'ko', 'form' => $form ? 'ok' : 'ko', - 'persona' => $persona ? 'ok' : 'ko', 'data' => $data ? 'ok' : 'ko', - 'all' => $conf && $form && $persona && $data ? 'ok' : 'ko' + 'all' => $conf && $form && $data ? 'ok' : 'ko' ); } @@ -349,65 +336,31 @@ function checkStep3() { ); } -function checkBD() { +function checkDbUser(&$dbOptions) { $ok = false; - + $str = $dbOptions['dsn']; + $driver_options = $dbOptions['options']; 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:' . join_path(USERS_PATH, $_SESSION['default_user'], 'db.sqlite'); - $driver_options = array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ); - break; - default: - return false; - } - - $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); - + $c = new PDO($str, $dbOptions['user'], $dbOptions['password'], $driver_options); if (defined('SQL_CREATE_TABLES')) { - $sql = sprintf(SQL_CREATE_TABLES, $_SESSION['bd_prefix_user'], _t('gen.short.default_category')); + $sql = sprintf(SQL_CREATE_TABLES . SQL_CREATE_TABLE_ENTRYTMP . SQL_INSERT_FEEDS, + $dbOptions['prefix_user'], _t('gen.short.default_category')); $stm = $c->prepare($sql); - $ok = $stm->execute(); + $ok = $stm && $stm->execute(); } else { - global $SQL_CREATE_TABLES; - if (is_array($SQL_CREATE_TABLES)) { - $ok = true; - foreach ($SQL_CREATE_TABLES as $instruction) { - $sql = sprintf($instruction, $_SESSION['bd_prefix_user'], _t('gen.short.default_category')); - $stm = $c->prepare($sql); - $ok &= $stm->execute(); - } + global $SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_INSERT_FEEDS; + $instructions = array_merge($SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_INSERT_FEEDS); + $ok = !empty($instructions); + foreach ($instructions as $instruction) { + $sql = sprintf($instruction, $dbOptions['prefix_user'], _t('gen.short.default_category')); + $stm = $c->prepare($sql); + $ok &= $stm && $stm->execute(); } } } catch (PDOException $e) { $ok = false; - $_SESSION['bd_error'] = $e->getMessage(); - } - - if (!$ok) { - @unlink(join_path(DATA_PATH, 'config.php')); + $dbOptions['error'] = $e->getMessage(); } - return $ok; } @@ -425,7 +378,7 @@ function printStep0() { <div class="form-group"> <label class="group-name" for="language"><?php echo _t('install.language'); ?></label> <div class="group-controls"> - <select name="language" id="language"> + <select name="language" id="language" tabindex="1" > <?php foreach ($languages as $lang) { ?> <option value="<?php echo $lang; ?>"<?php echo $actual == $lang ? ' selected="selected"' : ''; ?>> <?php echo _t('gen.lang.' . $lang); ?> @@ -437,10 +390,10 @@ function printStep0() { <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> - <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + <button type="submit" class="btn btn-important" tabindex="2" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="3" ><?php echo _t('gen.action.cancel'); ?></button> <?php if ($s0['all'] == 'ok') { ?> - <a class="btn btn-important next-step" href="?step=1"><?php echo _t('install.action.next_step'); ?></a> + <a class="btn btn-important next-step" href="?step=1" tabindex="4" ><?php echo _t('install.action.next_step'); ?></a> <?php } ?> </div> </div> @@ -450,14 +403,14 @@ function printStep0() { // @todo refactor this view with the check_install action function printStep1() { - $res = checkStep1(); + $res = checkRequirements(); ?> <noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('install.javascript_is_better'); ?></p></noscript> <?php if ($res['php'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.php.ok', PHP_VERSION); ?></p> <?php } else { ?> - <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.php.nok', PHP_VERSION, '5.2.1'); ?></p> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.php.nok', PHP_VERSION, '5.3.8'); ?></p> <?php } ?> <?php if ($res['minz'] == 'ok') { ?> @@ -479,6 +432,12 @@ function printStep1() { <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.curl.nok'); ?></p> <?php } ?> + <?php if ($res['json'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.json.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.json.nok'); ?></p> + <?php } ?> + <?php if ($res['pcre'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.pcre.ok'); ?></p> <?php } else { ?> @@ -497,6 +456,18 @@ function printStep1() { <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.dom.nok'); ?></p> <?php } ?> + <?php if ($res['xml'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.xml.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.xml.nok'); ?></p> + <?php } ?> + + <?php if ($res['fileinfo'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.fileinfo.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.fileinfo.nok'); ?></p> + <?php } ?> + <?php if ($res['data'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.data.ok'); ?></p> <?php } else { ?> @@ -521,20 +492,23 @@ function printStep1() { <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.favicons.nok', DATA_PATH . '/favicons'); ?></p> <?php } ?> - <?php if ($res['persona'] == 'ok') { ?> - <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.persona.ok'); ?></p> - <?php } else { ?> - <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.persona.nok', DATA_PATH . '/persona'); ?></p> - <?php } ?> - <?php if ($res['http_referer'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.http_referer.ok'); ?></p> <?php } else { ?> <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.http_referer.nok'); ?></p> <?php } ?> - <?php if ($res['all'] == 'ok') { ?> - <a class="btn btn-important next-step" href="?step=2"><?php echo _t('install.action.next_step'); ?></a> + <?php if (freshrss_already_installed() && $res['all'] == 'ok') { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('install.check.already_installed'); ?></p> + + <form action="index.php?step=1" method="post"> + <input type="hidden" name="freshrss-keep-install" value="1" /> + <button type="submit" class="btn btn-important next-step" tabindex="1" ><?php echo _t('install.action.keep_install'); ?></button> + <a class="btn btn-attention next-step confirm" data-str-confirm="<?php echo _t('install.js.confirm_reinstall'); ?>" href="?step=2" tabindex="2" ><?php echo _t('install.action.reinstall'); ?></a> + </form> + + <?php } elseif ($res['all'] == 'ok') { ?> + <a class="btn btn-important next-step" href="?step=2" tabindex="1" ><?php echo _t('install.action.next_step'); ?></a> <?php } else { ?> <p class="alert alert-error"><?php echo _t('install.action.fix_errors_before'); ?></p> <?php } ?> @@ -542,6 +516,7 @@ function printStep1() { } function printStep2() { + $user_default_config = Minz_Configuration::get('default_user'); ?> <?php $s2 = checkStep2(); if ($s2['all'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.conf.ok'); ?></p> @@ -553,40 +528,32 @@ function printStep2() { <legend><?php echo _t('install.conf'); ?></legend> <div class="form-group"> - <label class="group-name" for="title"><?php echo _t('install.title'); ?></label> - <div class="group-controls"> - <input type="text" id="title" name="title" value="<?php echo isset($_SESSION['title']) ? $_SESSION['title'] : _t('gen.freshrss'); ?>" /> - </div> - </div> - - <div class="form-group"> <label class="group-name" for="old_entries"><?php echo _t('install.delete_articles_after'); ?></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('gen.date.month'); ?> + <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'] : $user_default_config->old_entries; ?>" tabindex="2" /> <?php echo _t('gen.date.month'); ?> </div> </div> <div class="form-group"> <label class="group-name" for="default_user"><?php echo _t('install.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() == '' ? 'alice' : httpAuthUser(); ?>" /> + <input type="text" id="default_user" name="default_user" required="required" size="16" pattern="<?php echo FreshRSS_user_Controller::USERNAME_PATTERN; ?>" value="<?php echo isset($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="<?php echo httpAuthUser() == '' ? 'alice' : httpAuthUser(); ?>" tabindex="3" /> </div> </div> <div class="form-group"> <label class="group-name" for="auth_type"><?php echo _t('install.auth.type'); ?></label> <div class="group-controls"> - <select id="auth_type" name="auth_type" required="required" onchange="auth_type_change(true)"> + <select id="auth_type" name="auth_type" required="required" tabindex="4"> <?php function no_auth($auth_type) { - return !in_array($auth_type, array('form', 'persona', 'http_auth', 'none')); + return !in_array($auth_type, array('form', 'http_auth', 'none')); } $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; ?> - <option value="form"<?php echo $auth_type === 'form' || no_auth($auth_type) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('install.auth.form'); ?></option> - <option value="persona"<?php echo $auth_type === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.persona'); ?></option> + <option value="form"<?php echo $auth_type === 'form' || (no_auth($auth_type) && cryptAvailable()) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('install.auth.form'); ?></option> <option value="http_auth"<?php echo $auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('install.auth.http'); ?>(REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option> - <option value="none"<?php echo $auth_type === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.none'); ?></option> + <option value="none"<?php echo $auth_type === 'none' || (no_auth($auth_type) && !cryptAvailable()) ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.none'); ?></option> </select> </div> </div> @@ -595,7 +562,7 @@ function printStep2() { <label class="group-name" for="passwordPlain"><?php echo _t('install.auth.password_form'); ?></label> <div class="group-controls"> <div class="stick"> - <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $auth_type === 'form' ? ' required="required"' : ''; ?> /> + <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $auth_type === 'form' ? ' required="required"' : ''; ?> tabindex="5" /> <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo FreshRSS_Themes::icon('key'); ?></a> </div> <?php echo _i('help'); ?> <?php echo _t('install.auth.password_format'); ?> @@ -603,68 +570,12 @@ function printStep2() { </div> </div> - <div class="form-group"> - <label class="group-name" for="mail_login"><?php echo _t('install.auth.email_persona'); ?></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" <?php echo $auth_type === 'persona' ? ' required="required"' : ''; ?> /> - <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> - </div> - </div> - - <script> - function show_password() { - var button = this; - var passwordField = document.getElementById(button.getAttribute('data-toggle')); - passwordField.setAttribute('type', 'text'); - button.className += ' active'; - - return false; - } - function hide_password() { - var button = this; - var passwordField = document.getElementById(button.getAttribute('data-toggle')); - passwordField.setAttribute('type', 'password'); - button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , ''); - - return false; - } - toggles = document.getElementsByClassName('toggle-password'); - for (var i = 0 ; i < toggles.length ; i++) { - toggles[i].addEventListener('mousedown', show_password); - toggles[i].addEventListener('mouseup', hide_password); - } - - function auth_type_change(focus) { - var auth_value = document.getElementById('auth_type').value, - password_input = document.getElementById('passwordPlain'), - mail_input = document.getElementById('mail_login'); - - if (auth_value === 'form') { - password_input.required = true; - mail_input.required = false; - if (focus) { - password_input.focus(); - } - } else if (auth_value === 'persona') { - password_input.required = false; - mail_input.required = true; - if (focus) { - mail_input.focus(); - } - } else { - password_input.required = false; - mail_input.required = false; - } - } - auth_type_change(false); - </script> - <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> - <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + <button type="submit" class="btn btn-important" tabindex="7" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="8" ><?php echo _t('gen.action.cancel'); ?></button> <?php if ($s2['all'] == 'ok') { ?> - <a class="btn btn-important next-step" href="?step=3"><?php echo _t('install.action.next_step'); ?></a> + <a class="btn btn-important next-step" href="?step=3" tabindex="9" ><?php echo _t('install.action.next_step'); ?></a> <?php } ?> </div> </div> @@ -673,6 +584,7 @@ function printStep2() { } function printStep3() { + $system_default_config = Minz_Configuration::get('default_system'); ?> <?php $s3 = checkStep3(); if ($s3['all'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.bdd.conf.ok'); ?></p> @@ -680,12 +592,12 @@ function printStep3() { <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.bdd.conf.ko'),(empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error']); ?></p> <?php } ?> - <form action="index.php?step=3" method="post"> + <form action="index.php?step=3" method="post" autocomplete="off"> <legend><?php echo _t('install.bdd.conf'); ?></legend> <div class="form-group"> <label class="group-name" for="type"><?php echo _t('install.bdd.type'); ?></label> <div class="group-controls"> - <select name="type" id="type" onchange="mySqlShowHide()"> + <select name="type" id="type" tabindex="1"> <?php if (extension_loaded('pdo_mysql')) {?> <option value="mysql" <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>> @@ -698,6 +610,12 @@ function printStep3() { SQLite </option> <?php }?> + <?php if (extension_loaded('pdo_pgsql')) {?> + <option value="pgsql" + <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'pgsql') ? 'selected="selected"' : ''; ?>> + PostgreSQL + </option> + <?php }?> </select> </div> </div> @@ -706,51 +624,45 @@ function printStep3() { <div class="form-group"> <label class="group-name" for="host"><?php echo _t('install.bdd.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'; ?>" /> + <input type="text" id="host" name="host" pattern="[0-9A-Z/a-z_.-]{1,64}(:[0-9]{2,5})?" value="<?php echo isset($_SESSION['bd_host']) ? $_SESSION['bd_host'] : $system_default_config->db['host']; ?>" tabindex="2" /> </div> </div> <div class="form-group"> <label class="group-name" for="user"><?php echo _t('install.bdd.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'] : ''; ?>" /> + <input type="text" id="user" name="user" maxlength="64" pattern="[0-9A-Za-z_.-]{1,64}" value="<?php echo isset($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" tabindex="3" /> </div> </div> <div class="form-group"> <label class="group-name" for="pass"><?php echo _t('install.bdd.password'); ?></label> <div class="group-controls"> - <input type="password" id="pass" name="pass" value="<?php echo isset($_SESSION['bd_password']) ? $_SESSION['bd_password'] : ''; ?>" /> + <input type="password" id="pass" name="pass" value="<?php echo isset($_SESSION['bd_password']) ? $_SESSION['bd_password'] : ''; ?>" tabindex="4" autocomplete="off" /> </div> </div> <div class="form-group"> <label class="group-name" for="base"><?php echo _t('install.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'] : ''; ?>" /> + <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'] : ''; ?>" tabindex="5" /> </div> </div> <div class="form-group"> <label class="group-name" for="prefix"><?php echo _t('install.bdd.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_'; ?>" /> + <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'] : $system_default_config->db['prefix']; ?>" tabindex="6" /> </div> </div> </div> - <script> - function mySqlShowHide() { - document.getElementById('mysql').style.display = document.getElementById('type').value === 'mysql' ? 'block' : 'none'; - } - mySqlShowHide(); - </script> <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> - <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + <button type="submit" class="btn btn-important" tabindex="7" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="8" ><?php echo _t('gen.action.cancel'); ?></button> <?php if ($s3['all'] == 'ok') { ?> - <a class="btn btn-important next-step" href="?step=4"><?php echo _t('install.action.next_step'); ?></a> + <a class="btn btn-important next-step" href="?step=4" tabindex="9" ><?php echo _t('install.action.next_step'); ?></a> <?php } ?> </div> </div> @@ -761,7 +673,7 @@ function printStep3() { function printStep4() { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('install.congratulations'); ?></span> <?php echo _t('install.ok'); ?></p> - <a class="btn btn-important next-step" href="?step=5"><?php echo _t('install.action.finish'); ?></a> + <a class="btn btn-important next-step" href="?step=5" tabindex="1"><?php echo _t('install.action.finish'); ?></a> <?php } @@ -781,6 +693,7 @@ default: saveLanguage(); break; case 1: + saveStep1(); break; case 2: saveStep2(); @@ -791,18 +704,21 @@ case 3: case 4: break; case 5: - deleteInstall(); + if (deleteInstall()) { + header('Location: index.php'); + } break; } ?> <!DOCTYPE html> -<html lang="fr"> +<html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="initial-scale=1.0"> + <meta charset="UTF-8" /> + <meta name="viewport" content="initial-scale=1.0" /> <title><?php echo _t('install.title'); ?></title> - <link rel="stylesheet" type="text/css" media="all" href="../themes/base-theme/template.css" /> - <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/origine.css" /> + <link rel="stylesheet" href="../themes/base-theme/template.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/base-theme/template.css'); ?>" /> + <link rel="stylesheet" href="../themes/Origine/origine.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/Origine/origine.css'); ?>" /> + <meta name="robots" content="noindex,nofollow" /> </head> <body> @@ -820,7 +736,7 @@ case 5: <li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t('install.check'); ?></a></li> <li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t('install.conf'); ?></a></li> <li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t('install.bdd.conf'); ?></a></li> - <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=5"><?php echo _t('install.this_is_the_end'); ?></a></li> + <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t('install.this_is_the_end'); ?></a></li> </ul> <div class="post"> @@ -849,5 +765,6 @@ case 5: ?> </div> </div> + <script src="../scripts/install.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/install.js'); ?>"></script> </body> </html> diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 7567a8206..94f5b1f6c 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -27,6 +27,9 @@ </li> <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> <li class="nav-header"><?php echo _t('gen.menu.admin'); ?></li> + <li class="item<?php echo Minz_Request::actionName() === 'system' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'system')?>"><?php echo _t('gen.menu.system'); ?></a> + </li> <li class="item<?php echo Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'manage' ? ' active' : ''; ?>"> <a href="<?php echo _url('user', 'manage'); ?>"><?php echo _t('gen.menu.user_management'); ?></a> @@ -38,9 +41,11 @@ Minz_Request::actionName() === 'checkInstall' ? ' active' : ''; ?>"> <a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a> </li> + <?php if (!Minz_Configuration::get('system')->disable_update) { ?> <li class="item<?php echo Minz_Request::controllerName() === 'update' && Minz_Request::actionName() === 'index' ? ' active' : ''; ?>"> <a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a> </li> <?php } ?> + <?php } ?> </ul> diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index a6d22f878..3e1ee44dd 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -19,8 +19,8 @@ <a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('index.menu.about'); ?></a> <?php } ?> - <form id="mark-read-aside" method="post" style="display: none"></form> - + <form id="mark-read-aside" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <ul class="tree"> <li class="tree-folder category all<?php echo FreshRSS_Context::isCurrentGet('a') ? ' active' : ''; ?>"> <div class="tree-folder-title"> @@ -45,7 +45,7 @@ <li class="tree-folder category<?php echo $c_active ? ' active' : ''; ?>" data-unread="<?php echo $cat->nbNotRead(); ?>"> <div class="tree-folder-title"> <a class="dropdown-toggle" href="#"><?php echo _i($c_show ? 'up' : 'down'); ?></a> - <a class="title" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo $cat->name(); ?></a> + <a class="title<?php echo $cat->hasFeedsWithError() ? ' error' : ''; ?>" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo $cat->name(); ?></a> </div> <ul class="tree-folder-items<?php echo $c_show ? ' active' : ''; ?>"> @@ -69,6 +69,7 @@ } ?> </ul> + </form> </div> <script id="feed_config_template" type="text/html"> @@ -78,13 +79,13 @@ <?php if (FreshRSS_Auth::hasAccess()) { ?> <li class="item"><a href="<?php echo _url('stats', 'repartition', 'id', '------'); ?>"><?php echo _t('index.menu.stats'); ?></a></li> <?php } ?> - <li class="item"><a target="_blank" href="http://example.net/"><?php echo _t('gen.action.see_website'); ?></a></li> + <li class="item"><a target="_blank" rel="noreferrer" href="http://example.net/"><?php echo _t('gen.action.see_website'); ?></a></li> <?php if (FreshRSS_Auth::hasAccess()) { ?> <li class="separator"></li> <li class="item"><a href="<?php echo _url('subscription', 'index', 'id', '------'); ?>"><?php echo _t('gen.action.manage'); ?></a></li> <li class="item"><a href="<?php echo _url('feed', 'actualize', 'id', '------'); ?>"><?php echo _t('gen.action.actualize'); ?></a></li> <li class="item"> - <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm' : ''; ?> + <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?> <button class="read_all as-link <?php echo $confirm; ?>" form="mark-read-aside" formaction="<?php echo _url('entry', 'read', 'get', 'f_------'); ?>" diff --git a/app/layout/aside_subscription.phtml b/app/layout/aside_subscription.phtml index 8a54e2dc2..6d2a5ac8f 100644 --- a/app/layout/aside_subscription.phtml +++ b/app/layout/aside_subscription.phtml @@ -9,9 +9,7 @@ <a href="<?php echo _url('importExport', 'index'); ?>"><?php echo _t('sub.menu.import_export'); ?></a> </li> - <li class="item"> - <a onclick="return false;" href="javascript:(function(){var%20url%20=%20location.href;window.open('<?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true); ?>&url_rss='+encodeURIComponent(url), '_blank');})();"> - <?php echo _t('sub.menu.bookmark'); ?> - </a> + <li class="item<?php echo Minz_Request::controllerName() == 'bookmarklet' ? ' active' : ''; ?>"> + <a href="<?php echo _url('subscription', 'bookmarklet'); ?>"><?php echo _t('sub.menu.subscription_tools'); ?></a> </li> </ul> diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 41a63a565..e589ed7ef 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -67,11 +67,14 @@ if (FreshRSS_Auth::accessNeedsAction()) { <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> <li class="separator"></li> <li class="dropdown-header"><?php echo _t('gen.menu.admin'); ?></li> + <li class="item"><a href="<?php echo _url('configure', 'system'); ?>"><?php echo _t('gen.menu.system'); ?></a></li> <li class="item"><a href="<?php echo _url('user', 'manage'); ?>"><?php echo _t('gen.menu.user_management'); ?></a></li> <li class="item"><a href="<?php echo _url('auth', 'index'); ?>"><?php echo _t('gen.menu.authentication'); ?></a></li> <li class="item"><a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a></li> + <?php if (!Minz_Configuration::get('system')->disable_update) { ?> <li class="item"><a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a></li> <?php } ?> + <?php } ?> <li class="separator"></li> <li class="item"><a href="<?php echo _url('stats', 'index'); ?>"><?php echo _t('gen.menu.stats'); ?></a></li> <li class="item"><a href="<?php echo _url('index', 'logs'); ?>"><?php echo _t('gen.menu.logs'); ?></a></li> diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 083ffd4b3..1f11e0af1 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -1,14 +1,35 @@ +<?php FreshRSS::preLayout(); ?> <!DOCTYPE html> <html lang="<?php echo FreshRSS_Context::$user_conf->language; ?>" xml:lang="<?php echo FreshRSS_Context::$user_conf->language; ?>"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="initial-scale=1.0" /> - <?php echo self::headTitle(); ?> <?php echo self::headStyle(); ?> - <?php echo self::headScript(); ?> - <script>//<![CDATA[ + <script id="jsonVars" type="application/json"> <?php $this->renderHelper('javascript_vars'); ?> - //]]></script> + </script> + <?php echo self::headScript(); ?> + <link rel="shortcut icon" id="favicon" 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'); ?>" /> + <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); ?>" /> + <link rel="apple-touch-icon" href="<?php echo Minz_Url::display('/themes/icons/apple-touch-icon.png'); ?>" /> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-status-bar-style" content="black" /> + <meta name="apple-mobile-web-app-title" content="<?php echo FreshRSS_Context::$system_conf->title; ?>"> + <meta name="msapplication-TileColor" content="#FFF" /> +<?php if (!FreshRSS_Context::$system_conf->allow_referrer) { ?> + <meta name="referrer" content="never" /> +<?php + } + flush(); + if (isset($this->callbackBeforeContent)) { + call_user_func($this->callbackBeforeContent, $this); + } +?> + <?php echo self::headTitle(); ?> <?php $url_base = Minz_Request::currentRequest(); if (FreshRSS_Context::$next_id !== '') { @@ -17,28 +38,22 @@ $url_next['params']['ajax'] = 1; ?> <link id="prefetch" rel="next prefetch" href="<?php echo Minz_Url::display($url_next); ?>" /> -<?php } ?> - <link rel="shortcut icon" id="favicon" 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_title)) { + } if (isset($this->rss_title)) { $url_rss = $url_base; $url_rss['a'] = 'rss'; + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_rss['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } ?> <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display($url_rss); ?>" /> -<?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); ?>"> - <link rel="apple-touch-icon" href="<?php echo Minz_Url::display('/themes/icons/apple-touch-icon.png'); ?>"> - <meta name="apple-mobile-web-app-capable" content="yes" /> - <meta name="apple-mobile-web-app-status-bar-style" content="black" /> - <meta name="apple-mobile-web-app-title" content="<?php echo FreshRSS_Context::$system_conf->title; ?>"> - <meta name="msapplication-TileColor" content="#FFF" /> +<?php } if (FreshRSS_Context::$system_conf->allow_robots) { ?> + <meta name="description" content="<?php echo htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_COMPAT, 'UTF-8'); ?>" /> +<?php } else { ?> <meta name="robots" content="noindex,nofollow" /> +<?php } ?> </head> - <body class="<?php echo Minz_Request::param('output', 'normal'); ?>"> + <body class="<?php echo Minz_Request::actionName(); ?>"> <?php $this->partial('header'); ?> <div id="global"> diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 3a755b560..2bc693e5d 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -22,7 +22,7 @@ ?> <a id="toggle-<?php echo $state_str; ?>" class="btn <?php echo $state_enabled ? 'active' : ''; ?>" - aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>" + role="checkbox" aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>" title="<?php echo _t('index.menu.' . $state_str); ?>" href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a> <?php } ?> @@ -75,20 +75,22 @@ 'get' => $get, 'nextGet' => FreshRSS_Context::$next_get, 'idMax' => FreshRSS_Context::$id_max, + 'search' => FreshRSS_Context::$search, + 'state' => FreshRSS_Context::$state, ) ); ?> - <form id="mark-read-menu" method="post" style="display: none"></form> - <div class="stick" id="nav_menu_read_all"> - <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm' : ''; ?> + <form id="mark-read-menu" method="post"> + <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?> <button class="read_all btn <?php echo $confirm; ?>" form="mark-read-menu" formaction="<?php echo Minz_Url::display($mark_read_url); ?>" type="submit"><?php echo _t('gen.action.mark_read'); ?></button> <div class="dropdown"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <div id="dropdown-read" class="dropdown-target"></div> <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a> @@ -123,6 +125,7 @@ </li> </ul> </div> + </form> </div> <?php } ?> @@ -146,10 +149,14 @@ <?php $url_output['a'] = 'rss'; if (FreshRSS_Context::$user_conf->token) { + $url_output['params']['user'] = Minz_Session::param('currentUser'); $url_output['params']['token'] = FreshRSS_Context::$user_conf->token; } + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } ?> - <a class="view_rss btn" target="_blank" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> + <a class="view_rss btn" target="_blank" rel="noreferrer" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> <?php echo _i('rss'); ?> </a> </div> @@ -179,16 +186,16 @@ if (FreshRSS_Context::$order === 'DESC') { $order = 'ASC'; $icon = 'up'; - $title = 'index.menu.older_first'; + $title = _t('index.menu.older_first'); } else { $order = 'DESC'; $icon = 'down'; - $title = 'index.menu.newer_first'; + $title = _t('index.menu.newer_first'); } $url_order = Minz_Request::currentRequest(); $url_order['params']['order'] = $order; ?> - <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>"> + <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo $title; ?>"> <?php echo _i($icon); ?> </a> diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml index 979e17349..99be6059c 100644 --- a/app/views/auth/formLogin.phtml +++ b/app/views/auth/formLogin.phtml @@ -1,10 +1,15 @@ <div class="prompt"> <h1><?php echo _t('gen.auth.login'); ?></h1> + <?php if (!max_registrations_reached()) { ?> + <a href="<?php echo _url('auth', 'register'); ?>"><?php echo _t('gen.auth.registration.ask'); ?></a> + <?php } ?> + <form id="crypto-form" method="post" action="<?php echo _url('auth', 'login'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <div> <label for="username"><?php echo _t('gen.auth.username'); ?></label> - <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" /> + <input type="text" id="username" name="username" size="16" required="required" pattern="<?php echo FreshRSS_user_Controller::USERNAME_PATTERN; ?>" autofocus="autofocus" /> </div> <div> <label for="passwordPlain"><?php echo _t('gen.auth.password'); ?></label> @@ -15,7 +20,7 @@ <div> <label class="checkbox" for="keep_logged_in"> <input type="checkbox" name="keep_logged_in" id="keep_logged_in" value="1" /> - <?php echo _t('gen.auth.keep_logged_in'); ?> + <?php echo _t('gen.auth.keep_logged_in', $this->cookie_days); ?> </label> <br /> </div> diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index f7a862ac9..20966f24e 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -4,17 +4,17 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('auth', 'index'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('admin.auth.type'); ?></legend> <div class="form-group"> <label class="group-name" for="auth_type"><?php echo _t('admin.auth.type'); ?></label> <div class="group-controls"> - <select id="auth_type" name="auth_type" required="required"> - <?php if (!in_array(FreshRSS_Context::$system_conf->auth_type, array('form', 'persona', 'http_auth', 'none'))) { ?> + <select id="auth_type" name="auth_type" required="required" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->auth_type; ?>"> + <?php if (!in_array(FreshRSS_Context::$system_conf->auth_type, array('form', 'http_auth', 'none'))) { ?> <option selected="selected"></option> <?php } ?> <option value="form"<?php echo FreshRSS_Context::$system_conf->auth_type === 'form' ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('admin.auth.form'); ?></option> - <option value="persona"<?php echo FreshRSS_Context::$system_conf->auth_type === 'persona' ? ' selected="selected"' : '', FreshRSS_Context::$user_conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('admin.auth.persona'); ?></option> <option value="http_auth"<?php echo FreshRSS_Context::$system_conf->auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('admin.auth.http'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option> <option value="none"<?php echo FreshRSS_Context::$system_conf->auth_type === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('admin.auth.none'); ?></option> </select> @@ -25,7 +25,7 @@ <div class="group-controls"> <label class="checkbox" for="anon_access"> <input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo FreshRSS_Context::$system_conf->allow_anonymous ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> /> + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->allow_anonymous; ?>"/> <?php echo _t('admin.auth.allow_anonymous', FreshRSS_Context::$system_conf->default_user); ?> </label> </div> @@ -35,7 +35,7 @@ <div class="group-controls"> <label class="checkbox" for="anon_refresh"> <input type="checkbox" name="anon_refresh" id="anon_refresh" value="1"<?php echo FreshRSS_Context::$system_conf->allow_anonymous_refresh ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> /> + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->allow_anonymous_refresh; ?>"/> <?php echo _t('admin.auth.allow_anonymous_refresh'); ?> </label> </div> @@ -45,31 +45,18 @@ <div class="group-controls"> <label class="checkbox" for="unsafe_autologin"> <input type="checkbox" name="unsafe_autologin" id="unsafe_autologin" value="1"<?php echo FreshRSS_Context::$system_conf->unsafe_autologin_enabled ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> /> + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->unsafe_autologin_enabled; ?>"/> <?php echo _t('admin.auth.unsafe_autologin'); ?> <kbd><?php echo Minz_Url::display(array('c' => 'auth', 'a' => 'login', 'params' => array('u' => 'alice', 'p' => '1234')), 'html', true); ?></kbd> </label> </div> </div> - <?php if (FreshRSS_Auth::accessNeedsAction()) { ?> - <div class="form-group"> - <label class="group-name" for="token"><?php echo _t('admin.auth.token'); ?></label> - <?php $token = FreshRSS_Context::$user_conf->token; ?> - <div class="group-controls"> - <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo _t('gen.short.blank_to_disable'); ?>"<?php - echo FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> /> - <?php echo _i('help'); ?> <?php echo _t('admin.auth.token_help'); ?> - <kbd><?php echo Minz_Url::display(array('params' => array('output' => 'rss', 'token' => $token)), 'html', true); ?></kbd> - </div> - </div> - <?php } ?> - <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="api_enabled"> <input type="checkbox" name="api_enabled" id="api_enabled" value="1"<?php echo FreshRSS_Context::$system_conf->api_enabled ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsLogin() ? '' : ' disabled="disabled"'; ?> /> + FreshRSS_Auth::accessNeedsLogin() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->api_enabled; ?>"/> <?php echo _t('admin.auth.api_enabled'); ?> </label> </div> diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml deleted file mode 100644 index 545ed2eac..000000000 --- a/app/views/auth/personaLogin.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<?php if ($this->res === false) { ?> -<div class="prompt"> - <h1><?php echo _t('gen.auth.login'); ?></h1> - - <p> - <a class="signin btn btn-important" href="<?php echo _url('auth', 'login'); ?>"> - <?php echo _i('login'); ?> <?php echo _t('gen.auth.login_persona'); ?> - </a> - - <br /><br /> - - <?php echo _i('help'); ?> - <small> - <a href="<?php echo _url('auth', 'reset'); ?>"><?php echo _t('gen.auth.login_persona_problem'); ?></a> - </small> - </p> - - <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('gen.freshrss.about'); ?></a></p> -</div> -<?php -} else { - echo json_encode($this->res); -} -?> diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml new file mode 100644 index 000000000..23bda25ce --- /dev/null +++ b/app/views/auth/register.phtml @@ -0,0 +1,34 @@ +<div class="prompt"> + <h1><?php echo _t('gen.auth.registration'); ?></h1> + + <form method="post" action="<?php echo _url('user', 'create'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <div> + <label class="group-name" for="new_user_name"><?php echo _t('gen.auth.username'), '<br />', _i('help'), ' ', _t('gen.auth.username.format'); ?></label> + <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" autocomplete="off" pattern="<?php echo FreshRSS_user_Controller::USERNAME_PATTERN; ?>" /> + </div> + + <div> + <label class="group-name" for="new_user_passwordPlain"><?php echo _t('gen.auth.password'), '<br />', _i('help'), ' ', _t('gen.auth.password.format'); ?></label> + <div class="stick"> + <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" required="required" autocomplete="off" pattern=".{7,}" /> + <a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a> + </div> + <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + </div> + + <div> + <?php + $redirect_url = urlencode(Minz_Url::display( + array('c' => 'index', 'a' => 'index'), + 'php', true + )); + ?> + <input type="hidden" name="r" value="<?php echo $redirect_url; ?>" /> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.create'); ?></button> + <a class="btn" href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.cancel'); ?></a> + </div> + </form> + + <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('gen.freshrss.about'); ?></a></p> +</div> diff --git a/app/views/auth/reset.phtml b/app/views/auth/reset.phtml deleted file mode 100644 index 6e9816ad3..000000000 --- a/app/views/auth/reset.phtml +++ /dev/null @@ -1,33 +0,0 @@ -<div class="prompt"> - <h1><?php echo _t('gen.auth.reset'); ?></h1> - - <?php if (!empty($this->message)) { ?> - <p class="alert <?php echo $this->message['status'] === 'bad' ? 'alert-error' : 'alert-warn'; ?>"> - <span class="alert-head"><?php echo $this->message['title']; ?></span><br /> - <?php echo $this->message['body']; ?> - </p> - <?php } ?> - - <?php if (!$this->no_form) { ?> - <form id="crypto-form" method="post" action="<?php echo _url('auth', 'reset'); ?>"> - <p class="alert alert-warn"> - <span class="alert-head"><?php echo _t('gen.short.attention'); ?></span><br /> - <?php echo _t('gen.auth.will_reset'); ?> - </p> - - <div> - <label for="username"><?php echo _t('gen.auth.username_admin'); ?></label> - <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" /> - </div> - <div> - <label for="passwordPlain"><?php echo _t('gen.auth.password'); ?></label> - <input type="password" id="passwordPlain" required="required" /> - <input type="hidden" id="challenge" name="challenge" /><br /> - <noscript><strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> - </div> - <div> - <button id="loginButton" type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> - </div> - </form> - <?php } ?> -</div> diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 875463137..2254f5dba 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -4,20 +4,21 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'archiving'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.archiving'); ?></legend> <p><?php echo _i('help'); ?> <?php echo _t('conf.archiving.help'); ?></p> <div class="form-group"> <label class="group-name" for="old_entries"><?php echo _t('conf.archiving.delete_after'); ?></label> <div class="group-controls"> - <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>" /> <?php echo _t('gen.date.month'); ?> + <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>"/> <?php echo _t('gen.date.month'); ?> <a class="btn confirm" href="<?php echo _url('entry', 'purge'); ?>"><?php echo _t('conf.archiving.purge_now'); ?></a> </div> </div> <div class="form-group"> <label class="group-name" for="keep_history_default"><?php echo _t('conf.archiving.keep_history_by_feed'); ?></label> <div class="group-controls"> - <select class="number" name="keep_history_default" id="keep_history_default" required="required"><?php + <select class="number" name="keep_history_default" id="keep_history_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->keep_history_default; ?>"><?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 . (FreshRSS_Context::$user_conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>'; } @@ -27,7 +28,7 @@ <div class="form-group"> <label class="group-name" for="ttl_default"><?php echo _t('conf.archiving.ttl'); ?></label> <div class="group-controls"> - <select class="number" name="ttl_default" id="ttl_default" required="required"><?php + <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->ttl_default; ?>"><?php $found = false; foreach (array(1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', @@ -55,6 +56,7 @@ </form> <form method="post" action="<?php echo _url('entry', 'optimize'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.archiving.advanced'); ?></legend> <div class="form-group"> diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 02249bc55..62ecc1080 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -4,12 +4,13 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'display'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.display'); ?></legend> <div class="form-group"> <label class="group-name" for="language"><?php echo _t('conf.display.language'); ?></label> <div class="group-controls"> - <select name="language" id="language"> + <select name="language" id="language" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->language; ?>"> <?php $languages = Minz_Translate::availableLanguages(); ?> <?php foreach ($languages as $lang) { ?> <option value="<?php echo $lang; ?>"<?php echo FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : ''; ?>><?php echo _t('gen.lang.' . $lang); ?></option> @@ -24,7 +25,7 @@ <ul class="slides"> <?php $slides = count($this->themes); $i = 1; ?> <?php foreach($this->themes as $theme) { ?> - <input type="radio" name="theme" id="img-<?php echo $i ?>" <?php if (FreshRSS_Context::$user_conf->theme === $theme['id']) {echo "checked";}?> value="<?php echo $theme['id'] ?>"/> + <input type="radio" name="theme" id="img-<?php echo $i ?>" <?php if (FreshRSS_Context::$user_conf->theme === $theme['id']) {echo "checked";}?> value="<?php echo $theme['id'] ?>" data-leave-validation="<?php echo (FreshRSS_Context::$user_conf->theme === $theme['id']) ? 1 : 0; ?>"/> <li class="slide-container"> <div class="slide"> <img src="<?php echo Minz_Url::display('/themes/' . $theme['id'] . '/thumbs/original.png')?>"/> @@ -53,7 +54,7 @@ <div class="form-group"> <label class="group-name" for="content_width"><?php echo _t('conf.display.width.content'); ?></label> <div class="group-controls"> - <select name="content_width" id="content_width" required=""> + <select name="content_width" id="content_width" required="" data-leave-validation="<?php echo $width; ?>"> <option value="thin" <?php echo $width === 'thin'? 'selected="selected"' : ''; ?>> <?php echo _t('conf.display.width.thin'); ?> </option> @@ -87,29 +88,29 @@ <tbody> <tr> <th><?php echo _t('conf.display.icon.top_line'); ?></th> - <td><input type="checkbox" name="topline_read" value="1"<?php echo FreshRSS_Context::$user_conf->topline_read ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="topline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->topline_favorite ? ' checked="checked"' : ''; ?> /></td> + <td><input type="checkbox" name="topline_read" value="1"<?php echo FreshRSS_Context::$user_conf->topline_read ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_read; ?>"/></td> + <td><input type="checkbox" name="topline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->topline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_favorite; ?>"/></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" disabled="disabled" /></td> - <td><input type="checkbox" name="topline_date" value="1"<?php echo FreshRSS_Context::$user_conf->topline_date ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="topline_link" value="1"<?php echo FreshRSS_Context::$user_conf->topline_link ? ' checked="checked"' : ''; ?> /></td> + <td><input type="checkbox" name="topline_date" value="1"<?php echo FreshRSS_Context::$user_conf->topline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_date; ?>"/></td> + <td><input type="checkbox" name="topline_link" value="1"<?php echo FreshRSS_Context::$user_conf->topline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_link; ?>"/></td> </tr><tr> <th><?php echo _t('conf.display.icon.bottom_line'); ?></th> - <td><input type="checkbox" name="bottomline_read" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_read ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_favorite ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_sharing ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_tags" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_tags ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_date" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_date ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_link" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_link ? ' checked="checked"' : ''; ?> /></td> + <td><input type="checkbox" name="bottomline_read" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_read ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_read; ?>"/></td> + <td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_favorite; ?>"/></td> + <td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_sharing ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_sharing; ?>"/></td> + <td><input type="checkbox" name="bottomline_tags" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_tags ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_tags; ?>"/></td> + <td><input type="checkbox" name="bottomline_date" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_date; ?>"/></td> + <td><input type="checkbox" name="bottomline_link" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_link; ?>"/></td> </tr> </tbody> </table><br /> </div> <div class="form-group"> - <label class="group-name" for="posts_per_page"><?php echo _t('conf.display.notif_html5.timeout'); ?></label> + <label class="group-name" for="html5_notif_timeout"><?php echo _t('conf.display.notif_html5.timeout'); ?></label> <div class="group-controls"> - <input type="number" id="html5_notif_timeout" name="html5_notif_timeout" value="<?php echo FreshRSS_Context::$user_conf->html5_notif_timeout; ?>" /> <?php echo _t('conf.display.notif_html5.seconds'); ?> + <input type="number" id="html5_notif_timeout" name="html5_notif_timeout" value="<?php echo FreshRSS_Context::$user_conf->html5_notif_timeout; ?>" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->html5_notif_timeout; ?>"/> <?php echo _t('conf.display.notif_html5.seconds'); ?> </div> </div> diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index 5f449deb3..0dffa268d 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -4,29 +4,32 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'queries'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.query'); ?></legend> - <?php foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { ?> + <?php foreach ($this->queries as $key => $query) { ?> <div class="form-group" id="query-group-<?php echo $key; ?>"> <label class="group-name" for="queries_<?php echo $key; ?>_name"> <?php echo _t('conf.query.number', $key + 1); ?> </label> <div class="group-controls"> - <input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo isset($query['search']) ? $query['search'] : ""; ?>"/> - <input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo isset($query['state']) ? $query['state'] : ""; ?>"/> - <input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo isset($query['order']) ? $query['order'] : ""; ?>"/> - <input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo isset($query['get']) ? $query['get'] : ""; ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][url]" value="<?php echo $query->getUrl(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo $query->getSearch(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo $query->getState(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo $query->getOrder(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo $query->getGet(); ?>"/> <div class="stick"> <input class="extend" type="text" id="queries_<?php echo $key; ?>_name" name="queries[<?php echo $key; ?>][name]" - value="<?php echo $query['name']; ?>" + value="<?php echo $query->getName(); ?>" + data-leave-validation="<?php echo $query->getName(); ?>" /> - <a class="btn" href="<?php echo $query['url']; ?>"> + <a class="btn" href="<?php echo $query->getUrl(); ?>"> <?php echo _i('link'); ?> </a> @@ -35,23 +38,11 @@ </a> </div> - <?php - $exist = (isset($query['search']) ? 1 : 0) - + (isset($query['state']) ? 1 : 0) - + (isset($query['order']) ? 1 : 0) - + (isset($query['get']) ? 1 : 0); - // If the only filter is "all" articles, we consider there is no filter - $exist = ($exist === 1 && isset($query['get']) && $query['get'] === 'a') ? 0 : $exist; - - $deprecated = (isset($this->query_get[$key]) && - $this->query_get[$key]['deprecated']); - ?> - - <?php if ($exist === 0) { ?> + <?php if (!$query->hasParameters()) { ?> <div class="alert alert-warn"> <div class="alert-head"><?php echo _t('conf.query.no_filter'); ?></div> </div> - <?php } elseif ($deprecated) { ?> + <?php } elseif ($query->isDeprecated()) { ?> <div class="alert alert-error"> <div class="alert-head"><?php echo _t('conf.query.deprecated'); ?></div> </div> @@ -60,20 +51,20 @@ <div class="alert-head"><?php echo _t('conf.query.filter'); ?></div> <ul> - <?php if (isset($query['search'])) { ?> - <li class="item"><?php echo _t('conf.query.search', $query['search']); ?></li> + <?php if ($query->hasSearch()) { ?> + <li class="item"><?php echo _t('conf.query.search', $query->getSearch()->getRawInput()); ?></li> <?php } ?> - <?php if (isset($query['state'])) { ?> - <li class="item"><?php echo _t('conf.query.state_' . $query['state']); ?></li> + <?php if ($query->getState()) { ?> + <li class="item"><?php echo _t('conf.query.state_' . $query->getState()); ?></li> <?php } ?> - <?php if (isset($query['order'])) { ?> - <li class="item"><?php echo _t('conf.query.order_' . strtolower($query['order'])); ?></li> + <?php if ($query->getOrder()) { ?> + <li class="item"><?php echo _t('conf.query.order_' . strtolower($query->getOrder())); ?></li> <?php } ?> - <?php if (isset($query['get'])) { ?> - <li class="item"><?php echo _t('conf.query.get_' . $this->query_get[$key]['type'], $this->query_get[$key]['name']); ?></li> + <?php if ($query->getGet()) { ?> + <li class="item"><?php echo _t('conf.query.get_' . $query->getGetType(), $query->getGetName()); ?></li> <?php } ?> </ul> </div> diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 636671f14..ebb00c97b 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -4,12 +4,13 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'reading'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.reading'); ?></legend> <div class="form-group"> <label class="group-name" for="posts_per_page"><?php echo _t('conf.reading.articles_per_page'); ?></label> <div class="group-controls"> - <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo FreshRSS_Context::$user_conf->posts_per_page; ?>" min="5" max="50" /> + <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo FreshRSS_Context::$user_conf->posts_per_page; ?>" min="5" max="500" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->posts_per_page; ?>"/> <?php echo _i('help'); ?> <?php echo _t('conf.reading.number_divided_when_reader'); ?> </div> </div> @@ -17,7 +18,7 @@ <div class="form-group"> <label class="group-name" for="sort_order"><?php echo _t('conf.reading.sort'); ?></label> <div class="group-controls"> - <select name="sort_order" id="sort_order"> + <select name="sort_order" id="sort_order" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->sort_order; ?>"> <option value="DESC"<?php echo FreshRSS_Context::$user_conf->sort_order === 'DESC' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.sort.newer_first'); ?></option> <option value="ASC"<?php echo FreshRSS_Context::$user_conf->sort_order === 'ASC' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.sort.older_first'); ?></option> </select> @@ -27,7 +28,7 @@ <div class="form-group"> <label class="group-name" for="view_mode"><?php echo _t('conf.reading.view.default'); ?></label> <div class="group-controls"> - <select name="view_mode" id="view_mode"> + <select name="view_mode" id="view_mode" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->view_mode; ?>"> <option value="normal"<?php echo FreshRSS_Context::$user_conf->view_mode === 'normal' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.normal'); ?></option> <option value="reader"<?php echo FreshRSS_Context::$user_conf->view_mode === 'reader' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.reader'); ?></option> <option value="global"<?php echo FreshRSS_Context::$user_conf->view_mode === 'global' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.global'); ?></option> @@ -38,7 +39,7 @@ <div class="form-group"> <label class="group-name" for="view_mode"><?php echo _t('conf.reading.show'); ?></label> <div class="group-controls"> - <select name="default_view" id="default_view"> + <select name="default_view" id="default_view" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->default_view; ?>"> <option value="adaptive"<?php echo FreshRSS_Context::$user_conf->default_view === 'adaptive' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.adaptive'); ?></option> <option value="all"<?php echo FreshRSS_Context::$user_conf->default_view === 'all' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.all_articles'); ?></option> <option value="unread"<?php echo FreshRSS_Context::$user_conf->default_view === 'unread' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.unread'); ?></option> @@ -49,7 +50,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="hide_read_feeds"> - <input type="checkbox" name="hide_read_feeds" id="hide_read_feeds" value="1"<?php echo FreshRSS_Context::$user_conf->hide_read_feeds ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="hide_read_feeds" id="hide_read_feeds" value="1"<?php echo FreshRSS_Context::$user_conf->hide_read_feeds ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->hide_read_feeds; ?>"/> <?php echo _t('conf.reading.hide_read_feeds'); ?> </label> </div> @@ -58,7 +59,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="display_posts"> - <input type="checkbox" name="display_posts" id="display_posts" value="1"<?php echo FreshRSS_Context::$user_conf->display_posts ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="display_posts" id="display_posts" value="1"<?php echo FreshRSS_Context::$user_conf->display_posts ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->display_posts; ?>"/> <?php echo _t('conf.reading.display_articles_unfolded'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -68,7 +69,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="display_categories"> - <input type="checkbox" name="display_categories" id="display_categories" value="1"<?php echo FreshRSS_Context::$user_conf->display_categories ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="display_categories" id="display_categories" value="1"<?php echo FreshRSS_Context::$user_conf->display_categories ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->display_categories; ?>"/> <?php echo _t('conf.reading.display_categories_unfolded'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -78,7 +79,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="sticky_post"> - <input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?php echo FreshRSS_Context::$user_conf->sticky_post ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?php echo FreshRSS_Context::$user_conf->sticky_post ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->sticky_post; ?>"/> <?php echo _t('conf.reading.sticky_post'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -88,7 +89,7 @@ <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="1"<?php echo FreshRSS_Context::$user_conf->auto_load_more ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo FreshRSS_Context::$user_conf->auto_load_more ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->auto_load_more; ?>"/> <?php echo _t('conf.reading.auto_load_more'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -98,7 +99,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="lazyload"> - <input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo FreshRSS_Context::$user_conf->lazyload ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo FreshRSS_Context::$user_conf->lazyload ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->lazyload; ?>"/> <?php echo _t('conf.reading.img_with_lazyload'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -107,8 +108,18 @@ <div class="form-group"> <div class="group-controls"> + <label class="checkbox" for="sides_close_article"> + <input type="checkbox" name="sides_close_article" id="sides_close_article" value="1"<?php echo FreshRSS_Context::$user_conf->sides_close_article ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->sides_close_article; ?>"/> + <?php echo _t('conf.reading.sides_close_article'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> <label class="checkbox" for="reading_confirm"> - <input type="checkbox" name="reading_confirm" id="reading_confirm" value="1"<?php echo FreshRSS_Context::$user_conf->reading_confirm ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="reading_confirm" id="reading_confirm" value="1"<?php echo FreshRSS_Context::$user_conf->reading_confirm ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->reading_confirm; ?>"/> <?php echo _t('conf.reading.confirm_enabled'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -118,7 +129,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="auto_remove_article"> - <input type="checkbox" name="auto_remove_article" id="auto_remove_article" value="1"<?php echo FreshRSS_Context::$user_conf->auto_remove_article ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="auto_remove_article" id="auto_remove_article" value="1"<?php echo FreshRSS_Context::$user_conf->auto_remove_article ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->auto_remove_article; ?>"/> <?php echo _t('conf.reading.auto_remove_article'); ?> <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> </label> @@ -126,22 +137,31 @@ </div> <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="mark_updated_article_unread"> + <input type="checkbox" name="mark_updated_article_unread" id="mark_updated_article_unread" value="1"<?php echo FreshRSS_Context::$user_conf->mark_updated_article_unread ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_updated_article_unread; ?>"/> + <?php echo _t('conf.reading.mark_updated_article_unread'); ?> + </label> + </div> + </div> + + <div class="form-group"> <label class="group-name"><?php echo _t('conf.reading.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="1"<?php echo FreshRSS_Context::$user_conf->mark_when['article'] ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="mark_open_article" id="check_open_article" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['article'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['article']; ?>"/> <?php echo _t('conf.reading.read.article_viewed'); ?> </label> <label class="checkbox" for="check_open_site"> - <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['site'] ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['site'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['site']; ?>"/> <?php echo _t('conf.reading.read.article_open_on_website'); ?> </label> <label class="checkbox" for="check_scroll"> - <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['scroll'] ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['scroll'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['scroll']; ?>"/> <?php echo _t('conf.reading.read.scroll'); ?> </label> <label class="checkbox" for="check_reception"> - <input type="checkbox" name="mark_upon_reception" id="check_reception" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['reception'] ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="mark_upon_reception" id="check_reception" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['reception'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['reception']; ?>"/> <?php echo _t('conf.reading.read.upon_reception'); ?> </label> </div> @@ -151,7 +171,7 @@ <label class="group-name"><?php echo _t('conf.reading.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="1"<?php echo FreshRSS_Context::$user_conf->onread_jump_next ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="1"<?php echo FreshRSS_Context::$user_conf->onread_jump_next ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->onread_jump_next; ?>"/> <?php echo _t('conf.reading.jump_next'); ?> </label> </div> diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index da7557480..b0e6618fa 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -4,16 +4,20 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'sharing'); ?>" - data-simple='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"><a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo _i('close'); ?></a> + data-simple='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"><div class="stick"><input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="##label##" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" /> + <input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo _t('gen.short.not_applicable'); ?>" size="64" disabled /><a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo _i('close'); ?></a></div> <input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /></div></div>' data-advanced='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"> <input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /> + <input type="hidden" id="share_##key##_method" name="share[##key##][method]" value="##method##" /> + <input type="hidden" id="share_##key##_field" name="share[##key##][field]" value="##field##" /> <div class="stick"> <input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" /> <input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo _t('conf.sharing.share_url'); ?>" size="64" /> <a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo _i('close'); ?></a></div> - <a target="_blank" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="##help##"><?php echo _i('help'); ?></a> + <a target="_blank" rel="noreferrer" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="##help##"><?php echo _i('help'); ?></a> </div></div>'> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.sharing'); ?></legend> <?php foreach (FreshRSS_Context::$user_conf->sharing as $key => $share_options) { @@ -26,16 +30,19 @@ </label> <div class="group-controls"> <input type='hidden' id='share_<?php echo $key; ?>_type' name="share[<?php echo $key; ?>][type]" value='<?php echo $share->type(); ?>' /> + <input type='hidden' id='share_<?php echo $key; ?>_method' name="share[<?php echo $key; ?>][method]" value='<?php echo $share->method(); ?>' /> + <input type='hidden' id='share_<?php echo $key; ?>_field' name="share[<?php echo $key; ?>][field]" value='<?php echo $share->field(); ?>' /> + <div class="stick"> + <input type="text" id="share_<?php echo $key; ?>_name" name="share[<?php echo $key; ?>][name]" class="extend" value="<?php echo $share->name(); ?>" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" data-leave-validation="<?php echo $share->name(); ?>"/> <?php if ($share->formType() === 'advanced') { ?> - <div class="stick"> - <input type="text" id="share_<?php echo $key; ?>_name" name="share[<?php echo $key; ?>][name]" class="extend" value="<?php echo $share->name(); ?>" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" /> - <input type="url" id="share_<?php echo $key; ?>_url" name="share[<?php echo $key; ?>][url]" class="extend" value="<?php echo $share->baseUrl(); ?>" placeholder="<?php echo _t('conf.sharing.share_url'); ?>" size="64" /> - <a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo _i('close'); ?></a> - </div> - - <a target="_blank" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="<?php echo $share->help(); ?>"><?php echo _i('help'); ?></a> + <input type="url" id="share_<?php echo $key; ?>_url" name="share[<?php echo $key; ?>][url]" class="extend" value="<?php echo $share->baseUrl(); ?>" placeholder="<?php echo _t('conf.sharing.share_url'); ?>" size="64" data-leave-validation="<?php echo $share->baseUrl(); ?>"/> <?php } else { ?> - <a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo _i('close'); ?></a> + <input type="url" id="share_<?php echo $key; ?>_url" name="share[<?php echo $key; ?>][url]" class="extend" value="<?php echo $share->baseUrl(); ?>" placeholder="<?php echo _t('gen.short.not_applicable'); ?>" size="64" disabled/> + <?php } ?> + <a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo _i('close'); ?></a> + </div> + <?php if ($share->formType() === 'advanced') { ?> + <a target="_blank" rel="noreferrer" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="<?php echo $share->help(); ?>"><?php echo _i('help'); ?></a> <?php } ?> </div> </div> @@ -45,7 +52,7 @@ <div class="group-controls"> <select> <?php foreach (FreshRSS_Share::enum() as $share) { ?> - <option value='<?php echo $share->type(); ?>' data-form='<?php echo $share->formType(); ?>' data-help='<?php echo $share->help(); ?>'> + <option value='<?php echo $share->type(); ?>' data-form='<?php echo $share->formType(); ?>' data-help='<?php echo $share->help(); ?>' data-method='<?php echo $share->method(); ?>' data-field='<?php echo $share->field(); ?>'> <?php echo $share->name(true); ?> </option> <?php } ?> diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index f68091af9..dceeb17de 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -12,6 +12,7 @@ <?php $s = FreshRSS_Context::$user_conf->shortcuts; ?> <form method="post" action="<?php echo _url('configure', 'shortcut'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.shortcut'); ?></legend> <noscript><p class="alert alert-error"><?php echo _t('conf.shortcut.javascript'); ?></p></noscript> @@ -23,28 +24,28 @@ <div class="form-group"> <label class="group-name" for="next_entry"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" data-leave-validation="<?php echo $s['next_entry']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="prev_entry"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" data-leave-validation="<?php echo $s['prev_entry']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="first_entry"><?php echo _t('conf.shortcut.first_article'); ?></label> <div class="group-controls"> - <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" /> + <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" data-leave-validation="<?php echo $s['first_entry']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="last_entry"><?php echo _t('conf.shortcut.last_article'); ?></label> <div class="group-controls"> - <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" /> + <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" data-leave-validation="<?php echo $s['last_entry']; ?>"/> </div> </div> @@ -53,7 +54,7 @@ <div class="form-group"> <label class="group-name" for="mark_read"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" data-leave-validation="<?php echo $s['mark_read']; ?>"/> <?php echo _t('conf.shortcut.shift_for_all_read'); ?> </div> </div> @@ -61,21 +62,21 @@ <div class="form-group"> <label class="group-name" for="mark_favorite"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" data-leave-validation="<?php echo $s['mark_favorite']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="go_website"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" data-leave-validation="<?php echo $s['go_website']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="auto_share_shortcut"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" data-leave-validation="<?php echo $s['auto_share']; ?>"/> <?php echo _t('conf.shortcut.auto_share_help'); ?> </div> </div> @@ -83,7 +84,7 @@ <div class="form-group"> <label class="group-name" for="collapse_entry"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" data-leave-validation="<?php echo $s['collapse_entry']; ?>"/> </div> </div> @@ -92,21 +93,21 @@ <div class="form-group"> <label class="group-name" for="load_more_shortcut"><?php echo _t('conf.shortcut.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']; ?>" /> + <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" data-leave-validation="<?php echo $s['load_more']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="focus_search_shortcut"><?php echo _t('conf.shortcut.focus_search'); ?></label> <div class="group-controls"> - <input type="text" id="focus_search_shortcut" name="shortcuts[focus_search]" list="keys" value="<?php echo $s['focus_search']; ?>" /> + <input type="text" id="focus_search_shortcut" name="shortcuts[focus_search]" list="keys" value="<?php echo $s['focus_search']; ?>" data-leave-validation="<?php echo $s['focus_search']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="user_filter_shortcut"><?php echo _t('conf.shortcut.user_filter'); ?></label> <div class="group-controls"> - <input type="text" id="user_filter_shortcut" name="shortcuts[user_filter]" list="keys" value="<?php echo $s['user_filter']; ?>" /> + <input type="text" id="user_filter_shortcut" name="shortcuts[user_filter]" list="keys" value="<?php echo $s['user_filter']; ?>" data-leave-validation="<?php echo $s['user_filter']; ?>"/> <?php echo _t('conf.shortcut.user_filter_help'); ?> </div> </div> @@ -114,14 +115,14 @@ <div class="form-group"> <label class="group-name" for="close_dropdown_shortcut"><?php echo _t('conf.shortcut.close_dropdown'); ?></label> <div class="group-controls"> - <input type="text" id="close_dropdown" name="shortcuts[close_dropdown]" list="keys" value="<?php echo $s['close_dropdown']; ?>" /> + <input type="text" id="close_dropdown" name="shortcuts[close_dropdown]" list="keys" value="<?php echo $s['close_dropdown']; ?>" data-leave-validation="<?php echo $s['close_dropdown']; ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="help_shortcut"><?php echo _t('conf.shortcut.help'); ?></label> <div class="group-controls"> - <input type="text" id="help_shortcut" name="shortcuts[help]" list="keys" value="<?php echo $s['help']; ?>" /> + <input type="text" id="help_shortcut" name="shortcuts[help]" list="keys" value="<?php echo $s['help']; ?>" data-leave-validation="<?php echo $s['help']; ?>"/> </div> </div> diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml new file mode 100644 index 000000000..37b68c991 --- /dev/null +++ b/app/views/configure/system.phtml @@ -0,0 +1,62 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('configure', 'system'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('admin.system'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="instance-name"><?php echo _t('admin.system.instance-name'); ?></label> + <div class="group-controls"> + <input type="text" class="extend" id="instance-name" name="instance-name" value="<?php echo FreshRSS_Context::$system_conf->title; ?>" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->title; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="auto-update-url"><?php echo _t('admin.system.auto-update-url'); ?></label> + <div class="group-controls"> + <input type="text" class="extend" id="auto-update-url" name="auto-update-url" value="<?php echo FreshRSS_Context::$system_conf->auto_update_url; ?>" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->auto_update_url; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-registrations"><?php echo _t('admin.system.registration.number'); ?></label> + <div class="group-controls"> + <input type="number" id="max-registrations" name="max-registrations" value="<?php echo FreshRSS_Context::$system_conf->limits['max_registrations']; ?>" min="0" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_registrations']; ?>"/> + <?php echo _i('help'); ?> <?php echo _t('admin.system.registration.help'); ?> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <?php + $number = count(listUsers()); + echo ($number > 1 ? _t('admin.user.numbers', $number) : _t('admin.user.number', $number)); + ?> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-feeds"><?php echo _t('admin.system.max-feeds'); ?></label> + <div class="group-controls"> + <input type="number" id="max-feeds" name="max-feeds" value="<?php echo FreshRSS_Context::$system_conf->limits['max_feeds']; ?>" min="1" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_feeds']; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-categories"><?php echo _t('admin.system.max-categories'); ?></label> + <div class="group-controls"> + <input type="number" id="max-categories" name="max-categories" value="<?php echo FreshRSS_Context::$system_conf->limits['max_categories']; ?>" min="1" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_categories']; ?>"/> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> +</div> diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index c346d2c4c..d85706669 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -1,16 +1,16 @@ <?php header('Content-Type: application/json; charset=UTF-8'); -if (Minz_Request::param('is_favorite', true)) { - Minz_Request::_param('is_favorite', 0); -} else { - Minz_Request::_param('is_favorite', 1); -} - -$url = Minz_Url::display(array( +$url = array( 'c' => Minz_Request::controllerName(), 'a' => Minz_Request::actionName(), - 'params' => Minz_Request::params(), -)); + 'params' => Minz_Request::fetchGET(), +); + +$url['params']['is_favorite'] = Minz_Request::param('is_favorite', true) ? '0' : '1'; -echo json_encode(array('url' => str_ireplace('&', '&', $url), 'icon' => _i(Minz_Request::param('is_favorite') ? 'non-starred' : 'starred'))); +FreshRSS::loadStylesAndScripts(); +echo json_encode(array( + 'url' => str_ireplace('&', '&', Minz_Url::display($url)), + 'icon' => _i($url['params']['is_favorite'] === '1' ? 'non-starred' : 'starred') + )); diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml index fabdec9e0..73977d94b 100755 --- a/app/views/entry/read.phtml +++ b/app/views/entry/read.phtml @@ -1,16 +1,16 @@ <?php header('Content-Type: application/json; charset=UTF-8'); -if (Minz_Request::param('is_read', true)) { - Minz_Request::_param('is_read', 0); -} else { - Minz_Request::_param('is_read', 1); -} - -$url = Minz_Url::display(array( +$url = array( 'c' => Minz_Request::controllerName(), 'a' => Minz_Request::actionName(), - 'params' => Minz_Request::params(), -)); + 'params' => Minz_Request::fetchGET(), +); + +$url['params']['is_read'] = Minz_Request::param('is_read', true) ? '0' : '1'; -echo json_encode(array('url' => str_ireplace('&', '&', $url), 'icon' => _i(Minz_Request::param('is_read') ? 'unread' : 'read'))); +FreshRSS::loadStylesAndScripts(); +echo json_encode(array( + 'url' => str_ireplace('&', '&', Minz_Url::display($url)), + 'icon' => _i($url['params']['is_read'] === '1' ? 'unread' : 'read') + )); diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml index f2d05028f..6439a0333 100644 --- a/app/views/extension/index.phtml +++ b/app/views/extension/index.phtml @@ -5,7 +5,8 @@ <h1><?php echo _t('admin.extensions.title'); ?></h1> - <form id="form-extension" method="post" style="display: none"></form> + <form id="form-extension" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <?php if (!empty($this->extension_list['system'])) { ?> <h2><?php echo _t('admin.extensions.system'); ?></h2> <?php @@ -25,12 +26,46 @@ } ?> <?php - } + } - if (empty($this->extension_list['system']) && empty($this->extension_list['user'])) { + if (empty($this->extension_list['system']) && empty($this->extension_list['user'])) { ?> <p class="alert alert-warn"><?php echo _t('admin.extensions.empty_list'); ?></p> <?php } ?> + </form> + + <?php if (!empty($this->available_extensions)) { ?> + <h2><?php echo _t('admin.extensions.community'); ?></h2> + <table> + <tr> + <th><?php echo _t('admin.extensions.name'); ?></th> + <th><?php echo _t('admin.extensions.version'); ?></th> + <th><?php echo _t('admin.extensions.author'); ?></th> + <th><?php echo _t('admin.extensions.description'); ?></th> + </tr> + <?php foreach ($this->available_extensions as $ext) { ?> + <tr> + <td><a href="<?php echo $ext['url']; ?>" target="_blank"><?php echo $ext['name']; ?></a></td> + <td><?php echo $ext['version']; ?></td> + <td><?php echo $ext['author']; ?></td> + <td> + <?php echo $ext['description']; ?> + <?php if (isset($this->extensions_installed[$ext['name']])) { ?> + <?php if (version_compare($this->extensions_installed[$ext['name']], $ext['version']) >= 0) { ?> + <span class="alert alert-success"> + <?php echo _t('admin.extensions.latest'); ?> + </span> + <?php } else if ($this->extensions_installed[$ext['name']] != $ext['version']) { ?> + <span class="alert alert-warn"> + <?php echo _t('admin.extensions.update'); ?> + </span> + <?php } ?> + <?php } ?> + </td> + </tr> + <?php } ?> + </table> + <?php } ?> </div> <?php $class = isset($this->extension) ? ' class="active"' : ''; ?> diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index 4cdd3f390..5cd59d298 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -7,6 +7,7 @@ <?php } ?> <form method="post" action="<?php echo _url('feed', 'add'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('sub.feed.informations'); ?></legend> <?php if ($this->load_ok) { ?> <div class="form-group"> @@ -29,7 +30,7 @@ <label class="group-name"><?php echo _t('sub.feed.website'); ?></label> <div class="group-controls"> <?php echo $this->feed->website(); ?> - <a class="btn" target="_blank" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> </div> </div> <?php } ?> @@ -39,9 +40,9 @@ <div class="group-controls"> <div class="stick"> <input type="text" name="url_rss" id="url" class="extend" value="<?php echo $this->feed->url(); ?>" /> - <a class="btn" target="_blank" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> </div> - <a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->feed->url(); ?>"><?php echo _t('sub.feed.validator'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->feed->url(); ?>"><?php echo _t('sub.feed.validator'); ?></a> </div> </div> <div class="form-group"> @@ -56,7 +57,7 @@ <option value="nc"><?php echo _t('sub.category.new'); ?></option> </select> - <span style="display: none;"> + <span aria-hidden="true"> <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo _t('sub.category.new'); ?>" /> </span> </div> @@ -67,7 +68,7 @@ <div class="form-group"> <label class="group-name" for="http_user"><?php echo _t('sub.feed.auth.username'); ?></label> <div class="group-controls"> - <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo $auth['username']; ?>" autocomplete="off" /> + <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo empty($auth['username']) ? ' ' : $auth['username']; ?>" autocomplete="off" /> </div> <label class="group-name" for="http_pass"><?php echo _t('sub.feed.auth.password'); ?></label> diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index ffdca1daa..49c370023 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -1,47 +1,66 @@ <?php - $username = Minz_Session::param('currentUser', '_'); +$username = Minz_Session::param('currentUser', '_'); - $articles = array( - 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, - 'title' => $this->list_title, - 'author' => $username, - 'items' => array() - ); +$options = 0; +if (version_compare(PHP_VERSION, '5.4.0') >= 0) { + $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; +} - foreach ($this->entries as $entry) { - if (!isset($this->feed)) { - $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed ()); - } else { - $feed = $this->feed; - } +$articles = array( + 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, + 'title' => $this->list_title, + 'author' => $username, + 'items' => array(), +); - $articles['items'][] = array( - 'id' => $entry->guid(), - 'categories' => array_values($entry->tags()), - 'title' => $entry->title(), - 'author' => $entry->author(), - 'published' => $entry->date(true), - 'updated' => $entry->date(true), - 'alternate' => array(array( - 'href' => $entry->link(), - 'type' => 'text/html' - )), - 'content' => array( - 'content' => $entry->content() - ), - 'origin' => array( - 'streamId' => $feed->id(), - 'title' => $feed->name(), - 'htmlUrl' => $feed->website(), - 'feedUrl' => $feed->url() - ) - ); - } +echo rtrim(json_encode($articles, $options), " ]}\n\r\t"), "\n"; +$first = true; - $options = 0; - if (version_compare(PHP_VERSION, '5.4.0') >= 0) { - $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; - } +foreach ($this->entriesRaw as $entryRaw) { + if (empty($entryRaw)) { + continue; + } + $entry = FreshRSS_EntryDAO::daoToEntry($entryRaw); + if (!isset($this->feed)) { + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed()); + if ($feed == null) { + $feed = $entry->feed(true); + } + } else { + $feed = $this->feed; + } - echo json_encode($articles, $options); -?> + $article = array( + 'id' => $entry->guid(), + 'categories' => array_values($entry->tags()), + 'title' => $entry->title(), + 'author' => $entry->author(), + 'published' => $entry->date(true), + 'updated' => $entry->date(true), + 'alternate' => array(array( + 'href' => $entry->link(), + 'type' => 'text/html', + )), + 'content' => array( + 'content' => $entry->content(), + ), + 'origin' => array( + 'streamId' => $feed == null ? '' : $feed->id(), + 'title' => $feed == null ? '' : $feed->name(), + 'htmlUrl' => $feed == null ? '' : $feed->website(), + 'feedUrl' => $feed == null ? '' : $feed->url(), + ) + ); + + $line = json_encode($article, $options); + if ($line != '') { + if ($first) { + $first = false; + } else { + echo ",\n"; + } + echo $line; + } +} + +echo "\n]}\n"; diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 0b08d036c..bf87a255a 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -18,6 +18,7 @@ <?php } ?> <form method="post" action="<?php echo _url('subscription', 'feed', 'id', $this->feed->id()); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('sub.feed.informations'); ?></legend> <div class="form-group"> <label class="group-name" for="name"><?php echo _t('sub.feed.title'); ?></label> @@ -36,7 +37,7 @@ <div class="group-controls"> <div class="stick"> <input type="text" name="website" id="website" class="extend" value="<?php echo $this->feed->website(); ?>" /> - <a class="btn" target="_blank" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> </div> </div> </div> @@ -45,10 +46,10 @@ <div class="group-controls"> <div class="stick"> <input type="text" name="url" id="url" class="extend" value="<?php echo $this->feed->url(); ?>" /> - <a class="btn" target="_blank" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> </div> - <a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->feed->url(); ?>"><?php echo _t('sub.feed.validator'); ?></a> + <a class="btn" target="_blank" rel="noreferrer" href="http://validator.w3.org/feed/check.cgi?url=<?php echo rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)); ?>"><?php echo _t('sub.feed.validator'); ?></a> </div> </div> <div class="form-group"> @@ -126,6 +127,14 @@ ?></select> </div> </div> + <div class="form-group"> + <label class="group-name" for="pubsubhubbub"><?php echo _t('sub.feed.pubsubhubbub'); ?></label> + <div class="group-controls"> + <label class="checkbox" for="pubsubhubbub"> + <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1"<?php echo $this->feed->pubSubHubbubEnabled() ? ' checked="checked"' : ''; ?> /> + </label> + </div> + </div> <div class="form-group form-actions"> <div class="group-controls"> <button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> @@ -136,15 +145,15 @@ <legend><?php echo _t('sub.feed.auth.configuration'); ?></legend> <?php $auth = $this->feed->httpAuth(false); ?> <div class="form-group"> - <label class="group-name" for="http_user"><?php echo _t('sub.feed.auth.username'); ?></label> + <label class="group-name" for="http_user_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.username'); ?></label> <div class="group-controls"> - <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo $auth['username']; ?>" autocomplete="off" /> + <input type="text" name="http_user_feed<?php echo $this->feed->id(); ?>" id="http_user_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo empty($auth['username']) ? ' ' : $auth['username']; ?>" autocomplete="off" /> <?php echo _i('help'); ?> <?php echo _t('sub.feed.auth.help'); ?> </div> - <label class="group-name" for="http_pass"><?php echo _t('sub.feed.auth.password'); ?></label> + <label class="group-name" for="http_pass_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.password'); ?></label> <div class="group-controls"> - <input type="password" name="http_pass" id="http_pass" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" /> + <input type="password" name="http_pass_feed<?php echo $this->feed->id(); ?>" id="http_pass_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" /> </div> </div> diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml index 20b4b332c..bc23938b0 100644 --- a/app/views/helpers/index/normal/entry_bottom.phtml +++ b/app/views/helpers/index/normal/entry_bottom.phtml @@ -52,7 +52,14 @@ $share_options['title'] = $title; $share->update($share_options); ?><li class="item share"> - <a target="_blank" href="<?php echo $share->url(); ?>"><?php echo $share->name(); ?></a> + <?php if ('GET' === $share->method()) {?> + <a target="_blank" rel="noreferrer" href="<?php echo $share->url(); ?>"><?php echo $share->name(); ?></a> + <?php } else {?> + <a href="POST"><?php echo $share->name(); ?></a> + <form method="POST" data-url="<?php echo $share->url(); ?>"> + <input type="hidden" value="<?php echo $link; ?>" name="<?php echo $share->field(); ?>"/> + </form> + <?php } ?> </li><?php } ?></ul> @@ -71,7 +78,7 @@ <ul class="dropdown-menu"> <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 + ?><li class="item"><a href="<?php echo _url('index', 'index', 'search', '#' . htmlspecialchars_decode($tag)); ?>"><?php echo $tag; ?></a></li><?php } ?> </ul> </div> @@ -81,6 +88,6 @@ ?><li class="item date"><?php echo $this->entry->date(); ?></li><?php } if ($bottomline_link) { - ?><li class="item link"><a target="_blank" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php + ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?> </ul> diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml index dc544298f..86298e59f 100644 --- a/app/views/helpers/index/normal/entry_header.phtml +++ b/app/views/helpers/index/normal/entry_header.phtml @@ -27,7 +27,7 @@ } } ?><li class="item website"><a href="<?php echo _url('index', 'index', 'get', 'f_' . $this->feed->id()); ?>"><img class="favicon" src="<?php echo $this->feed->favicon(); ?>" alt="✇" /> <span><?php echo $this->feed->name(); ?></span></a></li> - <li class="item title"><a target="_blank" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></li> + <li class="item title"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></li> <?php if ($topline_date) { ?><li class="item date"><?php echo $this->entry->date(); ?> </li><?php } ?> - <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?> + <?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?> </ul> diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index adf0783f3..2da53b679 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -1,71 +1,55 @@ -"use strict"; <?php - $mark = FreshRSS_Context::$user_conf->mark_when; -$mail = Minz_Session::param('mail', false); -$auto_actualize = Minz_Session::param('actualize_feeds', false); -$hide_posts = (FreshRSS_Context::$user_conf->display_posts || - Minz_Request::param('output') === 'reader'); $s = FreshRSS_Context::$user_conf->shortcuts; - -$url_login = Minz_Url::display(array( - 'c' => 'auth', - 'a' => 'login' -), 'php'); -$url_logout = Minz_Url::display(array( - 'c' => 'auth', - 'a' => 'logout' -), 'php'); - -echo 'var context={', - 'auto_remove_article:', FreshRSS_Context::isAutoRemoveAvailable() ? 'true' : 'false', ',', - 'hide_posts:', $hide_posts ? 'false' : 'true', ',', - 'display_order:"', Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), '",', - 'auto_mark_article:', $mark['article'] ? 'true' : 'false', ',', - 'auto_mark_site:', $mark['site'] ? 'true' : 'false', ',', - 'auto_mark_scroll:', $mark['scroll'] ? 'true' : 'false', ',', - 'auto_load_more:', FreshRSS_Context::$user_conf->auto_load_more ? 'true' : 'false', ',', - 'auto_actualize_feeds:', $auto_actualize ? 'true' : 'false', ',', - 'does_lazyload:', FreshRSS_Context::$user_conf->lazyload ? 'true' : 'false', ',', - 'sticky_post:', FreshRSS_Context::isStickyPostEnabled() ? 'true' : 'false', ',', - 'html5_notif_timeout:', FreshRSS_Context::$user_conf->html5_notif_timeout, ',', - 'auth_type:"', FreshRSS_Context::$system_conf->auth_type, '",', - 'current_user_mail:', $mail ? ('"' . $mail . '"') : 'null', ',', - 'current_view:"', Minz_Request::param('output', 'normal'), '"', -"},\n"; - -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'], '",', - 'first_entry:"', @$s['first_entry'], '",', - 'last_entry:"', @$s['last_entry'], '",', - 'collapse_entry:"', @$s['collapse_entry'], '",', - 'load_more:"', @$s['load_more'], '",', - 'auto_share:"', @$s['auto_share'], '",', - 'focus_search:"', @$s['focus_search'], '",', - 'user_filter:"', @$s['user_filter'], '",', - 'help:"', @$s['help'], '",', - 'close_dropdown:"', @$s['close_dropdown'], '"', -"},\n"; - -echo 'url={', - 'index:"', _url('index', 'index'), '",', - 'login:"', $url_login, '",', - 'logout:"', $url_logout, '",', - 'help:"', FRESHRSS_WIKI, '"', -"},\n"; - -echo 'i18n={', - 'confirmation_default:"', _t('gen.js.confirm_action'), '",', - 'notif_title_articles:"', _t('gen.js.feedback.title_new_articles'), '",', - 'notif_body_articles:"', _t('gen.js.feedback.body_new_articles'), '",', - 'notif_request_failed:"', _t('gen.js.feedback.request_failed'), '",', - 'category_empty:"', _t('gen.js.category_empty'), '"', -"},\n"; - -echo 'icons={', - 'close:\'', _i('close'), '\'', -"}\n";
\ No newline at end of file +echo htmlspecialchars(json_encode(array( + 'context' => array( + 'anonymous' => !FreshRSS_Auth::hasAccess(), + 'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(), + 'hide_posts' => !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader'), + 'display_order' => Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), + 'auto_mark_article' => !!$mark['article'], + 'auto_mark_site' => !!$mark['site'], + 'auto_mark_scroll' => !!$mark['scroll'], + 'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more, + 'auto_actualize_feeds' => !!Minz_Session::param('actualize_feeds', false), + 'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload , + 'sides_close_article' => !!FreshRSS_Context::$user_conf->sides_close_article, + 'sticky_post' => !!FreshRSS_Context::isStickyPostEnabled(), + 'html5_notif_timeout' => FreshRSS_Context::$user_conf->html5_notif_timeout, + 'auth_type' => FreshRSS_Context::$system_conf->auth_type, + 'current_view' => Minz_Request::actionName(), + 'csrf' => FreshRSS_Auth::csrfToken(), + ), + 'shortcuts' => array( + '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'], + 'first_entry' => @$s['first_entry'], + 'last_entry' => @$s['last_entry'], + 'collapse_entry' => @$s['collapse_entry'], + 'load_more' => @$s['load_more'], + 'auto_share' => @$s['auto_share'], + 'focus_search' => @$s['focus_search'], + 'user_filter' => @$s['user_filter'], + 'help' => @$s['help'], + 'close_dropdown' => @$s['close_dropdown'], + ), + 'url' => array( + 'index' => _url('index', 'index'), + 'login' => Minz_Url::display(array('c' => 'auth', 'a' => 'login'), 'php'), + 'logout' => Minz_Url::display(array('c' => 'auth', 'a' => 'logout'), 'php'), + 'help' => FRESHRSS_WIKI, + ), + 'i18n' => array( + 'confirmation_default' => _t('gen.js.confirm_action'), + 'notif_title_articles' => _t('gen.js.feedback.title_new_articles'), + 'notif_body_articles' => _t('gen.js.feedback.body_new_articles'), + 'notif_request_failed' => _t('gen.js.feedback.request_failed'), + 'category_empty' => _t('gen.js.category_empty'), + ), + 'icons' => array( + 'close' => _i('close'), + ), +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml index 58b3c68f4..bf9d91f04 100755 --- a/app/views/helpers/logs_pagination.phtml +++ b/app/views/helpers/logs_pagination.phtml @@ -1,7 +1,7 @@ <?php $c = Minz_Request::controllerName(); $a = Minz_Request::actionName(); - $params = Minz_Request::params(); + $params = Minz_Request::fetchGET(); ?> <?php if ($this->nbPage > 1) { ?> diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml index b20201c4b..893451af9 100755 --- a/app/views/helpers/pagination.phtml +++ b/app/views/helpers/pagination.phtml @@ -1,6 +1,7 @@ <?php $url_next = Minz_Request::currentRequest(); $url_next['params']['next'] = FreshRSS_Context::$next_id; + $url_next['params']['state'] = FreshRSS_Context::$state; $url_next['params']['ajax'] = 1; $url_mark_read = array( @@ -10,12 +11,14 @@ 'get' => FreshRSS_Context::currentGet(), 'nextGet' => FreshRSS_Context::$next_get, 'idMax' => FreshRSS_Context::$id_max, + 'search' => FreshRSS_Context::$search, + 'state' => FreshRSS_Context::$state, ) ); ?> -<form id="mark-read-pagination" method="post" style="display: none"></form> - +<form id="mark-read-pagination" method="post"> +<input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <ul class="pagination"> <li class="item pager-next"> <?php if (FreshRSS_Context::$next_id) { ?> @@ -24,7 +27,7 @@ </a> <?php } elseif ($url_mark_read) { ?> <button id="bigMarkAsRead" - class="as-link <?php echo FreshRSS_Context::$user_conf->reading_confirm ? 'confirm' : ''; ?>" + class="as-link <?php echo FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>" form="mark-read-pagination" formaction="<?php echo Minz_Url::display($url_mark_read); ?>" type="submit"> @@ -39,3 +42,4 @@ <?php } ?> </li> </ul> +</form> diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml index a64524bf1..c5049e3ea 100644 --- a/app/views/importExport/index.phtml +++ b/app/views/importExport/index.phtml @@ -4,6 +4,7 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('importExport', 'import'); ?>" enctype="multipart/form-data"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('sub.import_export.import'); ?></legend> <div class="form-group"> <label class="group-name" for="file"> @@ -23,6 +24,7 @@ <?php if (count($this->feeds) > 0) { ?> <form method="post" action="<?php echo _url('importExport', 'export'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('sub.import_export.export'); ?></legend> <div class="form-group"> <div class="group-controls"> @@ -42,7 +44,7 @@ $select_args = ' size="' . min(10, count($this->feeds)) .'" multiple="multiple"'; } ?> - <select name="export_feeds[]"<?php echo $select_args; ?>> + <select name="export_feeds[]"<?php echo $select_args; ?> size="10"> <?php echo extension_loaded('zip') ? '' : '<option></option>'; ?> <?php foreach ($this->feeds as $feed) { ?> <option value="<?php echo $feed->id(); ?>"><?php echo $feed->name(); ?></option> diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index 3fdb5160d..649729952 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -13,8 +13,10 @@ <dt><?php echo _t('index.about.license'); ?></dt> <dd><?php echo _t('index.about.agpl3'); ?></dd> + <?php if (FreshRSS_Auth::hasAccess()): ?> <dt><?php echo _t('index.about.version'); ?></dt> <dd><?php echo FRESHRSS_VERSION; ?></dd> + <?php endif; ?> </dl> <p><?php echo _t('index.about.freshrss_description'); ?></p> diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index 0ffa3bc54..f35732c8f 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -11,10 +11,13 @@ <div id="stream" class="global<?php echo $class; ?>"> <?php + $params = Minz_Request::fetchGET(); + unset($params['c']); + unset($params['a']); $url_base = array( 'c' => 'index', 'a' => 'normal', - 'params' => Minz_Request::params() + 'params' => $params, ); foreach ($this->categories as $cat) { diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml index 02256bd98..a88f89278 100644 --- a/app/views/index/logs.phtml +++ b/app/views/index/logs.phtml @@ -3,6 +3,7 @@ <h1><?php echo _t('index.log'); ?></h1> <form method="post" action="<?php echo _url('index', 'logs'); ?>"><p> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <input type="hidden" name="clearLogs" /> <button type="submit" class="btn"><?php echo _t('index.log.clear'); ?></button> </p></form> @@ -10,7 +11,7 @@ <?php $items = $this->logsPaginator->items(); ?> <?php if (!empty($items)) { ?> - <div class="logs"> + <div class="loglist"> <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?> <?php foreach ($items as $log) { ?> diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index f71abf158..ba48b2501 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -56,13 +56,17 @@ if (!empty($this->entries)) { ?></div><?php $display_others = false; } - ?><div class="flux<?php echo !$this->entry->isRead() ? ' not_read' : ''; ?><?php echo $this->entry->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $this->entry->id(); ?>"><?php + ?><div class="flux<?php echo !$this->entry->isRead() ? ' not_read' : ''; + ?><?php echo $this->entry->isFavorite() ? ' favorite' : ''; + ?>" id="flux_<?php echo $this->entry->id(); + ?>" data-feed="<?php echo $this->feed->id(); + ?>"><?php $this->renderHelper('index/normal/entry_header'); ?><div class="flux_content"> <div class="content <?php echo $content_width; ?>"> - <h1 class="title"><a target="_blank" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></h1> + <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></h1> <?php $author = $this->entry->author(); echo $author != '' ? '<div class="author">' . _t('gen.short.by_author', $author) . '</div>' : '', diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index a19ee322e..f2af75af0 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -19,7 +19,7 @@ if (!empty($this->entries)) { $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $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(); ?>"> + <a target="_blank" rel="noreferrer" class="go_website" href="<?php echo $item->link(); ?>"> <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span> </a> <h1 class="title"><?php echo $item->title(); ?></h1> diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index 454228909..3baabf748 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,56 +1,13 @@ -"use strict"; -var feeds = [<?php foreach ($this->feeds as $feed) { ?>{<?php - ?>url: "<?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'actualize', 'params' => array('id' => $feed->id(), 'ajax' => '1')), 'php'); ?>",<?php - ?>title: "<?php echo $feed->name(); ?>"<?php -?>},<?php } ?>], - feed_processed = 0, - feed_count = feeds.length; - -function initProgressBar(init) { - if (init) { - $("body").after("\<div id=\"actualizeProgress\" class=\"notification good\">\ - <?php echo _t('feedback.sub.actualize'); ?><br /><span class=\"title\">/</span><br />\ - <span class=\"progress\">0 / " + feed_count + "</span>\ - </div>"); - } else { - window.location.reload(); - } -} -function updateProgressBar(i, title_feed) { - $("#actualizeProgress .progress").html(i + " / " + feed_count); - $("#actualizeProgress .title").html(title_feed); -} - -function updateFeeds() { - if (feed_count === 0) { - openNotification("<?php echo _t('feedback.sub.feed.no_refresh'); ?>", "good"); - ajax_loading = false; - return; - } - initProgressBar(true); - - for (var i = 0; i < 10; i++) { - updateFeed(); - } -} - -function updateFeed() { - var feed = feeds.pop(); - if (feed == undefined) { - return; - } - - $.ajax({ - type: 'POST', - url: feed['url'], - }).complete(function (data) { - feed_processed++; - updateProgressBar(feed_processed, feed['title']); - - if (feed_processed === feed_count) { - initProgressBar(false); - } else { - updateFeed(); - } - }); -} +<?php +$feeds = array(); +foreach ($this->feeds as $feed) { + $feeds[] = array( + 'url' => Minz_Url::display(array('c' => 'feed', 'a' => 'actualize', 'params' => array('id' => $feed->id(), 'ajax' => '1')), 'php'), + 'title' => $feed->name(), + ); +} +echo json_encode(array( + 'feeds' => $feeds, + 'feedback_no_refresh' => _t('feedback.sub.feed.no_refresh'), + 'feedback_actualize' => _t('feedback.sub.actualize'), +)); diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index 22117792d..88c78d465 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -6,10 +6,10 @@ <h1><?php echo _t('admin.stats.idle'); ?></h1> <?php - $current_url = urlencode(Minz_Url::display( + $current_url = Minz_Url::display( array('c' => 'stats', 'a' => 'idle'), 'php', true - )); + ); $nothing = true; foreach ($this->idleFeeds as $period => $feeds) { if (!empty($feeds)) { @@ -18,8 +18,8 @@ <div class="stat"> <h2><?php echo _t('gen.date.' . $period); ?></h2> - <form id="form-delete" method="post" style="display: none"></form> - + <form id="form-delete" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <?php foreach ($feeds as $feed) { ?> <ul class="horizontal-list"> <li class="item"> @@ -34,6 +34,7 @@ </li> </ul> <?php } ?> + </form> </div> <?php } diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 18bcd4d99..a36f812a8 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -23,18 +23,18 @@ </tr> <tr> <th><?php echo _t('admin.stats.status_read'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['read']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['read']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_reads']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_reads']); ?></td> </tr> <tr> <th><?php echo _t('admin.stats.status_unread'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['unread']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['unread']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_unreads']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_unreads']); ?></td> </tr> <tr> <th><?php echo _t('admin.stats.status_favorites'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['favorite']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['favorite']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_favorites']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_favorites']); ?></td> </tr> </tbody> </table> @@ -66,74 +66,28 @@ <div class="stat"> <h2><?php echo _t('admin.stats.entry_per_day'); ?></h2> - <div id="statsEntryPerDay" style="height: 300px"></div> + <div id="statsEntryPerDay" class="statGraph"></div> </div> <div class="stat half"> <h2><?php echo _t('admin.stats.feed_per_category'); ?></h2> - <div id="statsFeedPerCategory" style="height: 300px"></div> + <div id="statsFeedPerCategory" class="statGraph"></div> <div id="statsFeedPerCategoryLegend"></div> - </div><!-- + </div> - --><div class="stat half"> + <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_category'); ?></h2> - <div id="statsEntryPerCategory" style="height: 300px"></div> + <div id="statsEntryPerCategory" class="statGraph"></div> <div id="statsEntryPerCategoryLegend"></div> </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 - var avg = []; - for (var i = -31; i <= 0; i++) { - avg.push([i, <?php echo $this->average?>]); - } - Flotr.draw(document.getElementById('statsEntryPerDay'), - [{ - data: <?php echo $this->count ?>, - bars: {horizontal: false, show: true} - },{ - data: avg, - lines: {show: true}, - label: "<?php echo $this->average?>" - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25}, - 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> +<script id="jsonStats" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'average' => $this->average, + 'dataCount' => $this->count, + 'feedByCategory' => $this->feedByCategory, + 'entryByCategory' => $this->entryByCategory, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/stats.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/stats.js'); ?>"></script> diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index b20d9bbd0..5ebcdce5a 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -12,7 +12,7 @@ if (!empty($feeds)) { echo '<optgroup label="', $category->name(), '">'; foreach ($feeds as $feed) { - if ($this->feed && $feed->id() == $this->feed->id()){ + if ($this->feed && $feed->id() == $this->feed->id()) { echo '<option value="', $feed->id(), '" selected="selected" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>'; } else { echo '<option value="', $feed->id(), '" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>'; @@ -30,108 +30,45 @@ <?php }?> <div class="stat"> - <table> + <table> <tr> - <th><?php echo _t('admin.stats.status_total'); ?></th> - <th><?php echo _t('admin.stats.status_read'); ?></th> - <th><?php echo _t('admin.stats.status_unread'); ?></th> - <th><?php echo _t('admin.stats.status_favorites'); ?></th> + <th><?php echo _t('admin.stats.status_total'); ?></th> + <th><?php echo _t('admin.stats.status_read'); ?></th> + <th><?php echo _t('admin.stats.status_unread'); ?></th> + <th><?php echo _t('admin.stats.status_favorites'); ?></th> </tr> <tr> - <td class="numeric"><?php echo $this->repartition['total']; ?></td> - <td class="numeric"><?php echo $this->repartition['read']; ?></td> - <td class="numeric"><?php echo $this->repartition['unread']; ?></td> - <td class="numeric"><?php echo $this->repartition['favorite']; ?></td> + <td class="numeric"><?php echo $this->repartition['total']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_reads']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_unreads']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_favorites']; ?></td> </tr> - </table> + </table> </div> <div class="stat"> <h2><?php echo _t('admin.stats.entry_per_hour', $this->averageHour); ?></h2> - <div id="statsEntryPerHour" style="height: 300px"></div> + <div id="statsEntryPerHour" class="statGraph"></div> </div> <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek); ?></h2> - <div id="statsEntryPerDayOfWeek" style="height: 300px"></div> - </div><!-- + <div id="statsEntryPerDayOfWeek" class="statGraph"></div> + </div> - --><div class="stat half"> + <div class="stat half"> <h2><?php echo _t('admin.stats.entry_per_month', $this->averageMonth); ?></h2> - <div id="statsEntryPerMonth" style="height: 300px"></div> + <div id="statsEntryPerMonth" class="statGraph"></div> </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 hour - Flotr.draw(document.getElementById('statsEntryPerHour'), - [{ - data: <?php echo $this->repartitionHour ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 23, - tickFormatter: function(x) { - var x = parseInt(x); - return x + 1; - }, - min: -0.9, - max: 23.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Entry per day of week - Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'), - [{ - data: <?php echo $this->repartitionDayOfWeek ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 6, - tickFormatter: function(x) { - var x = parseInt(x), - days = <?php echo $this->days?>; - return days[x]; - }, - min: -0.9, - max: 6.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Entry per month - Flotr.draw(document.getElementById('statsEntryPerMonth'), - [{ - data: <?php echo $this->repartitionMonth ?>, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 12, - tickFormatter: function(x) { - var x = parseInt(x), - months = <?php echo $this->months?>; - return months[(x - 1)]; - }, - min: 0.1, - max: 12.9, - tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - -} -initStats(); -</script> +<script id="jsonRepartition" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'repartitionHour' => $this->repartitionHour, + 'repartitionDayOfWeek' => $this->repartitionDayOfWeek, + 'days' => $this->days, + 'repartitionMonth' => $this->repartitionMonth, + 'months' => $this->months, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/repartition.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/repartition.js'); ?>"></script> diff --git a/app/views/subscription/bookmarklet.phtml b/app/views/subscription/bookmarklet.phtml new file mode 100644 index 000000000..76ac700e0 --- /dev/null +++ b/app/views/subscription/bookmarklet.phtml @@ -0,0 +1,17 @@ +<?php $this->partial('aside_subscription'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <legend><?php echo _t('sub.bookmarklet.title'); ?></legend> + <p><a class="btn btn-important" href="javascript:(function(){var%20url%20=%20location.href;var%20otherWindow=window.open('about:blank','_blank');otherWindow.opener=null;otherWindow.location='<?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true); ?>&url_rss='+encodeURIComponent(url);})();"><?php echo _t('sub.bookmarklet.label'); ?></a></p> + <?php echo _t('sub.bookmarklet.documentation'); ?> + + <legend><?php echo _t('sub.firefox.title'); ?></legend> + <p><?php echo _t('sub.firefox.documentation'); ?></p> + <pre>browser.contentHandlers.types.number.uri → <?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true); ?>&url_rss=%s</pre> + + <legend><?php echo _t('sub.api.title'); ?></legend> + <p><?php echo _t('sub.api.documentation'); ?></p> + <pre><?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true); ?>&url_rss=%s</pre> +</div>
\ No newline at end of file diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 331e8244e..48f760d3e 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -6,6 +6,7 @@ <h2><?php echo _t('sub.title'); ?></h2> <form id="add_rss" method="post" action="<?php echo _url('feed', 'add'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <div class="stick"> <input type="url" name="url_rss" class="long" placeholder="<?php echo _t('sub.feed.add'); ?>" /> <div class="dropdown"> @@ -28,7 +29,7 @@ </select> </li> - <li class="input" style="display:none"> + <li class="input" aria-hidden="true"> <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo _t('sub.category.new'); ?>" /> </li> @@ -36,10 +37,10 @@ <li class="dropdown-header"><?php echo _t('sub.feed.auth.http'); ?></li> <li class="input"> - <input type="text" name="http_user" id="http_user_add" autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.username'); ?>" /> + <input type="text" name="http_user" id="http_user_feed" value=" " autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.username'); ?>" /> </li> <li class="input"> - <input type="password" name="http_pass" id="http_pass_add" autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.password'); ?>" /> + <input type="password" name="http_pass" id="http_pass_feed" autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.password'); ?>" /> </li> </ul> </div> @@ -56,13 +57,16 @@ <ul class="box-content box-content-centered"> <form action="<?php echo _url('category', 'create'); ?>" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <li class="item"><input type="text" id="new-category" name="new-category" placeholder="<?php echo _t('sub.category.new'); ?>" /></li> <li class="item"><button class="btn btn-important" type="submit"><?php echo _t('gen.action.submit'); ?></button></li> </form> </ul> </div> - <form id="controller-category" method="post" style="display: none;"></form> + <form id="controller-category" method="post" aria-hidden="true"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + </form> <?php foreach ($this->categories as $cat) { @@ -71,6 +75,7 @@ <div class="box"> <div class="box-title"> <form action="<?php echo _url('category', 'update', 'id', $cat->id()); ?>" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <input type="text" name="name" value="<?php echo $cat->name(); ?>" /> <div class="dropdown"> diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml index a92860c7e..33d78cbe7 100644 --- a/app/views/update/checkInstall.phtml +++ b/app/views/update/checkInstall.phtml @@ -9,7 +9,7 @@ <p class="alert <?php echo $status ? 'alert-success' : 'alert-error'; ?>"> <?php if ($key === 'php') { - echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok'), PHP_VERSION, '5.2.1'); + echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok'), PHP_VERSION, '5.3.8'); } else { echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok')); } diff --git a/app/views/update/index.phtml b/app/views/update/index.phtml index da1bc7ef5..0599d5b0d 100644 --- a/app/views/update/index.phtml +++ b/app/views/update/index.phtml @@ -14,7 +14,21 @@ </p> <?php if (!empty($this->message)) { ?> - <p class="alert <?php echo $this->message['status'] === 'bad' ? 'alert-error' : 'alert-warn'; ?>"> + <?php + $class = 'alert-warn'; + switch ($this->message['status']) { + case 'bad': + $class = 'alert-error'; + break; + case 'latest': + $class = 'alert-success'; + break; + default: + $class = 'alert-warn'; + break; + } + ?> + <p class="alert <?php echo $class; ?>"> <span class="alert-head"><?php echo $this->message['title']; ?></span> <?php echo $this->message['body']; ?> </p> diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index fe1b6618b..793a3a0bd 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -3,7 +3,8 @@ <div class="post"> <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> - <form method="post" action="<?php echo _url('user', 'create'); ?>"> + <form method="post" action="<?php echo _url('user', 'create'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('admin.user.create'); ?></legend> <div class="form-group"> @@ -21,7 +22,7 @@ <div class="form-group"> <label class="group-name" for="new_user_name"><?php echo _t('admin.user.username'); ?></label> <div class="group-controls"> - <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" /> + <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" autocomplete="off" pattern="<?php echo FreshRSS_user_Controller::USERNAME_PATTERN; ?>" placeholder="demo" /> </div> </div> @@ -29,7 +30,7 @@ <label class="group-name" for="new_user_passwordPlain"><?php echo _t('admin.user.password_form'); ?></label> <div class="group-controls"> <div class="stick"> - <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" /> + <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="new-password" pattern=".{7,}" /> <a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a> </div> <?php echo _i('help'); ?> <?php echo _t('admin.user.password_format'); ?> @@ -37,14 +38,6 @@ </div> </div> - <div class="form-group"> - <label class="group-name" for="new_user_email"><?php echo _t('admin.user.email_persona'); ?></label> - <?php $mail = FreshRSS_Context::$user_conf->mail_login; ?> - <div class="group-controls"> - <input type="email" id="new_user_email" name="new_user_email" class="extend" autocomplete="off" 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 _t('gen.action.create'); ?></button> @@ -54,6 +47,7 @@ </form> <form method="post" action="<?php echo _url('user', 'delete'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('admin.user.users'); ?></legend> <div class="form-group"> diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index c44202edd..7a63c0941 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -4,6 +4,7 @@ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('user', 'profile'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <legend><?php echo _t('conf.profile'); ?></legend> <div class="form-group"> @@ -18,11 +19,11 @@ </div> <div class="form-group"> - <label class="group-name" for="passwordPlain"><?php echo _t('conf.profile.password_form'); ?></label> + <label class="group-name" for="newPasswordPlain"><?php echo _t('conf.profile.password_form'); ?></label> <div class="group-controls"> <div class="stick"> - <input type="password" id="passwordPlain" name="passwordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> - <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo _i('key'); ?></a> + <input type="password" id="newPasswordPlain" name="newPasswordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> + <a class="btn toggle-password" data-toggle="newPasswordPlain"><?php echo _i('key'); ?></a> </div> <?php echo _i('help'); ?> <?php echo _t('conf.profile.password_format'); ?> <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> @@ -37,18 +38,23 @@ <input type="password" id="apiPasswordPlain" name="apiPasswordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> <a class="btn toggle-password" data-toggle="apiPasswordPlain"><?php echo _i('key'); ?></a> </div> + <?php echo _i('help'); ?> <kbd><a href="../api/"><?php echo Minz_Url::display('/api/', 'html', true); ?></a></kbd> </div> </div> <?php } ?> + <?php if (FreshRSS_Auth::accessNeedsAction()) { ?> <div class="form-group"> - <label class="group-name" for="mail_login"><?php echo _t('conf.profile.email_persona'); ?></label> - <?php $mail = FreshRSS_Context::$user_conf->mail_login; ?> + <label class="group-name" for="token"><?php echo _t('admin.auth.token'); ?></label> + <?php $token = FreshRSS_Context::$user_conf->token; ?> <div class="group-controls"> - <input type="email" id="mail_login" name="mail_login" class="extend" autocomplete="off" value="<?php echo $mail; ?>" <?php echo FreshRSS_Auth::hasAccess('admin') ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" /> - <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo _t('gen.short.blank_to_disable'); ?>"<?php + echo FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo $token; ?>"/> + <?php echo _i('help'); ?> <?php echo _t('admin.auth.token_help'); ?> + <kbd><?php echo Minz_Url::display(array('a' => 'rss', 'params' => array('user' => Minz_Session::param('currentUser'), 'token' => $token, 'hours' => FreshRSS_Context::$user_conf->since_hours_posts_per_rss)), 'html', true); ?></kbd> </div> </div> + <?php } ?> <div class="form-group form-actions"> <div class="group-controls"> @@ -57,4 +63,36 @@ </div> </div> </form> + + <?php if (!FreshRSS_Auth::hasAccess('admin')) { ?> + <form id="crypto-form" method="post" action="<?php echo _url('user', 'delete'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.profile.delete'); ?></legend> + + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('conf.profile.delete.warn'); ?></p> + + <div class="form-group"> + <label class="group-name" for="passwordPlain"><?php echo _t('gen.auth.password'); ?></label> + <div class="group-controls"> + <input type="password" id="passwordPlain" required="required" /> + <input type="hidden" id="challenge" name="challenge" /><br /> + <noscript><strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <?php + $redirect_url = urlencode(Minz_Url::display( + array('c' => 'user', 'a' => 'profile'), + 'php', true + )); + ?> + <input type="hidden" name="r" value="<?php echo $redirect_url; ?>" /> + <input type="hidden" name="username" id="username" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" /> + <button type="submit" class="btn btn-attention confirm"><?php echo _t('gen.action.remove'); ?></button> + </div> + </div> + </form> + <?php } ?> </div> diff --git a/cli/.htaccess b/cli/.htaccess new file mode 100644 index 000000000..9e768397d --- /dev/null +++ b/cli/.htaccess @@ -0,0 +1,3 @@ +Order Allow,Deny +Deny from all +Satisfy all diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 000000000..b7e8ac7f5 --- /dev/null +++ b/cli/README.md @@ -0,0 +1,103 @@ +* Back to [main read-me](../README.md) + +# FreshRSS Command-Line Interface (CLI) + +## Note on access rights + +When using the command-line interface, remember that your user might not be the same as the one used by your Web server. +This might create some access right problems. + +It is recommended to invoke commands using the same user as your Web server: + +```sh +cd /usr/share/FreshRSS +sudo -u www-data sh -c './cli/list-users.php' +``` + +In any case, when you are done with a series of commands, you should re-apply the access rights: + +```sh +cd /usr/share/FreshRSS +sudo chown -R :www-data . +sudo chmod -R g+r . +sudo chmod -R g+w ./data/ +``` + + +## Commands + +Options in parenthesis are optional. + + +```sh +cd /usr/share/FreshRSS + +./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net/ --language en --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss ) +# --auth_type can be: 'form' (default), 'http_auth' (using the Web server access control), 'none' (dangerous) +# --db-type can be: 'sqlite' (default), 'mysql' (MySQL or MariaDB), 'pgsql' (PostgreSQL) +# --environment can be: 'production' (default), 'development' (for additional log messages) +# --language can be: 'en' (default), 'fr', or one of the [supported languages](../app/i18n/) +# --db-prefix is an optional prefix in front of the names of the tables. We suggest using 'freshrss_' +# This command does not create the default user. Do that with ./cli/create-user.php + +./cli/reconfigure.php +# Same parameters as for do-install.php. Used to update an existing installation. + +./cli/create-user.php --user username ( --password 'password' --api_password 'api_password' --language en --email user@example.net --token 'longRandomString' --no_default_feeds --purge_after_months 3 --feed_min_articles_default 50 --feed_ttl_default 3600 --since_hours_posts_per_rss 168 --min_posts_per_rss 2 --max_posts_per_rss 400 ) +# --language can be: 'en' (default), 'fr', or one of the [supported languages](../app/i18n/) + +./cli/update-user.php --user username ( ... ) +# Same options as create-user.php, except --no_default_feeds which is only available for create-user.php + +./cli/delete-user.php --user username + +./cli/list-users.php +# Return a list of users, with the default/admin user first + +./cli/actualize-user.php --user username + +./cli/import-for-user.php --user username --filename /path/to/file.ext +# The extension of the file { .json, .opml, .xml, .zip } is used to detect the type of import + +./cli/export-opml-for-user.php --user username > /path/to/file.opml.xml + +./cli/export-zip-for-user.php --user username ( --max-feed-entries 100 ) > /path/to/file.zip + +./cli/user-info.php -h --user username +# -h is to use a human-readable format +# --user can be a username, or '*' to loop on all users +# Returns: 1) a * iff the user is admin, 2) the name of the user, +# 3) the date/time of last user action, 4) the size occupied, +# and the number of: 5) categories, 6) feeds, 7) read articles, 8) unread articles, and 9) favourites + +./cli/db-optimize.php --user username +# Optimize database (reduces the size) for a given user (perform `OPTIMIZE TABLE` in MySQL, `VACUUM` in SQLite) +``` + + +## Unix piping + +It is possible to invoke a command multiple times, e.g. with different usernames, thanks to the `xargs -n1` command. +Example showing user information for all users which username starts with 'a': + +```sh +./cli/list-users.php | grep '^a' | xargs -n1 ./cli/user-info.php -h --user +``` + +Example showing all users ranked by date of last activity: + +```sh +./cli/user-info.php -h --user '*' | sort -k2 -r +``` + +Example to get the number of feeds of a given user: + +```sh +./cli/user-info.php --user alex | cut -f6 +``` + + +# Install and updates + +If you want to administrate FreshRSS using git, please read our [installation docs](https://freshrss.github.io/FreshRSS/en/admins/02_Installation.html) +and [update guidelines](https://freshrss.github.io/FreshRSS/en/users/08_Updating.html).
\ No newline at end of file diff --git a/cli/_cli.php b/cli/_cli.php new file mode 100644 index 000000000..72629171c --- /dev/null +++ b/cli/_cli.php @@ -0,0 +1,66 @@ +<?php +if (php_sapi_name() !== 'cli') { + die('FreshRSS error: This PHP script may only be invoked from command line!'); +} + +require(__DIR__ . '/../constants.php'); +require(LIB_PATH . '/lib_rss.php'); +require(LIB_PATH . '/lib_install.php'); + +Minz_Configuration::register('system', + DATA_PATH . '/config.php', + FRESHRSS_PATH . '/config.default.php'); +FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); +Minz_Translate::init('en'); + +FreshRSS_Context::$isCli = true; + +function fail($message) { + fwrite(STDERR, $message . "\n"); + die(1); +} + +function cliInitUser($username) { + if (!FreshRSS_user_Controller::checkUsername($username)) { + fail('FreshRSS error: invalid username: ' . $username . "\n"); + } + + $usernames = listUsers(); + if (!in_array($username, $usernames)) { + fail('FreshRSS error: user not found: ' . $username . "\n"); + } + + FreshRSS_Context::$user_conf = get_user_configuration($username); + if (FreshRSS_Context::$user_conf == null) { + fail('FreshRSS error: invalid configuration for user: ' . $username . "\n"); + } + new Minz_ModelPdo($username); + + return $username; +} + +function accessRights() { + echo '• Remember to re-apply the appropriate access rights, such as:' , "\n", + "\t", 'sudo chown -R :www-data . && sudo chmod -R g+r . && sudo chmod -R g+w ./data/', "\n"; +} + +function done($ok = true) { + fwrite(STDERR, 'Result: ' . ($ok ? 'success' : 'fail') . "\n"); + exit($ok ? 0 : 1); +} + +function performRequirementCheck($databaseType) { + $requirements = checkRequirements($databaseType); + if ($requirements['all'] !== 'ok') { + $message = 'FreshRSS install failed requirements:' . "\n"; + foreach ($requirements as $requirement => $check) { + if ($check !== 'ok' && !in_array($requirement, array('all', 'pdo', 'message'))) { + $message .= '• ' . $requirement . "\n"; + } + } + if (!empty($requirements['message'])) { + $message .= '• ' . $requirements['message'] . "\n"; + } + fail($message); + } +} diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php new file mode 100644 index 000000000..a5960b58a --- /dev/null +++ b/cli/_update-or-create-user.php @@ -0,0 +1,56 @@ +<?php +require(__DIR__ . '/_cli.php'); + +$params = array( + 'user:', + 'password:', + 'api_password:', + 'language:', + 'email:', + 'token:', + 'purge_after_months:', + 'feed_min_articles_default:', + 'feed_ttl_default:', + 'since_hours_posts_per_rss:', + 'min_posts_per_rss:', + 'max_posts_per_rss:', + ); + +if (!$isUpdate) { + $params[] = 'no_default_feeds'; //Only for creating new users +} + +$options = getopt('', $params); + +if (empty($options['user'])) { + fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) . + " --user username ( --password 'password' --api_password 'api_password'" . + " --language en --email user@example.net --token 'longRandomString'" . + ($isUpdate ? '' : '--no_default_feeds') . + " --purge_after_months 3 --feed_min_articles_default 50 --feed_ttl_default 3600" . + " --since_hours_posts_per_rss 168 --min_posts_per_rss 2 --max_posts_per_rss 400 )"); +} + +function strParam($name) { + global $options; + return isset($options[$name]) ? strval($options[$name]) : null; +} + +function intParam($name) { + global $options; + return isset($options[$name]) && ctype_digit($options[$name]) ? intval($options[$name]) : null; +} + +$values = array( + 'language' => strParam('language'), + 'mail_login' => strParam('email'), + 'token' => strParam('token'), + 'old_entries' => intParam('purge_after_months'), + 'keep_history_default' => intParam('feed_min_articles_default'), + 'ttl_default' => intParam('feed_ttl_default'), + 'since_hours_posts_per_rss' => intParam('since_hours_posts_per_rss'), + 'min_posts_per_rss' => intParam('min_posts_per_rss'), + 'max_posts_per_rss' => intParam('max_posts_per_rss'), + ); + +$values = array_filter($values); diff --git a/cli/actualize-user.php b/cli/actualize-user.php new file mode 100755 index 000000000..dd07fc142 --- /dev/null +++ b/cli/actualize-user.php @@ -0,0 +1,23 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username"); +} + +$username = cliInitUser($options['user']); + +fwrite(STDERR, 'FreshRSS actualizing user “' . $username . "”…\n"); + +list($nbUpdatedFeeds, $feed, $nbNewArticles) = FreshRSS_feed_Controller::actualizeFeed(0, '', true); + +echo "FreshRSS actualized $nbUpdatedFeeds feeds for $username ($nbNewArticles new articles)\n"; + +invalidateHttpCache($username); + +done($nbUpdatedFeeds > 0); diff --git a/cli/check.translation.php b/cli/check.translation.php new file mode 100644 index 000000000..6ebd12973 --- /dev/null +++ b/cli/check.translation.php @@ -0,0 +1,106 @@ +<?php + +require_once __DIR__ . '/i18n/I18nFile.php'; +require_once __DIR__ . '/i18n/I18nCompletionValidator.php'; +require_once __DIR__ . '/i18n/I18nUsageValidator.php'; + +$i18nFile = new I18nFile(); +$i18nData = $i18nFile->load(); + +$options = getopt("dhl:r"); + +if (array_key_exists('h', $options)) { + help(); +} +if (array_key_exists('l', $options)) { + $languages = array($options['l']); +} else { + $languages = $i18nData->getAvailableLanguages(); +} +$displayResults = array_key_exists('d', $options); +$displayReport = array_key_exists('r', $options); + +$isValidated = true; +$result = array(); +$report = array(); + +foreach ($languages as $language) { + if ($language === $i18nData::REFERENCE_LANGUAGE) { + $i18nValidator = new I18nUsageValidator($i18nData->getReferenceLanguage(), findUsedTranslations()); + $isValidated = $i18nValidator->validate(include __DIR__ . '/i18n/ignore/' . $language . '.php') && $isValidated; + } else { + $i18nValidator = new I18nCompletionValidator($i18nData->getReferenceLanguage(), $i18nData->getLanguage($language)); + if (file_exists(__DIR__ . '/i18n/ignore/' . $language . '.php')) { + $isValidated = $i18nValidator->validate(include __DIR__ . '/i18n/ignore/' . $language . '.php') && $isValidated; + } else { + $isValidated = $i18nValidator->validate(null) && $isValidated; + } + } + + $report[$language] = sprintf('%-5s - %s', $language, $i18nValidator->displayReport()); + $result[$language] = $i18nValidator->displayResult(); +} + +if ($displayResults) { + foreach ($result as $lang => $value) { + echo 'Language: ', $lang, PHP_EOL; + print_r($value); + echo PHP_EOL; + } +} + +if ($displayReport) { + foreach ($report as $value) { + echo $value; + } +} + +if (!$isValidated) { + exit(1); +} + +/** + * Find used translation keys in the project + * + * Iterates through all php and phtml files in the whole project and extracts all + * translation keys used. + * + * @return array + */ +function findUsedTranslations() { + $directory = new RecursiveDirectoryIterator(__DIR__ . '/..'); + $iterator = new RecursiveIteratorIterator($directory); + $regex = new RegexIterator($iterator, '/^.+\.(php|phtml)$/i', RecursiveRegexIterator::GET_MATCH); + $usedI18n = array(); + foreach (array_keys(iterator_to_array($regex)) as $file) { + $fileContent = file_get_contents($file); + preg_match_all('/_t\([\'"](?P<strings>[^\'"]+)[\'"]/', $fileContent, $matches); + $usedI18n = array_merge($usedI18n, $matches['strings']); + } + return $usedI18n; +} + +/** + * Output help message. + */ +function help() { + $help = <<<HELP +NAME + %s + +SYNOPSIS + php %s [OPTION]... + +DESCRIPTION + Check if translation files have missing keys or missing translations. + + -d display results. + -h display this help and exit. + -l=LANG filter by LANG. + -r display completion report. + +HELP; + $file = str_replace(__DIR__ . '/', '', __FILE__); + echo sprintf($help, $file, $file); + exit; +} diff --git a/cli/create-user.php b/cli/create-user.php new file mode 100755 index 000000000..5bc6c1e6c --- /dev/null +++ b/cli/create-user.php @@ -0,0 +1,36 @@ +#!/usr/bin/php +<?php +$isUpdate = false; +require(__DIR__ . '/_update-or-create-user.php'); + +$username = $options['user']; +if (!FreshRSS_user_Controller::checkUsername($username)) { + fail('FreshRSS error: invalid username “' . $username . + '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN); +} + +$usernames = listUsers(); +if (preg_grep("/^$username$/i", $usernames)) { + fail('FreshRSS error: username already taken “' . $username . '”'); +} + +echo 'FreshRSS creating user “', $username, "”…\n"; + +$ok = FreshRSS_user_Controller::createUser($username, + empty($options['password']) ? '' : $options['password'], + empty($options['api_password']) ? '' : $options['api_password'], + $values, + !isset($options['no-default-feeds'])); + +if (!$ok) { + fail('FreshRSS could not create user!'); +} + +invalidateHttpCache(FreshRSS_Context::$system_conf->default_user); + +echo '• Remember to refresh the feeds of the user: ', $username , "\n", + "\t", './cli/actualize-user.php --user ', $username, "\n"; + +accessRights(); + +done($ok); diff --git a/cli/db-optimize.php b/cli/db-optimize.php new file mode 100755 index 000000000..39dc97638 --- /dev/null +++ b/cli/db-optimize.php @@ -0,0 +1,20 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username"); +} + +$username = cliInitUser($options['user']); + +echo 'FreshRSS optimizing database for user “', $username, "”…\n"; + +$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); +$ok = $databaseDAO->optimize(); + +done($ok); diff --git a/cli/delete-user.php b/cli/delete-user.php new file mode 100755 index 000000000..30cc31754 --- /dev/null +++ b/cli/delete-user.php @@ -0,0 +1,32 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username"); +} +$username = $options['user']; +if (!FreshRSS_user_Controller::checkUsername($username)) { + fail('FreshRSS error: invalid username “' . $username . '”'); +} + +$usernames = listUsers(); +if (!preg_grep("/^$username$/i", $usernames)) { + fail('FreshRSS error: username not found “' . $username . '”'); +} + +if (strcasecmp($username, FreshRSS_Context::$system_conf->default_user) === 0) { + fail('FreshRSS error: default user must not be deleted: “' . $username . '”'); +} + +echo 'FreshRSS deleting user “', $username, "”…\n"; + +$ok = FreshRSS_user_Controller::deleteUser($username); + +invalidateHttpCache(FreshRSS_Context::$system_conf->default_user); + +done($ok); diff --git a/cli/do-install.php b/cli/do-install.php new file mode 100755 index 000000000..4ebba0469 --- /dev/null +++ b/cli/do-install.php @@ -0,0 +1,100 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +if (!file_exists(DATA_PATH . '/do-install.txt')) { + fail('FreshRSS looks to be already installed! Please use `./cli/reconfigure.php` instead.'); +} + +$params = array( + 'environment:', + 'base_url:', + 'language:', + 'title:', + 'default_user:', + 'allow_anonymous', + 'allow_anonymous_refresh', + 'auth_type:', + 'api_enabled', + 'allow_robots', + 'disable_update', + ); + +$dBparams = array( + 'db-type:', + 'db-host:', + 'db-user:', + 'db-password:', + 'db-base:', + 'db-prefix:', + ); + +$options = getopt('', array_merge($params, $dBparams)); + +if (empty($options['default_user'])) { + fail('Usage: ' . basename(__FILE__) . " --default_user admin ( --auth_type form" . + " --environment production --base_url https://rss.example.net/" . + " --language en --title FreshRSS --allow_anonymous --api_enabled" . + " --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123" . + " --db-base freshrss --db-prefix freshrss_ --disable_update )"); +} + +fwrite(STDERR, 'FreshRSS install…' . "\n"); + +$config = array( + 'salt' => generateSalt(), + 'db' => FreshRSS_Context::$system_conf->db, + ); + +foreach ($params as $param) { + $param = rtrim($param, ':'); + if (isset($options[$param])) { + $config[$param] = $options[$param] === false ? true : $options[$param]; + } +} + +if ((!empty($config['base_url'])) && server_is_public($config['base_url'])) { + $config['pubsubhubbub_enabled'] = true; +} + +foreach ($dBparams as $dBparam) { + $dBparam = rtrim($dBparam, ':'); + if (isset($options[$dBparam])) { + $param = substr($dBparam, strlen('db-')); + $config['db'][$param] = $options[$dBparam]; + } +} + +performRequirementCheck($config['db']['type']); + +if (!FreshRSS_user_Controller::checkUsername($options['default_user'])) { + fail('FreshRSS error: invalid default username “' . $options['default_user'] + . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN); +} + +if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) { + fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }): ' + . $options['auth_type']); +} + +if (file_put_contents(join_path(DATA_PATH, 'config.php'), + "<?php\n return " . var_export($config, true) . ";\n") === false) { + fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php')); +} + +$config['db']['default_user'] = $config['default_user']; +if (!checkDb($config['db'])) { + @unlink(join_path(DATA_PATH, 'config.php')); + fail('FreshRSS database error: ' . (empty($config['db']['error']) ? 'Unknown error' : $config['db']['error'])); +} + +echo '• Remember to create the default user: ', $config['default_user'] , "\n", + "\t", './cli/create-user.php --user ', $config['default_user'], " --password 'password' --more-options\n"; + +accessRights(); + +if (!deleteInstall()) { + fail('FreshRSS access right problem while deleting install file!'); +} + +done(); diff --git a/cli/export-opml-for-user.php b/cli/export-opml-for-user.php new file mode 100755 index 000000000..fd0993c35 --- /dev/null +++ b/cli/export-opml-for-user.php @@ -0,0 +1,24 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username > /path/to/file.opml.xml"); +} + +$username = cliInitUser($options['user']); + +fwrite(STDERR, 'FreshRSS exporting OPML for user “' . $username . "”…\n"); + +$importController = new FreshRSS_importExport_Controller(); + +$ok = false; +$ok = $importController->exportFile(true, false, array(), 0, $username); + +invalidateHttpCache($username); + +done($ok); diff --git a/cli/export-zip-for-user.php b/cli/export-zip-for-user.php new file mode 100755 index 000000000..916ecbb45 --- /dev/null +++ b/cli/export-zip-for-user.php @@ -0,0 +1,30 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + 'max-feed-entries:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username ( --max-feed-entries 100 ) > /path/to/file.zip"); +} + +$username = cliInitUser($options['user']); + +fwrite(STDERR, 'FreshRSS exporting ZIP for user “' . $username . "”…\n"); + +$importController = new FreshRSS_importExport_Controller(); + +$ok = false; +try { + $ok = $importController->exportFile(true, true, true, + empty($options['max-feed-entries']) ? 100 : intval($options['max-feed-entries']), + $username); +} catch (FreshRSS_ZipMissing_Exception $zme) { + fail('FreshRSS error: Lacking php-zip extension!'); +} +invalidateHttpCache($username); + +done($ok); diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php new file mode 100644 index 000000000..2cb71acd5 --- /dev/null +++ b/cli/i18n/I18nCompletionValidator.php @@ -0,0 +1,49 @@ +<?php + +require_once __DIR__ . '/I18nValidatorInterface.php'; + +class I18nCompletionValidator implements I18nValidatorInterface { + + private $reference; + private $language; + private $totalEntries = 0; + private $passEntries = 0; + private $result = ''; + + public function __construct($reference, $language) { + $this->reference = $reference; + $this->language = $language; + } + + public function displayReport() { + return sprintf('Translation is %5.1f%% complete.', $this->passEntries / $this->totalEntries * 100) . PHP_EOL; + } + + public function displayResult() { + return $this->result; + } + + public function validate($ignore) { + foreach ($this->reference as $file => $data) { + foreach ($data as $key => $value) { + $this->totalEntries++; + if (is_array($ignore) && in_array($key, $ignore)) { + $this->passEntries++; + continue; + } + if (!array_key_exists($key, $this->language[$file])) { + $this->result .= sprintf('Missing key %s', $key) . PHP_EOL; + continue; + } + if ($value === $this->language[$file][$key]) { + $this->result .= sprintf('Untranslated key %s - %s', $key, $value) . PHP_EOL; + continue; + } + $this->passEntries++; + } + } + + return $this->totalEntries === $this->passEntries; + } + +} diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php new file mode 100644 index 000000000..cd8ba0765 --- /dev/null +++ b/cli/i18n/I18nData.php @@ -0,0 +1,118 @@ +<?php + +class I18nData { + + const REFERENCE_LANGUAGE = 'en'; + + private $data = array(); + private $originalData = array(); + + public function __construct($data) { + $this->data = $data; + $this->originalData = $data; + } + + public function getData() { + return $this->data; + } + + /** + * Return the available languages + * + * @return array + */ + public function getAvailableLanguages() { + $languages = array_keys($this->data); + sort($languages); + + return $languages; + } + + /** + * Add a new language. It's a copy of the reference language. + * + * @param string $language + */ + public function addLanguage($language) { + if (array_key_exists($language, $this->data)) { + throw new Exception('The selected language already exist.'); + } + $this->data[$language] = $this->data[static::REFERENCE_LANGUAGE]; + } + + /** + * Add a key in the reference language + * + * @param string $key + * @param string $value + */ + public function addKey($key, $value) { + if (array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { + throw new Exception('The selected key already exist.'); + } + $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)][$key] = $value; + } + + /** + * Duplicate a key from the reference language to all other languages + * + * @param string $key + */ + public function duplicateKey($key) { + if (!array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { + throw new Exception('The selected key does not exist.'); + } + $value = $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)][$key]; + foreach ($this->getAvailableLanguages() as $language) { + if (static::REFERENCE_LANGUAGE === $language) { + continue; + } + if (array_key_exists($key, $this->data[$language][$this->getFilenamePrefix($key)])) { + throw new Exception(sprintf('The selected key already exist in %s.', $language)); + } + $this->data[$language][$this->getFilenamePrefix($key)][$key] = $value; + } + } + + /** + * Remove a key in all languages + * + * @param string $key + */ + public function removeKey($key) { + if (!array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { + throw new Exception('The selected key does not exist.'); + } + foreach ($this->getAvailableLanguages() as $language) { + if (array_key_exists($key, $this->data[$language][$this->getFilenamePrefix($key)])) { + unset($this->data[$language][$this->getFilenamePrefix($key)][$key]); + } + } + } + + /** + * Check if the data has changed + * + * @return bool + */ + public function hasChanged() { + return $this->data !== $this->originalData; + } + + public function getLanguage($language) { + return $this->data[$language]; + } + + public function getReferenceLanguage() { + return $this->getLanguage(static::REFERENCE_LANGUAGE); + } + + /** + * @param string $key + * @return string + */ + private function getFilenamePrefix($key) { + return preg_replace('/\..*/', '.php', $key); + } + +} diff --git a/cli/i18n/I18nFile.php b/cli/i18n/I18nFile.php new file mode 100644 index 000000000..d6489ee21 --- /dev/null +++ b/cli/i18n/I18nFile.php @@ -0,0 +1,92 @@ +<?php + +require_once __DIR__ . '/I18nData.php'; + +class i18nFile { + + private $i18nPath; + + public function __construct() { + $this->i18nPath = __DIR__ . '/../../app/i18n'; + } + + public function load() { + $dirs = new DirectoryIterator($this->i18nPath); + foreach ($dirs as $dir) { + if ($dir->isDot()) { + continue; + } + $files = new DirectoryIterator($dir->getPathname()); + foreach ($files as $file) { + if (!$file->isFile()) { + continue; + } + $i18n[$dir->getFilename()][$file->getFilename()] = $this->flatten(include $file->getPathname(), $file->getBasename('.php')); + } + } + + return new I18nData($i18n); + } + + public function dump(I18nData $i18n) { + foreach ($i18n->getData() as $language => $file) { + $dir = $this->i18nPath . DIRECTORY_SEPARATOR . $language; + if (!file_exists($dir)) { + mkdir($dir); + } + foreach ($file as $name => $content) { + $filename = $dir . DIRECTORY_SEPARATOR . $name; + $fullContent = var_export($this->unflatten($content), true); + file_put_contents($filename, sprintf('<?php return %s;', $fullContent)); + } + } + } + + /** + * Flatten an array of translation + * + * @param array $translation + * @param string $prefix + * @return array + */ + private function flatten($translation, $prefix = '') { + $a = array(); + + if ('' !== $prefix) { + $prefix .= '.'; + } + + foreach ($translation as $key => $value) { + if (is_array($value)) { + $a += $this->flatten($value, $prefix . $key); + } else { + $a[$prefix . $key] = $value; + } + } + + return $a; + } + + /** + * Unflatten an array of translation + * + * The first key is dropped since it represents the filename and we have + * no use of it. + * + * @param array $translation + * @return array + */ + private function unflatten($translation) { + $a = array(); + + ksort($translation); + foreach ($translation as $compoundKey => $value) { + $keys = explode('.', $compoundKey); + array_shift($keys); + eval("\$a['" . implode("']['", $keys) . "'] = '" . $value . "';"); + } + + return $a; + } + +} diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php new file mode 100644 index 000000000..8ab934971 --- /dev/null +++ b/cli/i18n/I18nUsageValidator.php @@ -0,0 +1,47 @@ +<?php + +require_once __DIR__ . '/I18nValidatorInterface.php'; + +class I18nUsageValidator implements I18nValidatorInterface { + + private $code; + private $reference; + private $totalEntries = 0; + private $failedEntries = 0; + private $result = ''; + + public function __construct($reference, $code) { + $this->code = $code; + $this->reference = $reference; + } + + public function displayReport() { + return sprintf('%5.1f%% of translation keys are unused.', $this->failedEntries / $this->totalEntries * 100) . PHP_EOL; + } + + public function displayResult() { + return $this->result; + } + + public function validate($ignore) { + foreach ($this->reference as $file => $data) { + foreach ($data as $key => $value) { + $this->totalEntries++; + if (preg_match('/\._$/', $key) && in_array(preg_replace('/\._$/', '', $key), $this->code)) { + continue; + } + if (is_array($ignore) && in_array($key, $ignore)) { + continue; + } + if (!in_array($key, $this->code)) { + $this->result .= sprintf('Unused key %s - %s', $key, $value) . PHP_EOL; + $this->failedEntries++; + continue; + } + } + } + + return 0 === $this->failedEntries; + } + +} diff --git a/cli/i18n/I18nValidatorInterface.php b/cli/i18n/I18nValidatorInterface.php new file mode 100644 index 000000000..edfe7aac0 --- /dev/null +++ b/cli/i18n/I18nValidatorInterface.php @@ -0,0 +1,26 @@ +<?php + +interface I18nValidatorInterface { + + /** + * Display the validation result. + * Empty if there are no errors. + * + * @return array + */ + public function displayResult(); + + /** + * @param array $ignore Keys to ignore for validation + * @return bool + */ + public function validate($ignore); + + /** + * Display the validation report. + * + * @return array + */ + public function displayReport(); + +} diff --git a/cli/i18n/ignore/en.php b/cli/i18n/ignore/en.php new file mode 100644 index 000000000..e231afdda --- /dev/null +++ b/cli/i18n/ignore/en.php @@ -0,0 +1,105 @@ +<?php + +return array( + 'admin.check_install.cache.nok', + 'admin.check_install.cache.ok', + 'admin.check_install.categories.nok', + 'admin.check_install.categories.ok', + 'admin.check_install.connection.nok', + 'admin.check_install.connection.ok', + 'admin.check_install.ctype.nok', + 'admin.check_install.ctype.ok', + 'admin.check_install.curl.nok', + 'admin.check_install.curl.ok', + 'admin.check_install.data.nok', + 'admin.check_install.data.ok', + 'admin.check_install.dom.nok', + 'admin.check_install.dom.ok', + 'admin.check_install.entries.nok', + 'admin.check_install.entries.ok', + 'admin.check_install.favicons.nok', + 'admin.check_install.favicons.ok', + 'admin.check_install.feeds.nok', + 'admin.check_install.feeds.ok', + 'admin.check_install.fileinfo.nok', + 'admin.check_install.fileinfo.ok', + 'admin.check_install.json.nok', + 'admin.check_install.json.ok', + 'admin.check_install.minz.nok', + 'admin.check_install.minz.ok', + 'admin.check_install.pcre.nok', + 'admin.check_install.pcre.ok', + 'admin.check_install.pdo.nok', + 'admin.check_install.pdo.ok', + 'admin.check_install.php.nok', + 'admin.check_install.php.ok', + 'admin.check_install.tables.nok', + 'admin.check_install.tables.ok', + 'admin.check_install.tokens.nok', + 'admin.check_install.tokens.ok', + 'admin.check_install.users.nok', + 'admin.check_install.users.ok', + 'admin.check_install.zip.nok', + 'admin.check_install.zip.ok', + 'conf.query.get_all', + 'conf.query.get_category', + 'conf.query.get_favorite', + 'conf.query.get_feed', + 'conf.query.order_asc', + 'conf.query.order_desc', + 'conf.query.state_0', + 'conf.query.state_1', + 'conf.query.state_2', + 'conf.query.state_3', + 'conf.query.state_4', + 'conf.query.state_5', + 'conf.query.state_6', + 'conf.query.state_7', + 'conf.query.state_8', + 'conf.query.state_9', + 'conf.query.state_10', + 'conf.query.state_11', + 'conf.query.state_12', + 'conf.query.state_13', + 'conf.query.state_14', + 'conf.query.state_15', + 'conf.sharing.blogotext', + 'conf.sharing.diaspora', + 'conf.sharing.email', + 'conf.sharing.facebook', + 'conf.sharing.g+', + 'conf.sharing.print', + 'conf.sharing.shaarli', + 'conf.sharing.twitter', + 'conf.sharing.wallabag', + 'gen.lang.cz', + 'gen.lang.de', + 'gen.lang.en', + 'gen.lang.es', + 'gen.lang.fr', + 'gen.lang.it', + 'gen.lang.kr', + 'gen.lang.nl', + 'gen.lang.pt-br', + 'gen.lang.ru', + 'gen.lang.tr', + 'gen.lang.zh-cn', + 'gen.share.blogotext', + 'gen.share.diaspora', + 'gen.share.email', + 'gen.share.facebook', + 'gen.share.g+', + 'gen.share.movim', + 'gen.share.print', + 'gen.share.shaarli', + 'gen.share.twitter', + 'gen.share.wallabag', + 'gen.share.wallabagv2', + 'gen.share.jdh', + 'gen.share.Known', + 'gen.share.gnusocial', + 'index.menu.non-starred', + 'index.menu.read', + 'index.menu.starred', + 'index.menu.unread', +); diff --git a/cli/i18n/ignore/fr.php b/cli/i18n/ignore/fr.php new file mode 100644 index 000000000..0ac2e8758 --- /dev/null +++ b/cli/i18n/ignore/fr.php @@ -0,0 +1,55 @@ +<?php + +return array( + 'admin.extensions.title', + 'admin.stats.number_entries', + 'admin.user.articles_and_size', + 'conf.display.width.large', + 'conf.sharing.blogotext', + 'conf.sharing.diaspora', + 'conf.sharing.facebook', + 'conf.sharing.g+', + 'conf.sharing.print', + 'conf.sharing.shaarli', + 'conf.sharing.twitter', + 'conf.sharing.wallabag', + 'conf.shortcut.navigation', + 'conf.user.articles_and_size', + 'gen.freshrss._', + 'gen.lang.cz', + 'gen.lang.de', + 'gen.lang.en', + 'gen.lang.es', + 'gen.lang.fr', + 'gen.lang.it', + 'gen.lang.kr', + 'gen.lang.nl', + 'gen.lang.pt-br', + 'gen.lang.ru', + 'gen.lang.tr', + 'gen.lang.zh-cn', + 'gen.menu.admin', + 'gen.menu.configuration', + 'gen.menu.extensions', + 'gen.menu.logs', + 'gen.share.blogotext', + 'gen.share.diaspora', + 'gen.share.facebook', + 'gen.share.g+', + 'gen.share.movim', + 'gen.share.shaarli', + 'gen.share.twitter', + 'gen.share.wallabag', + 'gen.share.wallabagv2', + 'gen.share.jdh', + 'gen.share.gnusocial', + 'index.about.agpl3', + 'index.about.version', + 'index.log._', + 'index.log.title', + 'install.title', + 'install.this_is_the_end', + 'sub.bookmarklet.title', + 'sub.feed.description', + 'sub.feed.number_entries', +); diff --git a/cli/import-for-user.php b/cli/import-for-user.php new file mode 100755 index 000000000..95ff18c8c --- /dev/null +++ b/cli/import-for-user.php @@ -0,0 +1,35 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('', array( + 'user:', + 'filename:', + )); + +if (empty($options['user']) || empty($options['filename'])) { + fail('Usage: ' . basename(__FILE__) . " --user username --filename /path/to/file.ext"); +} + +$username = cliInitUser($options['user']); + +$filename = $options['filename']; +if (!is_readable($filename)) { + fail('FreshRSS error: file is not readable “' . $filename . '”'); +} + +echo 'FreshRSS importing ZIP/OPML/JSON for user “', $username, "”…\n"; + +$importController = new FreshRSS_importExport_Controller(); + +$ok = false; +try { + $ok = $importController->importFile($filename, $filename, $username); +} catch (FreshRSS_ZipMissing_Exception $zme) { + fail('FreshRSS error: Lacking php-zip extension!'); +} catch (FreshRSS_Zip_Exception $ze) { + fail('FreshRSS error: ZIP archive cannot be imported! Error code: ' . $ze->zipErrorCode()); +} +invalidateHttpCache($username); + +done($ok); diff --git a/data/persona/index.html b/cli/index.html index 85faaa37e..85faaa37e 100644 --- a/data/persona/index.html +++ b/cli/index.html diff --git a/cli/list-users.php b/cli/list-users.php new file mode 100755 index 000000000..758bbdb46 --- /dev/null +++ b/cli/list-users.php @@ -0,0 +1,15 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$users = listUsers(); +sort($users); +if (FreshRSS_Context::$system_conf->default_user !== '' + && in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) { + array_unshift($users, FreshRSS_Context::$system_conf->default_user); + $users = array_unique($users); +} + +foreach ($users as $user) { + echo $user, "\n"; +} diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php new file mode 100644 index 000000000..aace5723a --- /dev/null +++ b/cli/manipulate.translation.php @@ -0,0 +1,79 @@ +<?php + +$options = getopt("h"); + +if (array_key_exists('h', $options)) { + help(); +} + +if (1 === $argc || 4 < $argc) { + help(); +} + +require_once __DIR__ . '/i18n/I18nFile.php'; + +$i18nFile = new I18nFile(); +$i18nData = $i18nFile->load(); + +switch ($argv[1]) { + case 'add_language' : + $i18nData->addLanguage($argv[2]); + break; + case 'add_key' : + if (3 === $argc) { + help(); + } + $i18nData->addKey($argv[2], $argv[3]); + break; + case 'duplicate_key' : + $i18nData->duplicateKey($argv[2]); + break; + case 'delete_key' : + $i18nData->removeKey($argv[2]); + break; + default : + help(); +} + +if ($i18nData->hasChanged()) { + $i18nFile->dump($i18nData); +} + +/** + * Output help message. + */ +function help() { + $help = <<<HELP +NAME + %s + +SYNOPSIS + php %s [OPTION] [OPERATION] [KEY] [VALUE] + +DESCRIPTION + Manipulate translation files. Available operations are + Check if translation files have missing keys or missing translations. + + -h display this help and exit. + +OPERATION + add_language + add a new language by duplicating the referential. This operation + needs only a KEY. + + add_key add a new key in the referential. This operation needs a KEY and + a VALUE. + + duplicate_key + duplicate a referential key in other languages. This operation + needs only a KEY. + + delete_key + delete a referential key from all languages. This operation needs + only a KEY. + +HELP; + $file = str_replace(__DIR__ . '/', '', __FILE__); + echo sprintf($help, $file, $file); + exit; +} diff --git a/cli/reconfigure.php b/cli/reconfigure.php new file mode 100755 index 000000000..cfe713fa8 --- /dev/null +++ b/cli/reconfigure.php @@ -0,0 +1,60 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$params = array( + 'environment:', + 'base_url:', + 'language:', + 'title:', + 'default_user:', + 'allow_anonymous', + 'allow_anonymous_refresh', + 'auth_type:', + 'api_enabled', + 'allow_robots', + 'disable_update', + ); + +$dBparams = array( + 'db-type:', + 'db-host:', + 'db-user:', + 'db-password:', + 'db-base:', + 'db-prefix:', + ); + +$options = getopt('', array_merge($params, $dBparams)); + +fwrite(STDERR, 'Reconfiguring FreshRSS…' . "\n"); + +$config = Minz_Configuration::get('system'); +foreach ($params as $param) { + $param = rtrim($param, ':'); + if (isset($options[$param])) { + $config->$param = $options[$param] === false ? true : $options[$param]; + } +} +$db = $config->db; +foreach ($dBparams as $dBparam) { + $dBparam = rtrim($dBparam, ':'); + if (isset($options[$dBparam])) { + $param = substr($dBparam, strlen('db-')); + $db[$param] = $options[$dBparam]; + } +} +$config->db = $db; + +if (!FreshRSS_user_Controller::checkUsername($config->default_user)) { + fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $config->default_user); +} + +if (isset($config->auth_type) && !in_array($config->auth_type, array('form', 'http_auth', 'none'))) { + fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' + . $config->auth_type); +} + +$config->save(); + +done(); diff --git a/cli/update-user.php b/cli/update-user.php new file mode 100755 index 000000000..4529b8531 --- /dev/null +++ b/cli/update-user.php @@ -0,0 +1,23 @@ +#!/usr/bin/php +<?php +$isUpdate = true; +require(__DIR__ . '/_update-or-create-user.php'); + +$username = cliInitUser($options['user']); + +echo 'FreshRSS updating user “', $username, "”…\n"; + +$ok = FreshRSS_user_Controller::updateContextUser( + empty($options['password']) ? '' : $options['password'], + empty($options['api_password']) ? '' : $options['api_password'], + $values); + +if (!$ok) { + fail('FreshRSS could not update user!'); +} + +invalidateHttpCache($username); + +accessRights(); + +done($ok); diff --git a/cli/user-info.php b/cli/user-info.php new file mode 100755 index 000000000..18a415217 --- /dev/null +++ b/cli/user-info.php @@ -0,0 +1,50 @@ +#!/usr/bin/php +<?php +require(__DIR__ . '/_cli.php'); + +$options = getopt('h', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " -h --user username"); +} + +$users = $options['user'] === '*' ? listUsers() : array($options['user']); + +foreach ($users as $username) { + $username = cliInitUser($username); + echo $username === FreshRSS_Context::$system_conf->default_user ? '*' : ' ', "\t"; + + $catDAO = new FreshRSS_CategoryDAO(); + $feedDAO = FreshRSS_Factory::createFeedDao($username); + $entryDAO = FreshRSS_Factory::createEntryDao($username); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); + + $nbEntries = $entryDAO->countUnreadRead(); + $nbFavorites = $entryDAO->countUnreadReadFavorites(); + + if (isset($options['h'])) { //Human format + echo + $username, "\t", + date('c', FreshRSS_UserDAO::mtime($username)), "\t", + format_bytes($databaseDAO->size()), "\t", + $catDAO->count(), " categories\t", + count($feedDAO->listFeedsIds()), " feeds\t", + $nbEntries['read'], " reads\t", + $nbEntries['unread'], " unreads\t", + $nbFavorites['all'], " favourites\t", + "\n"; + } else { + echo + $username, "\t", + FreshRSS_UserDAO::mtime($username), "\t", + $databaseDAO->size(), "\t", + $catDAO->count(), "\t", + count($feedDAO->listFeedsIds()), "\t", + $nbEntries['read'], "\t", + $nbEntries['unread'], "\t", + $nbFavorites['all'], "\t", + "\n"; + } +} diff --git a/data/users/_/config.default.php b/config-user.default.php index 6d3f73a13..40ab49570 100644 --- a/data/users/_/config.default.php +++ b/config-user.default.php @@ -3,13 +3,16 @@ return array ( 'language' => 'en', 'old_entries' => 3, - 'keep_history_default' => 0, + 'keep_history_default' => 50, 'ttl_default' => 3600, 'mail_login' => '', 'token' => '', 'passwordHash' => '', 'apiPasswordHash' => '', 'posts_per_page' => 20, + 'since_hours_posts_per_rss' => 168, + 'min_posts_per_rss' => 2, + 'max_posts_per_rss' => 400, 'view_mode' => 'normal', 'default_view' => 'adaptive', 'default_state' => FreshRSS_Entry::STATE_NOT_READ, @@ -19,15 +22,21 @@ return array ( 'hide_read_feeds' => true, 'onread_jump_next' => true, 'lazyload' => true, + 'sides_close_article' => true, 'sticky_post' => true, 'reading_confirm' => false, 'auto_remove_article' => false, + + # In the case an article has changed (e.g. updated content): + # Set to `true` to mark it unread, or `false` to leave it as-is. + 'mark_updated_article_unread' => false, //TODO: -1 => ignore, 0 => update, 1 => update and mark as unread + 'sort_order' => 'DESC', 'anon_access' => false, 'mark_when' => array ( 'article' => true, 'site' => true, - 'scroll' => false, + 'scroll' => true, 'reception' => false, ), 'theme' => 'Origine', diff --git a/config.default.php b/config.default.php new file mode 100644 index 000000000..4e4c97e67 --- /dev/null +++ b/config.default.php @@ -0,0 +1,152 @@ +<?php + +# Do not modify this file, which defines default values, +# but edit `config.php` instead, after the install process is completed. +return array( + + # Set to `development` to get additional error messages, + # or to `production` to get only the most important messages. + 'environment' => 'production', + + # Used to make crypto more unique. Generated during install. + 'salt' => '', + + # Specify address of the FreshRSS instance, + # used when building absolute URLs, e.g. for PubSubHubbub. + # Examples: + # https://example.net/FreshRSS/p/ + # https://freshrss.example.net/ + 'base_url' => '', + + # Specify address of the FreshRSS auto-update server. + 'auto_update_url' => 'https://update.freshrss.org', + + # Natural language of the user interface, e.g. `en`, `fr`. + 'language' => 'en', + + # Title of this FreshRSS instance in the Web user interface. + 'title' => 'FreshRSS', + + # Meta description used when `allow_robots` is true. + 'meta_description' => '', + + # Name of the user that has administration rights. + 'default_user' => '_', + + # Allow or not visitors without login to see the articles + # of the default user. + 'allow_anonymous' => false, + + # Allow or not anonymous users to start the refresh process. + 'allow_anonymous_refresh' => false, + + # Login method: + # `none` is without password and shows only the default user; + # `form` is a conventional Web login form; + # `http_auth` is an access controled by the HTTP Web server (e.g. `/FreshRSS/p/i/.htaccess` for Apache) + # if you use `http_auth`, remember to protect only `/FreshRSS/p/i/`, + # and in particular not protect `/FreshRSS/p/api/` if you would like to use the API (different login system). + 'auth_type' => 'form', + + # Allow or not the use of the API, used for mobile apps. + # End-point is https://freshrss.example.net/api/greader.php + # You need to set the user's API password. + 'api_enabled' => false, + + # Allow or not the use of an unsafe login, + # by providing username and password in the login URL: + # http://example.net/FreshRSS/p/i/?c=auth&a=login&u=alice&p=1234 + 'unsafe_autologin_enabled' => false, + + # Enable or not the use of syslog to log the activity of + # SimplePie, which is retrieving RSS feeds via HTTP requests. + 'simplepie_syslog_enabled' => true, + + # Enable or not support of PubSubHubbub. + # /!\ It should NOT be enabled if base_url is not reachable by an external server. + 'pubsubhubbub_enabled' => false, + + # Allow or not Web robots (e.g. search engines) in HTML headers. + 'allow_robots' => false, + + # If true does nothing, if false restricts HTTP Referer via: meta referrer origin + 'allow_referrer' => false, + + 'limits' => array( + + # Duration in seconds of the login cookie. + 'cookie_duration' => 2592000, + + # Duration in seconds of the SimplePie cache, + # during which a query to the RSS feed will return the local cached version. + # Especially important for multi-user setups. + 'cache_duration' => 800, + + # SimplePie HTTP request timeout in seconds. + 'timeout' => 15, + + # If a user has not used FreshRSS for more than x seconds, + # then its feeds are not refreshed anymore. + 'max_inactivity' => PHP_INT_MAX, + + # Max number of feeds for a user. + 'max_feeds' => 16384, + + # Max number of categories for a user. + 'max_categories' => 16384, + + # Max number of accounts that anonymous users can create + # 0 for an unlimited number of accounts + # 1 is to not allow user registrations (1 is corresponding to the admin account) + 'max_registrations' => 1, + ), + + # Options used by cURL when making HTTP requests, e.g. when the SimplePie library retrieves feeds. + # http://php.net/manual/function.curl-setopt + 'curl_options' => array( + # Options to disable SSL/TLS certificate check (e.g. for self-signed HTTPS) + //CURLOPT_SSL_VERIFYHOST => 0, + //CURLOPT_SSL_VERIFYPEER => false, + + # Options to use a proxy for retrieving feeds. + //CURLOPT_PROXYTYPE => CURLPROXY_HTTP, + //CURLOPT_PROXY => '127.0.0.1', + //CURLOPT_PROXYPORT => 8080, + //CURLOPT_PROXYAUTH => CURLAUTH_BASIC, + //CURLOPT_PROXYUSERPWD => 'user:password', + ), + + 'db' => array( + + # Type of database: `sqlite` or `mysql`. + 'type' => 'sqlite', + + # MySQL host. + 'host' => 'localhost', + + # MySQL user. + 'user' => '', + + # MySQL password. + 'password' => '', + + # MySQL database. + 'base' => '', + + # MySQL table prefix. + 'prefix' => 'freshrss_', + + 'pdo_options' => array( + //PDO::MYSQL_ATTR_SSL_KEY => '/path/to/client-key.pem', + //PDO::MYSQL_ATTR_SSL_CERT => '/path/to/client-cert.pem', + //PDO::MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem', + ), + + ), + + # List of enabled FreshRSS extensions. + 'extensions_enabled' => array(), + + # Disable self-update, + 'disable_update' => false, +); diff --git a/constants.php b/constants.php index b20bf0710..576be09b9 100644 --- a/constants.php +++ b/constants.php @@ -1,23 +1,32 @@ <?php -define('FRESHRSS_VERSION', '1.2-dev'); -define('FRESHRSS_WEBSITE', 'http://freshrss.org'); -define('FRESHRSS_UPDATE_WEBSITE', 'https://update.freshrss.org?v=' . FRESHRSS_VERSION); -define('FRESHRSS_WIKI', 'http://doc.freshrss.org'); +define('FRESHRSS_VERSION', '1.8.1-dev'); +define('FRESHRSS_WEBSITE', 'https://freshrss.org'); +define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/'); + +define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')'); // PHP text output compression http://php.net/ob_gzhandler (better to do it at Web server level) define('PHP_COMPRESSION', false); +// Maximum log file size in Bytes, before it will be divided by two +define('MAX_LOG_SIZE', 1048576); + // Constantes de chemins define('FRESHRSS_PATH', dirname(__FILE__)); define('PUBLIC_PATH', FRESHRSS_PATH . '/p'); - define('INDEX_PATH', PUBLIC_PATH . '/i'); + define('PUBLIC_TO_INDEX_PATH', '/i'); + define('INDEX_PATH', PUBLIC_PATH . PUBLIC_TO_INDEX_PATH); define('PUBLIC_RELATIVE', '..'); define('DATA_PATH', FRESHRSS_PATH . '/data'); define('UPDATE_FILENAME', DATA_PATH . '/update.php'); define('USERS_PATH', DATA_PATH . '/users'); + define('ADMIN_LOG', USERS_PATH . '/_/log.txt'); + define('API_LOG', USERS_PATH . '/_/log_api.txt'); define('CACHE_PATH', DATA_PATH . '/cache'); + define('PSHB_LOG', USERS_PATH . '/_/log_pshb.txt'); + define('PSHB_PATH', DATA_PATH . '/PubSubHubbub'); define('LIB_PATH', FRESHRSS_PATH . '/lib'); define('APP_PATH', FRESHRSS_PATH . '/app'); diff --git a/data/.gitignore b/data/.gitignore index 20364e266..76314fc12 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,9 +1,6 @@ -application.ini config.php -*.sqlite -touch.txt -no-cache.txt -*.bak.php -*.lock.txt +config.php.bak.php +force-https.txt last_update.txt +no-cache.txt update.php diff --git a/data/PubSubHubbub/feeds/.gitignore b/data/PubSubHubbub/feeds/.gitignore new file mode 100644 index 000000000..d8f9df042 --- /dev/null +++ b/data/PubSubHubbub/feeds/.gitignore @@ -0,0 +1,3 @@ +*/ +*/*.json +*/*.txt diff --git a/data/PubSubHubbub/feeds/README.md b/data/PubSubHubbub/feeds/README.md new file mode 100644 index 000000000..a01a3197f --- /dev/null +++ b/data/PubSubHubbub/feeds/README.md @@ -0,0 +1,7 @@ +List of canonical URLS of the various feeds users have subscribed to. +Several users can have subscribed to the same feed. + +* ./base64url(canonicalUrl)/ + * ./!hub.json + * ./user1.txt + * ./user2.txt diff --git a/data/PubSubHubbub/keys/.gitignore b/data/PubSubHubbub/keys/.gitignore new file mode 100644 index 000000000..2211df63d --- /dev/null +++ b/data/PubSubHubbub/keys/.gitignore @@ -0,0 +1 @@ +*.txt diff --git a/data/PubSubHubbub/keys/README.md b/data/PubSubHubbub/keys/README.md new file mode 100644 index 000000000..bb1e57cd4 --- /dev/null +++ b/data/PubSubHubbub/keys/README.md @@ -0,0 +1,4 @@ +List of keys given to PubSubHubbub hubs + +* ./sha1(random + salt).txt + * base64url(canonicalUrl) diff --git a/data/config.default.php b/data/config.default.php deleted file mode 100644 index 97df3a299..000000000 --- a/data/config.default.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -return array( - 'environment' => 'production', - 'salt' => '', - 'base_url' => '', - 'language' => 'en', - 'title' => 'FreshRSS', - 'default_user' => '_', - 'allow_anonymous' => false, - 'allow_anonymous_refresh' => false, - 'auth_type' => 'none', - 'api_enabled' => false, - 'unsafe_autologin_enabled' => false, - 'limits' => array( - 'cache_duration' => 800, - 'timeout' => 10, - 'max_inactivity' => PHP_INT_MAX, - 'max_feeds' => 16384, - 'max_categories' => 16384, - ), - 'db' => array( - 'type' => 'sqlite', - 'host' => '', - 'user' => '', - 'password' => '', - 'base' => '', - 'prefix' => '', - ), - 'extensions_enabled' => array(), -); diff --git a/data/extensions-data/.gitignore b/data/extensions-data/.gitignore new file mode 100644 index 000000000..0a00d7014 --- /dev/null +++ b/data/extensions-data/.gitignore @@ -0,0 +1 @@ +*/
\ No newline at end of file diff --git a/data/extensions-data/index.html b/data/extensions-data/index.html new file mode 100644 index 000000000..85faaa37e --- /dev/null +++ b/data/extensions-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/persona/.gitignore b/data/persona/.gitignore deleted file mode 100644 index 314f02b1b..000000000 --- a/data/persona/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.txt
\ No newline at end of file diff --git a/data/shares.php b/data/shares.php index 6e0e9ea0c..5403fd48c 100644 --- a/data/shares.php +++ b/data/shares.php @@ -4,7 +4,7 @@ * This is a configuration file. You shouldn't modify it unless you know what * you are doing. If you want to add a share type, this is where you need to do * it. - * + * * For each share there is different configuration options. Here is the description * of those options: * - url is a mandatory option. It is a string representing the share URL. It @@ -14,6 +14,10 @@ * The ~TITLE~ placeholder represents the title of the shared article. * - transform is an array of transformation to apply on links and titles * - help is a URL to a help page + * - form is the type of form to display during configuration. It's either + * 'simple' or 'advanced'. 'simple' is used when only the name is configurable, + * 'advanced' is used when the name and the location are configurable. + * - method is the HTTP method (POST or GET) used to share a link. */ return array( @@ -22,12 +26,14 @@ return array( 'transform' => array('rawurlencode'), 'help' => 'http://sebsauvage.net/wiki/doku.php?id=php:shaarli', 'form' => 'advanced', + 'method' => 'GET', ), 'blogotext' => array( 'url' => '~URL~/admin/links.php?url=~LINK~', 'transform' => array(), 'help' => 'http://lehollandaisvolant.net/blogotext/fr/', 'form' => 'advanced', + 'method' => 'GET', ), 'wallabag' => array( 'url' => '~URL~?action=add&url=~LINK~', @@ -37,36 +43,87 @@ return array( ), 'help' => 'http://www.wallabag.org/', 'form' => 'advanced', + 'method' => 'GET', + ), + 'wallabagv2' => array( + 'url' => '~URL~/bookmarklet?url=~LINK~', + 'transform' => array( + 'link' => array('rawurlencode'), + 'title' => array(), + ), + 'help' => 'http://www.wallabag.org/', + 'form' => 'advanced', + 'method' => 'GET', ), 'diaspora' => array( 'url' => '~URL~/bookmarklet?url=~LINK~&title=~TITLE~', 'transform' => array('rawurlencode'), 'help' => 'https://diasporafoundation.org/', 'form' => 'advanced', + 'method' => 'GET', + ), + 'movim' => array( + 'url' => '~URL~/?share/~LINK~', + 'transform' => array('rawurlencode', 'urlencode'), + 'help' => 'https://github.com/edhelas/movim', + 'form' => 'advanced', + 'method' => 'GET', ), 'twitter' => array( 'url' => 'https://twitter.com/share?url=~LINK~&text=~TITLE~', 'transform' => array('rawurlencode'), 'form' => 'simple', + 'method' => 'GET', ), 'g+' => array( 'url' => 'https://plus.google.com/share?url=~LINK~', 'transform' => array('rawurlencode'), 'form' => 'simple', + 'method' => 'GET', ), 'facebook' => array( 'url' => 'https://www.facebook.com/sharer.php?u=~LINK~&t=~TITLE~', 'transform' => array('rawurlencode'), 'form' => 'simple', + 'method' => 'GET', ), 'email' => array( 'url' => 'mailto:?subject=~TITLE~&body=~LINK~', 'transform' => array('rawurlencode'), 'form' => 'simple', + 'method' => 'GET', ), 'print' => array( 'url' => '#', 'transform' => array(), 'form' => 'simple', + 'method' => 'GET', + ), + 'jdh' => array( + 'url' => 'https://www.journalduhacker.net/stories/new?url=~LINK~&title=~TITLE~', + 'transform' => array('rawurlencode'), + 'form' => 'simple', + 'method' => 'GET', + ), + 'Known' => array( + 'url' => '~URL~/share?share_url=~LINK~&share_title=~TITLE~', + 'transform' => array('rawurlencode'), + 'help' => 'https://withknown.com/', + 'form' => 'advanced', + 'method' => 'GET', + ), + 'gnusocial' => array( + 'url' => '~URL~/notice/new?content=~TITLE~%20~LINK~', + 'transform' => array('urlencode'), + 'help' => 'https://gnu.io/social/', + 'form' => 'advanced', + 'method' => 'GET', + ), + 'mastodon' => array( + 'url' => '~URL~/api/v1/statuses', + 'transform' => array(), + 'form' => 'advanced', + 'method' => 'POST', + 'field' => 'status', ), ); diff --git a/data/users/.gitignore b/data/users/.gitignore index a8b7cd60f..3705c06b7 100644 --- a/data/users/.gitignore +++ b/data/users/.gitignore @@ -1,4 +1,5 @@ -db.sqlite -config.php -log*.txt - +*/ +*/config.php +*/db.sqlite +!_/ +*/log*.txt diff --git a/data/users/_/.gitignore b/data/users/_/.gitignore new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/data/users/_/.gitignore diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 000000000..639517aa0 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,6 @@ +theme: jekyll-theme-cayman +title: FreshRSS +description: Documentation center + +logo: /img/FreshRSS-logo.png +show_downloads: true diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 000000000..9e30b6eae --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<html lang="{{ site.lang | default: "en-US" }}"> + <head> + <meta charset="UTF-8"> + <title>{{ page.title | default: site.title }}</title> + <meta name="description" content="{{ page.description | default: site.description | default: site.github.project_tagline }}"/> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="theme-color" content="#157878"> + <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> + <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> + </head> + <body> + <section class="page-header"> + <h1 class="project-name"> + <a href="{{ site.github.url }}">{{ site.title | default: site.github.repository_name }}</a> + </h1> + <h2 class="project-tagline">{{ site.description | default: site.github.project_tagline }}</h2> + {% if site.github.is_project_page %} + <a href="{{ site.github.repository_url }}" class="btn">View on GitHub</a> + {% endif %} + {% if site.show_downloads %} + <a href="{{ site.github.zip_url }}" class="btn">Download .zip</a> + <a href="{{ site.github.tar_url }}" class="btn">Download .tar.gz</a> + {% endif %} + </section> + + <section class="main-content"> + {{ content }} + + <footer class="site-footer"> + {% if site.github.is_project_page %} + <span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name }}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span> + {% endif %} + <span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span> + </footer> + </section> + + {% if site.google_analytics %} + <script type="text/javascript"> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', '{{ site.google_analytics }}', 'auto'); + ga('send', 'pageview'); + </script> + {% endif %} + </body> +</html> diff --git a/docs/assets/css/style.scss b/docs/assets/css/style.scss new file mode 100644 index 000000000..f7fff902b --- /dev/null +++ b/docs/assets/css/style.scss @@ -0,0 +1,13 @@ +--- +--- + +@import "{{ site.theme }}"; + +.page-header .project-name a { + color: #fff; + + &:hover { + text-decoration: none; + opacity: .7; + } +} diff --git a/docs/en/admins/01_Index.md b/docs/en/admins/01_Index.md new file mode 100644 index 000000000..446780060 --- /dev/null +++ b/docs/en/admins/01_Index.md @@ -0,0 +1,8 @@ +# FreshRSS administration + +Learn how to install, update and backup FreshRSS and how to use the command line tools. + +* [Install FreshRSS](02_Installation.md) on your server +* [Update your installation](03_Updating.md) to the latest stable or dev version +* [The command line interface](https://github.com/FreshRSS/FreshRSS/tree/master/cli) can be used to administrate feeds and users +* [Automatic feed updates](https://github.com/FreshRSS/FreshRSS#automatic-feed-update) using cron is the preferred way to get the latest feeds entries diff --git a/docs/en/admins/02_Installation.md b/docs/en/admins/02_Installation.md new file mode 100644 index 000000000..ef6531bd0 --- /dev/null +++ b/docs/en/admins/02_Installation.md @@ -0,0 +1,147 @@ +# Server requirements + +FreshRSS is a web application. This means you’ll need a web server to run it. FreshRSS requirements are really low, so it could run on most shared host servers. + +You need to verify that your server can run FreshRSS before installing it. If your server has the proper requirements and FreshRSS does not work, please contact us to find a solution. + +| Software | Recommended | Works also with | +| ----------- | ---------------- | ----------------------------- | +| Web server | **Apache 2** | Nginx | +| PHP | **PHP 5.5+** | PHP 5.3.8+ | +| PHP modules | Required: libxml, cURL, PDO_MySQL, PCRE and ctype. \\ Required (32-bit only): GMP \\Recommanded: JSON, Zlib, mbstring, iconv, ZipArchive | | +| Database | **MySQL 5.0.3+** | SQLite 3.7.4+ | +| Browser | **Firefox** | Chrome, Opera, Safari, or IE11+ | + +## Important notice + +FreshRSS **CAN** work with PHP 5.3.8+. To do so, we are using specific functions available in the [''password_compat'' library](https://github.com/ircmaxell/password_compat#requirements) for the form authentication. + + +# Getting the appropriate version of FreshRSS + +FreshRSS has three different releases or branches. Each branch has its own release frequency. So it is better if you spend some time to understand the purpose of each release. + +## Stable release + +[Download](https://github.com/FreshRSS/FreshRSS/archive/master.zip) + +This release is done when we consider that our goal concerning the new features and the stability is reached. It could happen that we make two releases in a really short time if we have a really good coding pace. In reality, we are all working on our spare time, so we release every few months. But this version is really stable, tested thoroughly and you should not face any major bugs. + +## Development release + +[Download](https://github.com/FreshRSS/FreshRSS/archive/dev.zip) + +As its name suggests, it is the working release for developers. **This release is unstable!** If you want to keep track of enhancements on a daily basis, you can use it. But keep in mind that you need to follow the branch activity on Github (via [the branch RSS feed](https://github.com/FreshRSS/FreshRSS/commits/dev.atom) for instance). Some say that the main developers use it on a daily basis without problem. They may know what they are doing… + +# Apache installation + +This is an example Apache virtual hosts configuration file. It covers HTTP and HTTPS configuration. + +``` +<VirtualHost *:80> + DocumentRoot /var/www/html/ + + #Default site... + + ErrorLog ${APACHE_LOG_DIR}/error.default.log + CustomLog ${APACHE_LOG_DIR}/access.default.log vhost_combined +</VirtualHost> + +<VirtualHost *:80> + ServerName rss.example.net + DocumentRoot /path/to/FreshRSS/p/ + + <Directory /path/to/FreshRSS/p> + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted + </Directory> + + ErrorLog ${APACHE_LOG_DIR}/freshrss_error.log + CustomLog ${APACHE_LOG_DIR}/freshrss_access.log combined + + AllowEncodedSlashes On +</VirtualHost> + +<IfModule mod_ssl.c> + <VirtualHost *:443> + ServerName rss.example.net + DocumentRoot /path/to/FreshRSS/p/ + + <Directory /path/to/FreshRSS/p> + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted + </Directory> + + ErrorLog ${APACHE_LOG_DIR}/freshrss_error.log + CustomLog ${APACHE_LOG_DIR}/freshrss_access.log combined + + <IfModule mod_http2.c> + Protocols h2 http/1.1 + </IfModule> + + # For the API + AllowEncodedSlashes On + + SSLEngine on + SSLCompression off + SSLCertificateFile /path/to/server.crt + SSLCertificateKeyFile /path/to/server.key + # Additional SSL configuration, e.g. with LetsEncrypt + </VirtualHost> +</IfModule> +``` + +# Nginx installation + +This is an example nginx configuration file. It covers HTTP, HTTP, and php-fpm configuration. + +_You can find simpler config file but they may be incompatible with FreshRSS API._ + +``` +server { + listen 80; + listen 443 ssl; + + # HTTPS configuration + ssl on; + ssl_certificate /etc/nginx/server.crt; + ssl_certificate_key /etc/nginx/server.key; + + # your server’s URL(s) + server_name rss.example.net; + + # the folder p of your FreshRSS installation + root /srv/FreshRSS/p/; + + index index.php index.html index.htm; + + # nginx log files + access_log /var/log/nginx/rss.access.log; + error_log /var/log/nginx/rss.error.log; + + # php files handling + # this regex is mandatory because of the API + location ~ ^.+?\.php(/.*)?$ { + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + # By default, the variable PATH_INFO is not set under PHP-FPM + # But FreshRSS API greader.php need it. If you have a “Bad Request” error, double check this var! + fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + location / { + try_files $uri $uri/ index.php; + } +} +``` + +A step-by-step tutorial is available [in French](http://www.pihomeserver.fr/2013/05/08/raspberry-pi-home-server-installer-un-agregateur-de-flux-rss-pour-remplacer-google-reader/). + +# Security + +Make sure to expose only the `./p/` folder on the web, the other directories contain personal and sensitive data. +See the Apache and nginx config examples above. + +**TODO** diff --git a/docs/en/admins/03_Updating.md b/docs/en/admins/03_Updating.md new file mode 100644 index 000000000..4e1fdfa5d --- /dev/null +++ b/docs/en/admins/03_Updating.md @@ -0,0 +1,90 @@ + +First things first: we recommend to create a backup before updating: + +```sh +# Perform all commands below in your FreshRSS directory: +cd /usr/share/FreshRSS + +tar -czvf FreshRSS-backup.tgz . +``` + +The update process depends on your installation type, see below: + + +## Using the web admin panel + +Change to your installation at http://localhost/FreshRSS/p/i/?c=update and hit the "Check for new updates" button. + +If there is a new version you will be prompted again. + + +## Using git + +If you manage FreshRSS via command line, then installing and updating FreshRSS can be done via git: + +```sh +# If your local user does not have write access, prefix all commands by sudo: +sudo ... + +# Perform all commands below in your FreshRSS directory: +cd /usr/share/FreshRSS + +# Use the development version of FreshRSS +git checkout -b dev origin/dev + +# Check out a specific version of FreshRSS +# See release names on https://github.com/FreshRSS/FreshRSS/releases +# You will then need to manually change version +# or checkout master or dev branch to get new versions +git checkout 1.7.0 + +# Verify what branch is used +git branch + +# Check whether there is a new version of FreshRSS, +# assuming you are on the /master or /dev branch +git fetch --all +git status + +# Discard manual changes (do a backup before) +git reset --hard +# Then re-delete the file forcing the setup wizard +rm data/do-install.txt + +# Delete manual additions (do a backup before) +git clean -f -d + +# Update to a newer version of FreshRSS, +# assuming you are on the /master or /dev branch +git pull + +# Set the rights so that your Web server can access the files +# (Example for Debian / Ubuntu) +chown -R :www-data . && chmod -R g+r . && chmod -R g+w ./data/ +``` + + +## Using the zip archive + +Perform all commands in your FreshRSS directory: +```sh +cd /usr/share/FreshRSS +``` + +Commands intended to be executed in order (you can c/p the whole block if desired): + +```sh +wget https://github.com/FreshRSS/FreshRSS/archive/master.zip +unzip master.zip +cp -R FreshRSS-master/* . +chown -R :www-data . && chmod -R g+r . && chmod -R g+w ./data/ +rm -f master.zip +rm -f data/do-install.txt +rm -rf FreshRSS-master/ +``` + +Short explanation of the commands above: +* Download the latest version and unzip it +* Overwrite all your existing files with the new ones +* Fix possible permission issues +* Cleanup by deleting the downloaded zip, the file forcing the setup wizard and the temporary directory diff --git a/docs/en/contributing.md b/docs/en/contributing.md new file mode 100644 index 000000000..19f9cb9b1 --- /dev/null +++ b/docs/en/contributing.md @@ -0,0 +1,56 @@ +## Join us on the mailing lists + +Do you want to ask us some questions? Do you want to discuss with us? Don't hesitate to subscribe to our mailing lists! + +- The first mailing is destined to generic information, it should be adapted to users. [Join mailing@freshrss.org](https://freshrss.org/mailman/listinfo/mailing). +- The second mailing is mainly for developers. [Join dev@freshrss.org](https://freshrss.org/mailman/listinfo/dev) + +## Report a bug + +You found a bug? Don't panic, here are some steps to report it easily: + +1. Search for it on [the bug tracker](https://github.com/FreshRSS/FreshRSS/issues) (don't forget to use the search bar). +2. If you find a similar bug, don't hesitate to post a comment to add more importance to the related ticket. +3. If you didn't find it, [open a new ticket](https://github.com/FreshRSS/FreshRSS/issues/new). + +If you have to create a new ticket, try to apply the following advices: + +- Give an explicit title to the ticket so it will be easier to find it later. +- Be as exhaustive as possible in the description: what did you do? What is the bug? What are the steps to reproduce the bug? +- We also need some information: + + Your FreshRSS version (on about page or `constants.php` file) + + Your server configuration: type of hosting, PHP version + + Your storage system (MySQL / MariaDB / PostgreSQL or SQLite) + + If possible, the related logs (PHP logs and FreshRSS logs under `data/users/your_user/log.txt`) + +## Fix a bug + +Did you want to fix a bug? To keep a great coordination between collaborators, you will have to follow these indications: + +1. Be sure the bug is associated to a ticket and say you work on it. +2. [Fork this project repository](https://help.github.com/articles/fork-a-repo/). +3. [Create a new branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/). The name of the branch must be explicit and being prefixed by the related ticket id. For instance, `783-contributing-file` to fix [ticket #783](https://github.com/FreshRSS/FreshRSS/issues/783). +4. Make your changes to your fork and [send a pull request](https://help.github.com/articles/using-pull-requests/) on the **dev branch**. + +If you have to write code, please follow [our coding style recommendations](developers/01_First_steps.md). + +**Tip:** if you are searching for easy-to-fix bugs, have a look at the « [good first issue](https://github.com/FreshRSS/FreshRSS/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) » ticket label. + +## Submit an idea + +You have great ideas, yes! Don't be shy and open [a new ticket](https://github.com/FreshRSS/FreshRSS/issues/new) on our bug tracker to ask if we can implement it. The greatest ideas often come from the shyest suggestions! + +If your idea is nice, we'll have a look at it. + +## Contribute to internationalization (i18n) + +If you want to improve internationalization, please open a new ticket first and follow indications from « Fix a bug » section. + +Translations are present in the subdirectories of `./app/i18n/`. + +We are working on a better way to handle internationalization but don't hesitate to suggest any idea! + +## Contribute to documentation + +The documentation needs a lot of improvements in order to be more useful to new contributors and we are working on it. +If you want to give some help, meet us in the main repositories [docs directory](https://github.com/FreshRSS/FreshRSS/tree/master/docs)! diff --git a/docs/en/developers/01_First_steps.md b/docs/en/developers/01_First_steps.md new file mode 100644 index 000000000..adca4495b --- /dev/null +++ b/docs/en/developers/01_First_steps.md @@ -0,0 +1,198 @@ +# Environment configuration + +**TODO** + +# Project architecture + +**TODO** + +# Extensions + +If you want to create your own FreshRSS extension, take a look at the [extension documentation](03_Backend/05_Extensions.md). + +# Coding style + +If you want to contribute to the source code, it is important to follow the project coding style. The actual code does not follow it throughout the project, but every time we have an opportunity, we should fix it. + +Contributions which do not follow the coding style will be rejected as long as the coding style is not fixed. + +## Spaces, tabs and white spaces + +### Indent +Code indent must use tabs. + +### Alignment + +Once the code is indented, it might be useful to align it to ease the reading. In that case, use spaces. + +```php +$result = a_function_with_a_really_long_name($param1, $param2, + $param3, $param4); +``` + +### End of line + +The end of line character must be a line feed (LF) which is a default end of line on *NIX systems. This character must not follow other white spaces. + +It is possible to verify if there is white spaces before the end of line, with the following Git command: + +```bash +# command to check files before adding them in the Git index +git diff --check +# command to check files after adding them in the Git index +git diff --check --cached +``` + +### End of file + +Every file must end by an empty line. + +### With commas, dots and semi-columns + +There is no space before those characters but there is one after. + +### With operators + +There is a space before and after every operator. + +```php +if ($a == 10) { + // do something +} + +echo $a ? 1 : 0; +``` + +### With brackets + +There is no spaces in the brackets. There is no space before the opening bracket except if it is after a keyword. There is no space after the closing bracket except if it is followed by a curly bracket. + +```php +if ($a == 10) { + // do something +} + +if ((int)$a == 10) { + // do something +} +``` + +### With chained functions + +It happens most of the time in Javascript files. When there is chained functions, closures and callback functions, it is hard to understand the code if not properly formatted. In those cases, we add a new indent level for the complete instruction and reset the indent for a new instruction on the same level. + +```javascript +// First instruction +shortcut.add(shortcuts.mark_read, function () { + //... + }, { + 'disable_in_input': true + }); +// Second instruction +shortcut.add("shift+" + shortcuts.mark_read, function () { + //... + }, { + 'disable_in_input': true + }); +``` + +## Line length + +Lines should be shorter than 80 characters. However, in some case, it is possible to extend that limit to 100 characters. + +With functions, parameters can be declared on different lines. + +```php +function my_function($param_1, $param_2, + $param_3, $param_4) { + // do something +} +``` + +## Naming + +All the code elements (functions, classes, methods and variables) must describe their usage in concise way. + +### Functions and variables + +They must follow the "snake case" convention. + +```php +// a function +function function_name() { + // do something +} +// a variable +$variable_name; +``` + +### Methods + +They must follow the "lower camel case" convention. + +```php +private function methodName() { + // do something +} +``` + +### Classes + +They must follow the "upper camel case" convention. + +```php +abstract class ClassName {} +``` + +## Encoding + +Files must be encoded with UTF-8 character set. + +## PHP 5.3 compatibility + +Do not get an array item directly from a function or a method. Use a variable. + +```php +// code with PHP 5.3 compatibility +$my_variable = function_returning_an_array(); +echo $my_variable[0]; +// code without PHP 5.3 compatibility +echo function_returning_an_array()[0]; +``` + +Do not use short array declaration. + +```php +// code with PHP 5.3 compatibility +$variable = array(); +// code without PHP 5.3 compatibility +$variable = []; +``` + +## Miscellaneous + +### Operators +They must be at the end of the line if a condition runs on more than one line. + +```php +if ($a == 10 || + $a == 20) { + // do something +} +``` + +### End of file + +If the file contains only PHP code, the PHP closing tag must be omitted. + +### Arrays + +If an array declaration runs on more than one line, each element must be followed by a comma even the last one. + +```php +$variable = array( + "value 1", + "value 2", + "value 3", +); +``` diff --git a/docs/en/developers/02_Github.md b/docs/en/developers/02_Github.md new file mode 100644 index 000000000..c16a6d040 --- /dev/null +++ b/docs/en/developers/02_Github.md @@ -0,0 +1,11 @@ +# Reporting a bug or a suggestion + +**TODO** + +# Branching + +**TODO** + +# Sending a patch + +**TODO** diff --git a/docs/en/developers/03_Backend/01_Database_schema.md b/docs/en/developers/03_Backend/01_Database_schema.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/en/developers/03_Backend/01_Database_schema.md diff --git a/docs/en/developers/03_Backend/02_Minz.md b/docs/en/developers/03_Backend/02_Minz.md new file mode 100644 index 000000000..cfbea15fe --- /dev/null +++ b/docs/en/developers/03_Backend/02_Minz.md @@ -0,0 +1,27 @@ +# Models + +**TODO** + +# Controllers and actions + +**TODO** + +# Views + +**TODO** + +# Routing + +**TODO** + +# Writing URL + +**TODO** + +# Internationalisation + +**TODO** + +# Understanding internals + +**TODO** diff --git a/docs/en/developers/03_Backend/03_External_libraries.md b/docs/en/developers/03_Backend/03_External_libraries.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/en/developers/03_Backend/03_External_libraries.md diff --git a/docs/en/developers/03_Backend/04_Changing_source_code.md b/docs/en/developers/03_Backend/04_Changing_source_code.md new file mode 100644 index 000000000..e8a5958e4 --- /dev/null +++ b/docs/en/developers/03_Backend/04_Changing_source_code.md @@ -0,0 +1,15 @@ +# Accessing the database + +**TODO** + +# Writing an action and its related view + +**TODO** + +# Authentication + +**TODO** + +# Logs + +**TODO**
\ No newline at end of file diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md new file mode 100644 index 000000000..b0b5793df --- /dev/null +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -0,0 +1,334 @@ +# Writing extensions for FreshRSS + +## About FreshRSS + +FreshRSS is an RSS / Atom feeds aggregator written in PHP since October 2012. The official site is located at [freshrss.org](https://freshrss.org) and its repository is hosted by Github: [github.com/FreshRSS/FreshRSS](https://github.com/FreshRSS/FreshRSS). + +## Problem to solve + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +## Understanding basic mechanics (Minz and MVC) + +**TODO** : move to 02_Minz.md + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### MVC Architecture + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Routing + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +Code example: + +```php +<?php + +class FreshRSS_hello_Controller extends Minz_ActionController { + public function indexAction() { + $this->view->a_variable = 'FooBar'; + } + + public function worldAction() { + $this->view->a_variable = 'Hello World!'; + } +} + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Views + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +Code example: + +```html +<p> + This is a parameter passed from the controller: <?php echo $this->a_variable; ?> +</p> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Working with GET / POST + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +Code example: + +```php +<?php + +$default_value = 'foo'; +$param = Minz_Request::param('bar', $default_value); + +// Display the value of the parameter `bar` (passed via GET or POST) +// or "foo" if the parameter does not exist. +echo $param; + +// Sets the value of the `bar` parameter +Minz_Request::_param('bar', 'baz'); + +// Will necessarily display "baz" since we have just forced its value. +// Note that the second parameter (default) is optional. +echo Minz_Request::param('bar'); + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Access session settings + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Working with URLs + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +```html +<p> + Go to page <a href="http://example.com?c=hello&a=world">Hello world</a>! +</p> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world', + 'params' => array( + 'foo' => 'bar', + ) +); + +// Show something like .?c=hello&a=world&foo=bar +echo Minz_Url::display($url_array); + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +```php +<?php + +// Displays the same as above +echo _url('hello', 'world', 'foo', 'bar'); + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Redirections + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +Code example: + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world' +); + +// Tells Minz to redirect the user to the hello / world page. +// Note that this is a redirection in the Minz sense of the term, not a redirection that the browser will have to manage (HTTP code 301 or 302) +// The code that follows forward() will thus be executed! +Minz_Request::forward($url_array); + +// To perform a type 302 redirect, add "true". +// The code that follows will never be executed. +Minz_Request::forward($url_array, true); + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world' +); +$feedback_good = 'Tout s\'est bien passé !'; +$feedback_bad = 'Oups, quelque chose n\'a pas marché.'; + +Minz_Request::good($feedback_good, $url_array); + +// or + +Minz_Request::bad($feedback_bad, $url_array); + +?> +``` + +### Translation Management + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +```php +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualiser', + 'back_to_rss_feeds' => '← Retour à vos flux RSS', + 'cancel' => 'Annuler', + 'create' => 'Créer', + 'disable' => 'Désactiver', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'À propos de FreshRSS', + ), +); + +?> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +Code example: + +```html +<p> + <a href="<?php echo _url('index', 'index'); ?>"> + <?php echo _t('gen.action.back_to_rss_feeds'); ?> + </a> +</p> +``` + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +### Configuration management + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +## Write an extension for FreshRSS + +Here we are! We've talked about the most useful features of Minz and how to run FreshRSS correctly and it's about time to address the extensions themselves. + +An extension allows you to add functionality easily to FreshRSS without having to touch the core of the project directly. + +### Basic files and folders + +The first thing to note is that **all** extensions **must** be located in the `extensions` directory, at the base of the FreshRSS tree. +An extension is a directory containing a set of mandatory (and optional) files and subdirectories. +The convention requires that the main directory name be preceded by an "x" to indicate that it is not an extension included by default in FreshRSS. + +The main directory of an extension must contain at least two **mandatory** files: + +- A `metadata.json` file that contains a description of the extension. This file is written in JSON. +- An `extension.php` file containing the entry point of the extension (which is a class that inherits Minz_Extension). + +Please note that there is a not a required link between the directory name of the extension and the name of the class inside `extension.php`, +but you should follow our best practice: +If you want to write a `HelloWorld` extension, the directory name should be `xExtension-HelloWorld` and the base class name `HelloWorldExtension`. + +In the file `freshrss/extensions/xExtension-HelloWorld/extension.php` you need the structure: +```html +class HelloWorldExtension extends Minz_Extension { + public function init() { + // your code here + } +} +``` +There is an example HelloWorld extension that you can download from [our GitHub repo](https://github.com/FreshRSS/xExtension-HelloWorld). + +You may also need additional files or subdirectories depending on your needs: + +- `configure.phtml` is the file containing the form to parameterize your extension +- A `static/` directory containing CSS and JavaScript files that you will need for your extension (note that if you need to write a lot of CSS it may be more interesting to write a complete theme) +- A `controllers` directory containing additional controllers +- An `i18n` directory containing additional translations +- `layout` and` views` directories to define new views or to overwrite the current views + +In addition, it is good to have a `LICENSE` file indicating the license under which your extension is distributed and a` README` file giving a detailed description of it. + +### The metadata.json file + +The `metadata.json` file defines your extension through a number of important elements. It must contain a valid JSON array containing the following entries: + +- `name` : the name of your extension +- `author` : your name, your e-mail address ... but there is no specific format to adopt +- `description` : a description of your extension +- `version` : the current version number of the extension +- `entrypoint` : Indicates the entry point of your extension. It must match the name of the class contained in the file `extension.php` without the suffix` Extension` (so if the entry point is `HelloWorld`, your class will be called` HelloWorldExtension`) +- `type` : Defines the type of your extension. There are two types: `system` and` user`. We will study this difference right after. + +Only the `name` and` entrypoint` fields are required. + +### Choose between « system » or « user » + +A __user__ extension can be enabled by some users and not by others (typically for user preferences). + +A __system__ extension in comparison is enabled for every account. + +### Writing your own extension.php + +This file is the entry point of your extension. It must contain a specific class to function. +As mentioned above, the name of the class must be your `entrypoint` suffixed by` Extension` (`HelloWorldExtension` for example). +In addition, this class must be inherited from the `Minz_Extension` class to benefit from extensions-specific methods. + +Your class will benefit from four methods to redefine: + +- `install()` is called when a user clicks the button to activate your extension. It allows, for example, to update the database of a user in order to make it compatible with the extension. It returns `true` if everything went well or, if not, a string explaining the problem. +- `uninstall()` is called when a user clicks the button to disable your extension. This will allow you to undo the database changes you potentially made in `install ()`. It returns `true` if everything went well or, if not, a string explaining the problem. +- `init()` is called for every page load *if the extension is enabled*. It will therefore initialize the behavior of the extension. This is the most important method. +- `handleConfigureAction()` is called when a user loads the extension management panel. Specifically, it is called when the `?c=extension&a=configured&e=name-of-your-extension` URL is loaded. You should also write here the behavior you want when validating the form in your `configure.phtml` file. + +In addition, you will have a number of methods directly inherited from `Minz_Extension` that you should not redefine: + +- The "getters" first: most are explicit enough not to detail them here - `getName()`, `getEntrypoint()`, `getPath()` (allows you to retrieve the path to your extension), `getAuthor()`, `getDescription()`, `getVersion()`, `getType()`. +- `getFileUrl($filename, $type)` will return the URL to a file in the `static` directory. The first parameter is the name of the file (without `static /`), the second is the type of file to be used (`css` or` js`). +- `registerController($base_name)` will tell Minz to take into account the given controller in the routing system. The controller must be located in your `Controllers` directory, the name of the file must be` <base_name>Controller.php` and the name of the `FreshExtension_<base_name>_Controller` class. + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) + +- `registerViews()` +- `registerTranslates()` +- `registerHook($hook_name, $hook_function)` + +### The « hooks » system + +You can register at the FreshRSS event system in an extensions `init()` method, to manipulate data when some of the core functions are executed. + +```html +class HelloWorldExtension extends Minz_Extension +{ + public function init() { + $this->registerHook('entry_before_display', array($this, 'renderEntry')); + } + public function renderEntry($entry) { + $entry->_content('<h1>Hello World</h1>' . $entry->content()); + return $entry; + } +} +``` +The following events are available: + +- `entry_before_display` (`function($entry) -> Entry | null`) : will be executed every time an entry is rendered. The entry itself (instance of FreshRSS_Entry) will be passed as parameter. +- `entry_before_insert` (`function($entry) -> Entry | null`) : will be executed when a feed is refreshed and new entries will be imported into the database. The new entry (instance of FreshRSS_Entry) will be passed as parameter. +- `feed_before_insert` (`function($feed) -> Feed | null`) : will be executed when a new feed is imported into the database. The new feed (instance of FreshRSS_Feed) will be passed as parameter. +- `post_update` (`function(none) -> none`) : **TODO** add documentation + +### Writing your own configure.phtml + +When you want to support user configurations for your extension or simply display some information, you have to create the `configure.phtml` file. + +**TODO** translate from [french version](https://github.com/FreshRSS/documentation/blob/master/fr/docs/developers/03_Backend/05_Extensions.md) diff --git a/docs/en/developers/04_Frontend/01_View_files.md b/docs/en/developers/04_Frontend/01_View_files.md new file mode 100644 index 000000000..5eb284dde --- /dev/null +++ b/docs/en/developers/04_Frontend/01_View_files.md @@ -0,0 +1,15 @@ +# The .phtml files + +**TODO** + +# Writing a URL + +**TODO** + +# Displaying an icon + +**TODO** + +# Internationalisation + +**TODO** diff --git a/docs/en/developers/04_Frontend/02_Design.md b/docs/en/developers/04_Frontend/02_Design.md new file mode 100644 index 000000000..c2e622a08 --- /dev/null +++ b/docs/en/developers/04_Frontend/02_Design.md @@ -0,0 +1,11 @@ +# Template file + +**TODO** + +# Writing a new theme + +**TODO** + +# Overriding icons + +**TODO** diff --git a/docs/en/developers/05_Release_new_version.md b/docs/en/developers/05_Release_new_version.md new file mode 100644 index 000000000..e1a23c8ba --- /dev/null +++ b/docs/en/developers/05_Release_new_version.md @@ -0,0 +1 @@ +**TODO** diff --git a/docs/en/img/doc.edit.png b/docs/en/img/doc.edit.png Binary files differnew file mode 100644 index 000000000..bc850e514 --- /dev/null +++ b/docs/en/img/doc.edit.png diff --git a/docs/en/img/logo_freshrss.png b/docs/en/img/logo_freshrss.png Binary files differnew file mode 100644 index 000000000..763b19cb1 --- /dev/null +++ b/docs/en/img/logo_freshrss.png diff --git a/docs/en/img/users/anonymous_access.1.png b/docs/en/img/users/anonymous_access.1.png Binary files differnew file mode 100644 index 000000000..cd4145e3e --- /dev/null +++ b/docs/en/img/users/anonymous_access.1.png diff --git a/docs/en/img/users/feed.add.1.png b/docs/en/img/users/feed.add.1.png Binary files differnew file mode 100644 index 000000000..b6146857f --- /dev/null +++ b/docs/en/img/users/feed.add.1.png diff --git a/docs/en/img/users/feed.filter.1.png b/docs/en/img/users/feed.filter.1.png Binary files differnew file mode 100644 index 000000000..e4738d1a0 --- /dev/null +++ b/docs/en/img/users/feed.filter.1.png diff --git a/docs/en/img/users/feed.filter.2.png b/docs/en/img/users/feed.filter.2.png Binary files differnew file mode 100644 index 000000000..5e8dd2899 --- /dev/null +++ b/docs/en/img/users/feed.filter.2.png diff --git a/docs/en/img/users/refresh.1.png b/docs/en/img/users/refresh.1.png Binary files differnew file mode 100644 index 000000000..a8c5f7ea0 --- /dev/null +++ b/docs/en/img/users/refresh.1.png diff --git a/docs/en/img/users/refresh.2.png b/docs/en/img/users/refresh.2.png Binary files differnew file mode 100644 index 000000000..1b97ab9ae --- /dev/null +++ b/docs/en/img/users/refresh.2.png diff --git a/docs/en/img/users/refresh.3.png b/docs/en/img/users/refresh.3.png Binary files differnew file mode 100644 index 000000000..e80bfc29f --- /dev/null +++ b/docs/en/img/users/refresh.3.png diff --git a/docs/en/img/users/refresh.4.png b/docs/en/img/users/refresh.4.png Binary files differnew file mode 100644 index 000000000..abbeb5cd4 --- /dev/null +++ b/docs/en/img/users/refresh.4.png diff --git a/docs/en/img/users/refresh.5.png b/docs/en/img/users/refresh.5.png Binary files differnew file mode 100644 index 000000000..fb3113300 --- /dev/null +++ b/docs/en/img/users/refresh.5.png diff --git a/docs/en/img/users/refresh.6.png b/docs/en/img/users/refresh.6.png Binary files differnew file mode 100644 index 000000000..0d78e3976 --- /dev/null +++ b/docs/en/img/users/refresh.6.png diff --git a/docs/en/img/users/status.filter.0.7.png b/docs/en/img/users/status.filter.0.7.png Binary files differnew file mode 100644 index 000000000..4516b937f --- /dev/null +++ b/docs/en/img/users/status.filter.0.7.png diff --git a/docs/en/img/users/status.filter.0.8.png b/docs/en/img/users/status.filter.0.8.png Binary files differnew file mode 100644 index 000000000..5a0b9a3a1 --- /dev/null +++ b/docs/en/img/users/status.filter.0.8.png diff --git a/docs/en/img/users/token.1.png b/docs/en/img/users/token.1.png Binary files differnew file mode 100644 index 000000000..73ce65cf3 --- /dev/null +++ b/docs/en/img/users/token.1.png diff --git a/docs/en/index.md b/docs/en/index.md new file mode 100644 index 000000000..a0c97a0d9 --- /dev/null +++ b/docs/en/index.md @@ -0,0 +1,24 @@ + + +FreshRSS is a RSS aggregator and reader. It gives you possibility to read and follow several news website at a glance without the need to go from a website to another. + +FreshRSS has a lot of features including: + +- RSS and Atom aggregation +- Mark article as favorite if you liked it or if you want to read it later +- Filter and search functionalities are working together to find easily articles +- Statistics help you to know the frequency of publishing of all the websites you are following +- Import/export of your feeds into OPML format +- Several themes created by the community +- "Google Reader"-like API to connect Android applications +- The application is "responsive" which means it adapts to small screens so you can bring articles in your pocket +- Self-hosted: code is free (under AGPL3 licence) and so you can host your own instance of FreshRSS +- Multi-users so you can host your friends and your family +- And a lot more! + +This documentation is split into four sections: + +- [user documentation](users/02_First_steps.md) so you can discover all the power of FreshRSS +- [developer documentation](developers/01_First_steps.md) to guide you in the source code of FreshRSS and to help you if you want to contribute +- [administrator documentation](admins/01_Index.md) to guide you in the source code of FreshRSS and to help you if you want to contribute +- [contributor guidelines](contributing.md) for all of you who want to help improving FreshRSS diff --git a/docs/en/users/02_First_steps.md b/docs/en/users/02_First_steps.md new file mode 100644 index 000000000..2fb1b7256 --- /dev/null +++ b/docs/en/users/02_First_steps.md @@ -0,0 +1,28 @@ +Learning how to handle a new application is not always easy. We build FreshRSS to be intuitive, but you will need some guidance to get your hand on it. + +This section guides you to the pages you need as a new comer. + +[After installing the application](../admins/02_Installation.md), the first step is to add some feeds. You have a few options: + +1. [Add a feed manually](04_Subscriptions.md#adding-a-feed) +2. [Import an OPML or JSON file](04_Subscriptions.md#import-and-export) +3. [Use the bookmarklet](04_Subscriptions.md#use-bookmarklet) +4. [Firefox integration](04_Subscriptions.md#firefox-subscription-service) + +Once you have added your feeds to FreshRSS, it is time to read them. You have access to three reading modes: + +1. [The normal view](03_Main_view.md#normal-view) which allows you to display and read quickly new articles +2. [The global view](03_Main_view.md#global-view) which allows you to see in one glance the status of your feeds +3. [The reader view](03_Main_view.md#reader-view) which allows you to have a nice reading experience. + +Now that you know the basic usages, it is time to configure FreshRSS to improve your reading experience. It has a lot of options, so play with them to find your perfect configuration. However, here is few resources to help you: + +* [Organize your feeds in categories](04_Subscriptions.md#feed-management) +* [Change the home page](05_Configuration.md#changing-the-view) +* [Choose the reading options](05_Configuration.md#reading-options) +* [Refresh feeds](03_Main_view.md#refreshing-feeds) +* [Filter articles](03_Main_view.md#filtering-articles) for a fast access to a selection +* [Search an article](03_Main_view.md#searching-articles) published some time ago +* [Access your feeds on a mobile device](06_Mobile_access.md) +* [Add some extensions](https://github.com/FreshRSS/Extensions) +* [Frequently asked questions](07_Frequently_Asked_Questions.md) diff --git a/docs/en/users/03_Main_view.md b/docs/en/users/03_Main_view.md new file mode 100644 index 000000000..53b0beaf2 --- /dev/null +++ b/docs/en/users/03_Main_view.md @@ -0,0 +1,183 @@ +# Normal view + +**TODO** + +# Global view + +**TODO** + +# Reader view + +**TODO** + +# Refreshing feeds + +To use FreshRSS at its full potential, it needs to grab subscribed feeds new articles. To do so, you have several methods available. + +## Automatic update + +This is the recommended method since you can forget about it once it is configured. + +### With the actualize_script.php script + +This method is available only if you have access to the installation server scheduled tasks. + +The script is named *actualize_script.php* and is located in the *app* folder. The scheduled task syntax will not be explained here. However, here is [a quick introduction to crontab](http://www.adminschoice.com/crontab-quick-reference/) that might help you. + +Here is an example to trigger article update every hour. + +```cron +0 * * * * php /path/to/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +``` + + +### Online cron + +If you do not have access to the installation server scheduled task, you can still automate the update process. + +To do so, you need to create a scheduled task, which need to call a specific URL: https://your.server.net/FreshRSS/p/i/?c=feed&a=actualize (it could be different depending on your installation). Depending on your application authentication method, you need to adapt the scheduled task. + +#### No authentication + +This is the most straightforward since you have a public instance; there is nothing special to configure: + +```cron +0 * * * * curl 'https://your.server.net/FreshRSS/p/i/?c=feed&a=actualize' +``` + +### Form or Persona authentication + +In those cases, if you configure the application to allow anonymous reading, you can also allow anonymous user to update feeds (“Allow anonymous refresh of the articles”). + + + +The URL used in the previous section becomes accessible and therefore, you can use the same syntax for the scheduled task. + +You can also configure an authentication token to grant a special right on the server. + + + +The scheduled task syntax to use will be the following: + +```cron +0 * * * * curl 'https://your.server.net/FreshRSS/p/i/?c=feed&a=actualize&token=my-token' +``` + + +### HTTP authentication + +In that case, the syntax in the two previous section are unusable. It means that you need to provide your credentials to the scheduled task. **Note that this method is highly discouraged since it means that your credentials will be in plain sight!** + +```cron +0 * * * * curl -u alice:password123 'https://your.server.net/FreshRSS/p/i/?c=feed&a=actualize' +``` + +## Manual update + +If you cannot or do not want to use the automatic methods, you can make it manually. There is two ways, the partial or the complete update. + +### Complete update + +This update occurs on all feeds. To trigger it, you need to click on the navigation menu update link. + + + +When the update starts, a progress bar appears and changes while feeds are processed. + + + +### Partial update + +This update occurs on the selected feed only. To trigger it, you need to click on the feed menu update link. + + + +# Filtering articles + +While the number of articles stored by FreshRSS increase, it is important to have efficient filters to display only a subset of the articles. There is several methods with different criterion. Most of the time, those methods can be combined. + +##By category + +It is the easiest method. The only thing to do is clicking on the category title in the side panel. There is two special categories on top of that panel: + + * *Main feed* which displays only articles from feeds marked as available in that category + * *Favourites* which displays only articles marked as favourites + +##By feed + +There is several methods to filter articles by feed: + + * by clicking the feed title in the side panel + * by clicking the feed title in the article details + * by filtering in the feed options from the side panel + * by filtering in the feed configuration + + + +##By status + +Each article has two attributes, which can be combined. The first attribute indicates if the article was read or not. The second attribute indicates if the article was marked as favorite or not. + +With version 0.7, attribute filters are available in the article display dropdown list. With this version, it is not possible to combine those filters. For instance, it is not possible to display only read and favourite articles. + + + +Starting with version 0.8, all attribute filters are visible as toggle icons. They can be combined. As any combination is possible, some have the same result. For instance, the result for all filters selected is the same as no filter selected. + + + +By default, this filter displays only unread articles + +##By content + +It is possible to filter articles by their content by inputting a string in the search field. + +##With the search field + +It is possible to use the search field to further refine results: + +* by author: `author:name` or `author:'composed name'` +* by title: `intitle:keyword` or `intitle:'composed keyword'` +* by URL: `inurl:keyword` or `inurl:'composed keyword'` +* by tag: `#tag` +* by free-text: `keyword` or `'composed keyword'` +* by date of discovery, using the [ISO 8601 time interval format](http://en.wikipedia.org/wiki/ISO_8601#Time_intervals): `date:<date-interval>` + * From a specific day, or month, or year: + * `date:2014-03-30` + * `date:2014-03` or `date:201403` + * `date:2014` + * From a specific time of a given day: + * `date:2014-05-30T13` + * `date:2014-05-30T13:30` + * Between two given dates: + * `date:2014-02/2014-04` + * `date:2014-02--2014-04` + * `date:2014-02/04` + * `date:2014-02-03/05` + * `date:2014-02-03T22:00/22:15` + * `date:2014-02-03T22:00/15` + * After a given date: + * `date:2014-03/` + * Before a given date: + * `date:/2014-03` + * For a specific duration after a given date: + * `date:2014-03/P1W` + * For a specific duration before a given date: + * `date:P1W/2014-05-25T23:59:59` + * For the past duration before now (the trailing slash is optional): + * `date:P1Y/` or `date:P1Y` (past year) + * `date:P2M/` (past two months) + * `date:P3W/` (past three weeks) + * `date:P4D/` (past four days) + * `date:PT5H/` (past five hours) + * `date:PT30M/` (past thirty minutes) + * `date:PT90S/` (past ninety seconds) + * `date:P1DT1H/` (past one day and one hour) +* by date of publication, using the same format: `pubdate:<date-interval>` + +Beware that there is no space between the operator and the value. + +Some operators can be used negatively, to exclude articles, with the same syntax as above, but prefixed by a `!` or `-`: +`-author:name`, `-intitle:keyword`, `-inurl:keyword`, `-#tag`, `!keyword`. + +It is also possible to combine operators to have a very sharp filter, and it is allowed to have multiple instances of `author:`, `intitle:`, `inurl:`, `#`, and free-text. diff --git a/docs/en/users/04_Subscriptions.md b/docs/en/users/04_Subscriptions.md new file mode 100644 index 000000000..0772be4cc --- /dev/null +++ b/docs/en/users/04_Subscriptions.md @@ -0,0 +1,33 @@ +# Adding a feed + +**TODO** + +# Import and export + +**TODO** + +# Use bookmarklet + +**TODO** + +# Feed management + +**TODO** + +# Firefox subscription service + +You can manually add your FreshRSS app to the list of Firefox subscription services which will enable you to subscribe to sites which provide a feed link using the Firefox built-in "Subscribe" button. An in-depth process is described in the [official documentation](https://developer.mozilla.org/en-US/Firefox/Releases/2/Adding_feed_readers_to_Firefox) but you can use the following steps: + + 1. Open about:config in Firefox + + 2. Search for "browser.contentHandlers.types." and note the highest number following the returned strings (ie if yo see browser.contentHandlers.types.1.something up to browser.contentHandlers.types.5.somethingelse etc. the highest number is 5). Your contentHandler will have to have a free number so just pick one higher than currently registered (you would chose six in above example). + + 3. You will have to add three new strings to your about config (replace %NUMBER% with the number from previous step and example.com with your installation address): + + | Preference name | Value | Note | + | -------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------- | + | browser.contentHandlers.types.%NUMBER%.title | **FreshRSS** | Use any name you would like (ie. "My feeds") | + | browser.contentHandlers.types.%NUMBER%.type | **application/vnd.mozilla.maybe.feed** | Do not change this value! | + | browser.contentHandlers.types.%NUMBER%.uri | **http://EXAMPLE.COM/FreshRss/i?c=feed&a=add&url_rss=%s** | Replace base url with yours and switch to https (if used) | + + 4. Restart Firefox and you can subscribe to sites with the Firefox built-in "Subscribe" button. Just select the name you set under the first Preference name from the dropdown (you can also make it default with the checbox) and you will be redirected to FreshRSS subscription settings (you must be logged in). diff --git a/docs/en/users/05_Configuration.md b/docs/en/users/05_Configuration.md new file mode 100644 index 000000000..d0951e905 --- /dev/null +++ b/docs/en/users/05_Configuration.md @@ -0,0 +1,121 @@ + +# Display + +## Language + +At the moment, FreshRSS is available in French and English. After you confirm your choice, the whole interface will be displayed in the chosen language. + +There are parts of FreshRSS that are not translated and are not intended to be translated. For now, the logs visible in the application as well as the one generated by the script of automatic update are part of it. + +## Theme + +In matters of taste and color, there can be no disputes. This is why FreshRSS offers six official themes: + + * *Blue Lagoon* by **Mister aiR** + * *Dark* by **AD** + * *Flat design* by **Marien Fressinaud** + * *Origine* by **Marien Fressinaud** + * *Pafat* by **Plopoyop** + * *Screwdriver* by **Mister aiR** + +If none of these are suitable for you, it is always possible to create your own. + +To select a theme, simply scroll through the themes and select one that strikes your fancy. After confirmation, the theme will be applied to the interface. + +## Content width + +There are some who prefer short lines of text while others prefer to maximize the available screen space. To satisfy the maximum number of people it is possible to choose the width of the displayed content. There are four settings available: + + * **Fine** which displays content up to 550 pixels + * **Medium** which displays content up to 800 pixels + * **Large** which displays content up to 1000 pixels + * **No limit** which displays the content on 100% of the available space + +## Article icons + +**TODO** + +## HTML5 notification timout + +After the automatic updates of the feeds, FreshRSS uses the HTML5 notification API to notify of the arrival of new articles. + +The duration of this notification can be set. By default, the value is 0. + +# Reading + +**TODO** + +# Archiving + +**TODO** + +# Sharing + +**TODO** + +# Shortcuts + +**TODO** + +# User queries + +**TODO** + +# Users + +**TODO** + +## Authentication methods + +### HTTP Authentication (Apache) + + 1. User control is based on the `.htaccess` file. + 2. It is best practice to place the `.htaccess` file in the `./i/` subdirectory so the API and other third party services can work. + 3. If you want to limit all access to registered users only, place the file in the FreshRSS directory itself or in a parent directory. Note that PubsubHubbub and API will not work! + 4. Example `.htaccess` file for a user "marie": + +``` +AuthUserFile /home/marie/repertoire/.htpasswd +AuthGroupFile /dev/null +AuthName "Chez Marie" +AuthType Basic +Require user marie +``` + +More information can be found in the [Apache documentation](http://httpd.apache.org/docs/trunk/howto/auth.html#gettingitworking). + +# Subscription management + +## Information + +**TODO** + +## Archivage + +**TODO** + +## Login + +**TODO** + +## Advanced + +### Retrieve a truncated stream + +The question comes up regularly, so we will try to clarify here how one can retrieve a truncated RSS feed with FreshRSS. Please note that the process is absolutely not "user friendly", but it works :) + +Also know that this way you are generating much more traffic to the originating sites and that they might block you accordingly. The performance of FreshRSS is also negatively affected because you have to fetch the full article content one by one. So it's a feature to use sparingly! + +What is meant by "CSS path of articles on the original site" actually corresponds to the "path" consisting of IDs and classes (which in html, matches the id and class attributes) to retrieve only the interesting part that corresponds to the article. Ideally, this path starts with an id (which is unique to the page). + +#### Example 1: Rue89 + +To find this path, you must go to the address of one of the truncated articles (for example http://www.rue89.com/2013/10/15/prof-maths-jai-atteint-lextase-dihn-pedagogie-inversee-246635). You must then look for the "block" of HTML corresponding to the content of the article (in the source code!). + +We find here that the block that encompasses only the content of the article is ```<div class="content clearfix">```. We will only use the ".content" class here. Nevertheless, as said above, it is best to start the path with an id. If we go back to the parent block, this is the block ```<div id="article">``` and that's perfect! The path will be ```#article .content```. + +#### Add the corresponding classes to the articles CSS path on the feed configuration page. Examples: + +* Rue89: ```#article .content``` +* PCINpact: ```#actu_content``` +* Lesnumériques: ```article#body div.text.clearfix``` diff --git a/docs/en/users/06_Mobile_access.md b/docs/en/users/06_Mobile_access.md new file mode 100644 index 000000000..3472172b0 --- /dev/null +++ b/docs/en/users/06_Mobile_access.md @@ -0,0 +1,51 @@ +This page assumes you have completed the [server setup](../admins/02_Installation.md). + +# Enable the API in FreshRSS + +1. Under the section “Authentication”, enable the option “Allow API access (required for mobile apps)”. +2. Under the section “Profile”, fill-in the field “API password (e.g., for mobile apps)”. + * Every user must define an API password. + * The reason for an API-specific password is that it may be used in less safe situations than the main password, and does not grant access to as many things. + + +# Testing + +3. Under the section “Profile”, click on the link like `https://rss.example.net/api/` next to the field “API password”. +4. Click on first link “Check full server configuration”: + * If you get *PASS* then you are done, all is good: you may proceed to step 6. + * If you get *Bad Request!* or *Not Found*, then your server probably does not accept slashes `/` that are escaped `%2F`. Proceed to step 5. + * If you get any other error message, proceed to step 5. + + +# Fix server configuration + +5. Click on the second link “Check partial server configuration (without `%2F` support)”: + * If you get `PASS`, then the problem is indeed that your server does not accept slashes `/` that are escaped `%2F`. + * With Apache, remember the directive [`AllowEncodedSlashes On`](http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes) + * Or use a client that does not escape slashes (such as EasyRSS), in which case proceed to step 6. + * If you get *Service Unavailable!*, then check from step 1 again. + * With __Apache__: + * If you get *FAIL getallheaders!*, the combination of your PHP version and your Web server does not provide access to [`getallheaders`](http://php.net/getallheaders) + * Update to PHP 5.4+, or use PHP as module instead of CGI. Otherwise turn on Apache `mod_rewrite`: + * Allow [`FileInfo` in `.htaccess`](http://httpd.apache.org/docs/trunk/mod/core.html#allowoverride): see the [server setup](../admins/02_Installation.md) again. + * Enable [`mod_rewrite`](http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html): + * With Debian / Ubuntu: `sudo a2enmod rewrite` + * With __nginx__: + * If you get *Bad Request!*, check your server `PATH_INFO` configuration. + * If you get *File not found!*, check your server `fastcgi_split_path_info`. + * If you get *FAIL 64-bit or GMP extension!*, then your PHP version does not pass the requirement of being 64-bit and/or have PHP [GMP](http://php.net/gmp) extension. + * The easiest is to add the GMP extension. On Debian / Ubuntu: `sudo apt install php-gmp` + * Update and try again from step 3. + + +# Compatible clients + +6. On the same FreshRSS API page, note the adress given under “Your API address”, like `https://freshrss.example.net/api/greader.php` + * You will type it in a client, together with your FreshRSS username, and the corresponding special API password. + +7. Pick a client supporting a Google Reader-like API. Selection: + * Android + * [News+](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus) with [News+ Google Reader extension](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader) (Closed source) + * [EasyRSS](https://github.com/Alkarex/EasyRSS) (Open source, [F-Droid](https://f-droid.org/packages/org.freshrss.easyrss/)) + * Linux + * [FeedReader 2.0+](https://jangernert.github.io/FeedReader/) (Open source) diff --git a/docs/en/users/07_Frequently_Asked_Questions.md b/docs/en/users/07_Frequently_Asked_Questions.md new file mode 100644 index 000000000..6391c55f5 --- /dev/null +++ b/docs/en/users/07_Frequently_Asked_Questions.md @@ -0,0 +1,35 @@ +We may not have answered all of your questions in the previous sections. The FAQ contains some questions that have not been answered elsewhere. + +## What is /i at the end of the application URL? + +Of course, ```/i``` has a purpose! We used it for performance and usability: + +* it allows to serve icons, images, styles and scripts without cookies. Whitout that trick, those files will be downloaded more often, specially when the form or the Personna authentications are used. Also, HTTP requests will be heavier. +* ```./p/``` public root can be served without any HTTP access restrictions. Whereas it could be implemented in ```./p/i/```. +* It spares from having problems while serving public resources like ```favicon.ico```, ```robots.txt```, etc. +* It allows to display the logo instead of a white page while hitting a restriction or a delay during the loading process. + +## Why robots.txt is located in a sub-folder? + +To increase security, FreshRSS is hosted in two sections. The first section is public (```./p``` folder) and the second section is private (everything else). Therefore the ```robots.txt``` file is located in ```./p``` sub-folder. + +As explained in the [security section](/en/User_documentation/Installation/Security), it is highly recommended to make only the public section available at the domain level. With that configuration, ```./p``` is the root folder for http://demo.freshrss.org/, thus making ```robots.txt``` available at the root of the application. + +The same rule applies for ```favicon.ico``` and ```.htaccess```. + +## Why do I have errors while registering a feed? + +There can be different origins for that problem. +The feed syntax can be invalid, it can be unrecognized by the SimplePie library. the hosting server can be the root of the problem, FreshRSS can be buggy. +The first step is to identify what causes the problem. +Here are the steps to follow: + +1. __Verify if the feed syntax is valid__ with the [W3C on-line tool](http://validator.w3.org/feed/ "RSS and Atom feed validator"). If it is not valid, there is nothing we can do. +1. __Verify SimplePie validation__ with the [SimplePie on-line tool](http://simplepie.org/demo/ "SimplePie official demo"). If it is not recognized, there is nothing we can do. +1. __Verify FreshRSS integration__ with the [demo](http://demo.freshrss.org "FreshRSS official demo"). If it is not working, you need to [create an issue on Github](https://github.com/FreshRSS/FreshRSS/issues/new "Create an issue for FreshRSS") so we can have a look at it. If it is working, there is probably something fishy with the hosting server. + +Here is a list of feed which don't work: + +* http://foulab.org/fr/rss/Foulab_News: is not a W3C valid feed (November 2014) +* http://eu.battle.net/hearthstone/fr/feed/news: is not a W3C valid feed (Novembre 2014) +* http://webseriesmag.blogs.liberation.fr/we/atom.xml: is not working for the user but succeed on all the described validations (November 2014)
\ No newline at end of file diff --git a/docs/fr/contributing.md b/docs/fr/contributing.md new file mode 100644 index 000000000..c7ccb4d8a --- /dev/null +++ b/docs/fr/contributing.md @@ -0,0 +1,20 @@ +## Contribuer au code + +Pour cela, vous vous trouvez au bon endroit pour commencer : la documentation est là pour vous mettre le pied à l'étrier afin de découvrir le code. Voici une sélection de pages qui vous aideront à démarrer : + +- [Les premiers pas](developers/01_First_steps.md) +- [Comment l'on fonctionne sur GitHub](developers/02_Github.md) + +S'il vous manque des informations, n'hésitez pas à fouiller un peu la documentation ou venir nous poser directement vos questions sur [la mailing list des développeurs](https://freshrss.org/mailman/listinfo/dev). + +## Contribuer à la documentation + +Il ne vous aura pas échappé que la documentation est encore un peu vide… il y a énormément de choses à faire ! Si vous souhaitez aider à écrire quelques pages, prenez le temps de lire [les informations données sur Github](https://github.com/FreshRSS/documentation/blob/master/README.fr.md). + +Vous pouvez notamment regarder [les tickets ouverts avec le tag "Documentation"](https://github.com/FreshRSS/FreshRSS/issues?labels=Documentation&state=open). Il s'agit de la liste des choses assez spécifiques à ajouter à la documentation. + +## Contribuer au blog + +Vous souhaitez écrire un article à propos des technologies RSS/Atom/PubSubHubbub ou tout simplement nous donner un coup de main à la rédaction d'un billet ? Vous pouvez nous aider ! + +Pour cela, il suffit de vous rendre sur le dépôt GitHub [FreshRSS/freshrss.org](https://github.com/FreshRSS/freshrss.org) et de nous proposer une « Pull Request ». Les articles de blog doivent se trouver dans le répertoire `./blog` et être écrits en Markdown. diff --git a/docs/fr/developers/01_First_steps.md b/docs/fr/developers/01_First_steps.md new file mode 100644 index 000000000..400523e23 --- /dev/null +++ b/docs/fr/developers/01_First_steps.md @@ -0,0 +1,202 @@ +# Configurer son environnement + +**TODO** + +## Docker + +L'image Docker contenant l'environnement de développement de FreshRSS est accessible via : + +`$ docker pull marienfressinaud/freshrss` + +Vous pouvez lire [le fichier README du dépôt dédié](https://github.com/FreshRSS/docker-freshrss). + +# Architecture du projet + +**TODO** + +# Style de codage + +Si vous désirez contribuer au code, il est important de respecter le style de codage suivant. Le code actuel ne le respecte pas entièrement mais il est de notre devoir à tous de le changer dès que l'occasion se présente. + +Aucune nouvelle contribution ne respectant pas ces règles ne sera acceptée tant que les corrections nécessaires ne sont pas appliquées. + +## Espaces, tabulations et autres caractères blancs + +### Indentation +L'indentation du code doit être faite impérativement avec des tabulations. + +### Alignement + +Une fois l'indentation faite, il peut être nécessaire de faire un alignement pour simplifier la lecture. Dans ce cas, il faut utiliser les espaces. + +```php +$resultat = une_fonction_avec_un_nom_long($param1, $param2, + $param3, $param4); +``` + +### Fin de ligne + +Le caractère de fin de ligne doit être un saut de ligne (LF) qui est le caractère de fin de ligne des systèmes *NIX. Ce caractère ne doit pas être précédé par des caractères blanc. + +Il est possible de vérifier la présence de caractères blancs en fin de ligne grâce à Git avec la commande suivante : + +```bash +# commande à lancer avant l'ajout des fichiers dans l'index +git diff --check +# commande à lancer après l'ajout des fichiers dans l'index mais avant le commit +git diff --check --cached +``` + +### Fin de fichier + +Chaque fichier doit se terminer par une ligne vide. + +### Le cas de la virgule, du point et du point-virgule + +Il n'y a pas d'espace avant ces caractères, il y en a un après. + +### Le cas des opérateurs + +Chaque opérateur est entouré d'espaces. + +```php +if ($a == 10) { + // faire quelque chose +} + +echo $a ? 1 : 0; +``` + +### Le cas des parenthèses + +Il n'y a pas d'espaces entre des parenthèses. Il n'y a pas d'espaces avant une parenthèse ouvrante sauf si elle est précédée d'un mot-clé. Il n'y a pas d'espaces après une parenthèse fermante sauf si elle est suivie d'une accolade ouvrante. + +```php +if ($a == 10) { + // faire quelque chose +} + +if ((int)$a == 10) { + // faire quelque chose +} +``` + +### Le cas des fonctions chainées + +Ce cas se présente le plus souvent en Javascript. Quand on a des fonctions chainées, des fonctions anonymes ainsi que des fonctions de rappels, il est très facile de se perdre. Dans ce cas là, on ajoute une indentation supplémentaire pour toute l'instruction et on revient au même niveau pour une instruction de même niveau. + +```javascript +// Première instruction +shortcut.add(shortcuts.mark_read, function () { + //... + }, { + 'disable_in_input': true + }); +// Deuxième instruction +shortcut.add("shift+" + shortcuts.mark_read, function () { + //... + }, { + 'disable_in_input': true + }); +``` + +## Longueur des lignes + +Les lignes ne doivent pas dépasser 80 caractères. Il est cependant autorisé exceptionnellement de dépasser cette limite s'il n'est pas possible de la respecter mais en aucun cas, les lignes ne doivent dépasser les 100 caractères. + +Dans le cas des fonctions, les paramètres peuvent être déclarés sur plusieurs lignes. + +```php +function ma_fonction($param_1, $param_2, + $param_3, $param_4) { + // faire quelque chose +} +``` + +## Nommage + +L'ensemble des éléments du code (fonctions, classes, méthodes et variables) doivent être nommés de manière à décrire leur usage de façon concise. + +### Fonctions et variables + +Les fonctions et les variables doivent suivre la convention "snake case". + +```php +// une fontion +function nom_de_la_fontion() { + // faire quelque chose +} +// une variable +$nom_de_la_variable; +``` + +### Méthodes + +Les méthodes doivent suivre la convention "lower camel case". + +```php +private function nomDeLaMethode() { + // faire quelque chose +} +``` + +### Classes + +Les classes doivent suivre la convention "upper camel case". + +```php +abstract class NomDeLaClasse {} +``` + +## Encodage + +Les fichiers doivent être encodés en UTF-8. + +## Compatibilité avec PHP 5.3 + +Il ne faut pas demander l'indice d'un tableau qui est retourné par une fonction ou une méthode. Il faut passer par une variable intermédiaire. + +```php +// code compatible avec PHP 5.3 +$ma_variable = fonction_qui_retourne_un_tableau(); +echo $ma_variable[0]; +// code incompatible avec PHP 5.3 +echo fonction_qui_retourne_un_tableau()[0]; +``` + +Il ne faut pas utiliser la déclaration raccourcie des tableaux. + +```php +// code compatible avec PHP 5.3 +$variable = array(); +// code incompatible avec PHP 5.3 +$variable = []; +``` + +## Divers + +### Opérateurs +Les opérateurs doivent être en fin de ligne dans le cas de conditions sur plusieurs lignes. + +```php +if ($a == 10 || + $a == 20) { + // faire quelque chose +} +``` + +### Fin des fichiers + +Si le fichier ne contient que du PHP, il ne doit pas comporter de balise fermante + +### Tableaux + +Lors de l'écriture de tableaux sur plusieurs lignes, tous les éléments doivent être suivis d'une virgule (même le dernier). + +```php +$variable = array( + "valeur 1", + "valeur 2", + "valeur 3", +); +``` diff --git a/docs/fr/developers/02_Github.md b/docs/fr/developers/02_Github.md new file mode 100644 index 000000000..b4fa7b301 --- /dev/null +++ b/docs/fr/developers/02_Github.md @@ -0,0 +1,77 @@ +# Remonter un problème ou une suggestion + +Malgré le soin apporté à FreshRSS, il se peut que des bugs apparaissent encore. Le projet est jeune et le développement dynamique, aussi celui-ci pourra être corrigé rapidement. Il se peut aussi que vous ayez en tête une fonctionnalité qui n'existe pas encore. Que celle-ci vous paraisse idiote, farfelue, inutile ou trop spécifique, il ne faut surtout pas hésiter à nous la proposer ! Très souvent des "idées en l'air" ont trouvé une oreille attentive. Ce sont les regards externes qui font le plus évoluer le projet. + +Si vous êtes convaincus qu'il faut vous faire entendre, voici la marche à suivre. + +## Sur GitHub + +GitHub est la plate-forme à privilégier pour vos demandes. En effet, cela nous permet de pouvoir discuter à plusieurs sur un problème ou une suggestion et de faire émerger, souvent, des idées nouvelles. Ne négligeons pas cet aspect "social" ! + + 1. [Rendez-vous sur le gestionnaire de tickets de bugs](https://github.com/FreshRSS/FreshRSS/issues) + 2. Commencez par rechercher si une demande similaire n'a pas déjà été faite. Si oui, n'hésitez pas à ajouter votre voix à la demande. + 3. Si votre demande est nouvelle, [ouvrez un nouveau ticket de bug](https://github.com/FreshRSS/FreshRSS/issues/new) + 4. Rédigez enfin votre demande. Si vous maitrisez l'anglais, c'est la langue à privilégier car cela permet d'ouvrir la discussion à un plus grand nombre de personnes. Sinon, ce n'est pas grave, continuez en français :) + 5. Merci de bien vouloir suivre les quelques conseils donnés plus bas pour faciliter la prise en compte de votre ticket. + +## De façon informelle + +Tout le monde n'aime pas ou n'utilise pas GitHub pour des raisons aussi diverses que légitimes. C'est pourquoi vous pouvez aussi nous contacter de façon plus informelle. + +* Sur [les listes de diffusion](https://freshrss.org/announce-of-the-mailing-lists.html) +* À des évènements / rencontres autour du Logiciel Libre +* Autour d'une bière dans un bar +* Etc. + +## Conseils + +Voici quelques conseils pour bien présenter votre remontée de bug ou votre suggestion : + + +* **Faites attention à l'orthographe.** même si ce n'est pas toujours facile, faites votre maximum ;) +* **Donnez un titre explicite à votre demande**, quitte à ce qu'il soit un peu long. Cela nous aide non seulement à comprendre votre demande, mais aussi à retrouver votre ticket plus tard. +* **Une demande = un ticket.** Vous pouvez avoir des tas d'idées mais vous avez peur de spammer le gestionnaire de bugs : ça ne fait rien. Il vaut mieux avoir un peu trop de tickets que trop de demandes dans un seul. On s'occupera de fermer et regrouper les demandes qui le peuvent. +* Si vous remontez un bug, pensez à nous **fournir les logs de FreshRSS** (accessibles dans les dossier ''data/log/'' de FreshRSS) **et PHP** (l'emplacement peut varier selon les distributions, mais pensez à chercher dans ''/var/log/httpd'' ou ''/var/log/apache''). +* Si vous ne trouvez pas les fichiers de logs, précisez-le dans votre ticket afin que nous sachions que vous avez déjà cherché. +* Tous les bugs ne nécessitent pas les logs, mais si vous doutez, mieux vaut nous les fournir. Les logs sont importants et très utiles pour débugguer ! +* Il se peut que les logs puissent révéler des informations plus ou moins confidentielles, **faites attention à ne rien divulguer de sensible.** + +De plus, face à un bug, je ne peux que vous encourager à suivre le format de message suivant (tiré du [site de Max & Sam](http://sametmax.com/template-de-demande-daide-en-informatique/)) : + +---- + +**Quel est mon objectif ?** + +Donnez le contexte général de ce que vous essayiez de faire. + +**Qu’est-ce que j’ai essayé de faire ?** + +Expliquez pas à pas ce que vous avez fait afin que nous puissions reproduire le bug. + +**Quels résultats ai-je obtenus ?** + +Le bug : ce que vous voyez qui n'aurez pas dû se passer. Ici vous pouvez fournir les logs. + +**Quel était le résultat attendu ?** + +Afin que nous comprenions bien où est le problème... au moins selon vous :p + +**Quelle est ma situation ?** + +Pensez à donner les informations suivantes si vous les connaissez : + + 1. Quel navigateur ? Quelle version ? + 2. Quel serveur : Apache, Nginx ? Quelle version ? + 3. Quelle version de PHP ? + 4. MySQL ou SQLite ? Quelle version ? + 5. Quelle distribution sur le serveur ? Et… quelle version ? + +---- + +# Système de branches + +**TODO** + +# Proposer un patch + +**TODO**
\ No newline at end of file diff --git a/docs/fr/developers/03_Backend/01_Database_schema.md b/docs/fr/developers/03_Backend/01_Database_schema.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/fr/developers/03_Backend/01_Database_schema.md diff --git a/docs/fr/developers/03_Backend/02_Minz.md b/docs/fr/developers/03_Backend/02_Minz.md new file mode 100644 index 000000000..7699f9390 --- /dev/null +++ b/docs/fr/developers/03_Backend/02_Minz.md @@ -0,0 +1,27 @@ +# Modèles + +**TODO** + +# Contrôleurs et actions + +**TODO** + +# Vues + +**TODO** + +# Routage + +**TODO** + +# Écriture des URL + +**TODO** + +# Internationalisation + +**TODO** + +# Comprendres les mécanismes internes + +**TODO** diff --git a/docs/fr/developers/03_Backend/03_External_libraries.md b/docs/fr/developers/03_Backend/03_External_libraries.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/fr/developers/03_Backend/03_External_libraries.md diff --git a/docs/fr/developers/03_Backend/04_Changing_source_code.md b/docs/fr/developers/03_Backend/04_Changing_source_code.md new file mode 100644 index 000000000..0282dd9d2 --- /dev/null +++ b/docs/fr/developers/03_Backend/04_Changing_source_code.md @@ -0,0 +1,15 @@ +# Accès à la base de données + +**TODO** + +# Écrire une action et sa vue associée + +**TODO** + +# Gestion de l'authentification + +**TODO** + +# Gestion des logs + +**TODO** diff --git a/docs/fr/developers/03_Backend/05_Extensions.md b/docs/fr/developers/03_Backend/05_Extensions.md new file mode 100644 index 000000000..a3dc5ad20 --- /dev/null +++ b/docs/fr/developers/03_Backend/05_Extensions.md @@ -0,0 +1,335 @@ +# Fiche technique 0001 — Écriture d'extensions pour FreshRSS + +## Présentation de FreshRSS + +FreshRSS est un agrégateur de flux RSS / Atom écrit en PHP depuis octobre 2012. Le site officiel est situé à l'adresse [freshrss.org](https://freshrss.org) et son dépot Git est hébergé par Github : [github.com/FreshRSS/FreshRSS](https://github.com/FreshRSS/FreshRSS). + +## Problème à résoudre + +FreshRSS est limité dans ses possibilités techniques par différents facteurs : + +- La disponibilité des développeurs principaux ; +- La volonté d'intégrer certains changements ; +- Le niveau de « hack » nécessaire pour intégrer des fonctionnalités à la marge. + +Si la première limitation peut, en théorie, être levée par la participation de nouveaux contributeurs au projet, elle est en réalité conditionnée par la volonté des contributeurs à s'intéresser au code source du projet en entier. Afin de lever les deux autres limitations quant à elles, il faudra la plupart du temps passer par un « à-coté » souvent synonyme de « fork ». + +Une autre solution consiste à passer par un système d'extensions. En permettant à des utilisateurs d'écrire leur propre extension sans avoir à s'intéresser au cœur même du logiciel de base, on permet : + +1. De réduire la quantité de code source à assimiler pour un nouveau contributeur ; +2. De permettre d'intégrer des nouveautés de façon non-officielles ; +3. De se passer des développeurs principaux pour d'éventuelles améliorations sans passer par la case « fork ». + +Note : il est tout à fait imaginable que les fonctionnalités d'une extension puissent par la suite être intégrées dans le code initial de FreshRSS de façon officielle. Cela permet de proposer un « proof of concept » assez facilement. + + +## Comprendre les mécaniques de base (Minz et MVC) + +**TODO** : bouger dans 02_Minz.md + +Cette fiche technique devrait renvoyer vers la documentation officielle de FreshRSS et de Minz (le framework PHP sur lequel repose FreshRSS). Malheureusement cette documentation n'existe pas encore. Voici donc en quelques mots les principaux éléments à connaître. Il n'est pas nécessaire de lire l'ensemble des chapitres de cette section si vous n'avez pas à utiliser une fonctionnalité dans votre extension (si vous n'avez pas besoin de traduire votre extension, pas besoin d'en savoir plus sur le module `Minz_Translate` par exemple). + +### Architecture MVC + +Minz repose et impose une architecture MVC pour les projets l'utilisant. On distingue dans cette architecture trois composants principaux : + +- Le Modèle : c'est l'objet de base que l'on va manipuler. Dans FreshRSS, les catégories, les flux et les articles sont des modèles. La partie du code qui permet de les manipuler en base de données fait aussi partie du modèle mais est séparée du modèle de base : on parle de DAO (pour « Data Access Object »). Les modèles sont stockés dans un répertoire `Models`. +- La Vue : c'est ce qui représente ce que verra l'utilisateur. La vue est donc simplement du code HTML que l'on mixe avec du PHP pour afficher les informations dynamiques. Les vues sont stockées dans un répertoire `views`. +- Le Contrôleur : c'est ce qui permet de lier modèles et vues entre eux. Typiquement, un contrôleur va charger des modèles à partir de la base de données (une liste d'articles par exemple) pour les « passer » à une vue afin qu'elle les affiche. Les contrôleurs sont stockés dans un répertoire `Controllers`. + +### Le routage + +Afin de lier une URL à un contrôleur, on doit passer par une phase dite de « routage ». Dans FreshRSS, cela est particulièrement simple car il suffit d'indiquer le nom du contrôleur à charger dans l'URL à l'aide d'un paramètre `c`. Par exemple, l'adresse http://exemple.com?c=hello va exécuter le code contenu dans le contrôleur `hello`. + +Une notion qui n'a pas encore été évoquée est le système d'« actions ». Une action est exécutée *sur* un contrôleur. Concrètement, un contrôleur va être représenté par une classe et ses actions par des méthodes. Pour exécuter une action, il est nécessaire d'indiquer un paramètre `a` dans l'URL. + +Exemple de code : + +```php +<?php + +class FreshRSS_hello_Controller extends Minz_ActionController { + public function indexAction() { + $this->view->a_variable = 'FooBar'; + } + + public function worldAction() { + $this->view->a_variable = 'Hello World!'; + } +} + +?> +``` + +Si l'on charge l'adresse http://exemple.com?c=hello&a=world, l'action `world` va donc être exécutée sur le contrôleur `hello`. + +Note : si `c` ou `a` n'est pas précisée, la valeur par défaut de chacune de ces variables est `index`. Ainsi l'adresse http://exemple.com?c=hello va exécuter l'action `index` du contrôleur `hello`. + +Plus loin, sera utilisée la convention `hello/world` pour évoquer un couple contrôleur/action. + +### Gestion des vues + +Chaque vue est associée à un contrôleur et à une action. La vue associée à `hello/world` va être stockée dans un fichier bien spécifique : `views/hello/world.phtml`. Cette convention est imposée par Minz. + +Comme expliqué plus haut, les vues sont du code HTML mixé à du PHP. Exemple de code : + +```html +<p> + Phrase passée en paramètre : <?php echo $this->a_variable; ?> +</p> +``` + +La variable `$this->a_variable` a été passée précédemment par le contrôleur (voir exemple précédent). La différence est que dans le contrôleur il est nécessaire de passer par `$this->view` et que dans la vue `$this` suffit. + +### Accéder aux paramètres GET / POST + +Il est souvent nécessaire de profiter des paramètres passés par GET ou par POST. Dans Minz, ces paramètres sont accessibles de façon indistincts à l'aide de la classe `Minz_Request`. Exemple de code : + +```php +<?php + +$default_value = 'foo'; +$param = Minz_Request::param('bar', $default_value); + +// Affichera la valeur du paramètre `bar` (passé via GET ou POST) +// ou "foo" si le paramètre n'existe pas. +echo $param; + +// Force la valeur du paramètre `bar` +Minz_Request::_param('bar', 'baz'); + +// Affichera forcément "baz" puisque nous venons de forcer sa valeur. +// Notez que le second paramètre (valeur par défaut) est facultatif. +echo Minz_Request::param('bar'); + +?> +``` + +La méthode `Minz_Request::isPost()` peut être utile pour n'exécuter un morceau de code que s'il s'agit d'une requête POST. + +Note : il est préférable de n'utiliser `Minz_Request` que dans les contrôleurs. Il est probable que vous rencontriez cette méthode dans les vues de FreshRSS, voire dans les modèles, mais sachez qu'il ne s'agit **pas** d'une bonne pratique. + +### Accéder aux paramètres de session + +L'accès aux paramètres de session est étrangement similaire aux paramètres GET / POST mais passe par la classe `Minz_Session` cette fois-ci ! Il n'y a pas d'exemple ici car vous pouvez reprendre le précédent en changeant tous les `Minz_Request` par des `Minz_Session`. + +### Gestion des URL + +Pour profiter pleinement du système de routage de Minz, il est fortement déconseillé d'écrire les URL en dur dans votre code. Par exemple, la vue suivante doit être évitée : + +```html +<p> + Accéder à la page <a href="http://exemple.com?c=hello&a=world">Hello world</a>! +</p> +``` + +Si un jour il est décidé d'utiliser un système d'« url rewriting » pour avoir des adresses au format http://exemple.com/controller/action, toutes les adresses précédentes deviendraient ineffectives ! + +Préférez donc l'utilisation de la classe `Minz_Url` et de sa méthode `display()`. `Minz_Url::display()` prend en paramètre un tableau de la forme suivante : + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world', + 'params' => array( + 'foo' => 'bar', + ) +); + +// Affichera quelque chose comme .?c=hello&a=world&foo=bar +echo Minz_Url::display($url_array); + +?> +``` + +Comme cela peut devenir un peu pénible à utiliser à la longue, surtout dans les vues, il est préférable d'utiliser le raccourci `_url()` : + +```php +<?php + +// Affichera la même chose que précédemment +echo _url('hello', 'world', 'foo', 'bar'); + +?> +``` + +Note : en règle générale, la forme raccourcie (`_url()`) doit être utilisée dans les vues tandis que la forme longue (`Minz_Url::display()`) doit être utilisée dans les contrôleurs. + +### Redirections + +Il est souvent nécessaire de rediriger un utilisateur vers une autre page. Pour cela, la classe `Minz_Request` dispose d'une autre méthode utile : `forward()`. Cette méthode prend en argument le même format d'URL que celui vu juste avant. + +Exemple de code : + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world' +); + +// Indique à Minz de rediriger l'utilisateur vers la page hello/world. +// Notez qu'il s'agit d'une redirection au sens Minz du terme, pas d'une redirection que le navigateur va avoir à gérer (code HTTP 301 ou 302) +// Le code qui suit forward() va ainsi être exécuté ! +Minz_Request::forward($url_array); + +// Pour effectuer une redirection type 302, ajoutez "true". +// Le code qui suivra ne sera alors jamais exécuté. +Minz_Request::forward($url_array, true); + +?> +``` + +Il est très fréquent de vouloir effectuer une redirection tout en affichant un message à l'utilisateur pour lui indiquer comment s'est déroulée l'action effectuée juste avant (validation d'un formulaire par exemple). Un tel message est passé par une variable de session `notification` (note : nous parlerons plutôt de « feedback » désormais pour éviter la confusion avec une notification qui peut survenir à tout moment). Pour faciliter ce genre d'action très fréquente, il existe deux raccourcis qui effectuent tout deux une redirection type 302 en affectant un message de feedback : + +```php +<?php + +$url_array = array( + 'c' => 'hello', + 'a' => 'world' +); +$feedback_good = 'Tout s\'est bien passé !'; +$feedback_bad = 'Oups, quelque chose n\'a pas marché.'; + +Minz_Request::good($feedback_good, $url_array); + +// ou + +Minz_Request::bad($feedback_bad, $url_array); + +?> +``` + +### Gestion de la traduction + +Il est fréquent (et c'est un euphémisme) de vouloir afficher des phrases à l'utilisateur. Dans l'exemple précédent par exemple, nous affichions un feedback à l'utilisateur en fonction du résultat d'une validation de formulaire. Le problème est que FreshRSS possède des utilisateurs de différentes nationalités. Il est donc nécessaire de pouvoir gérer différentes langues pour ne pas rester cantonné à l'Anglais ou au Français. + +La solution consiste à utiliser la classe `Minz_Translate` qui permet de traduire dynamiquement FreshRSS (ou toute application basée sur Minz). Avant d'utiliser ce module, il est nécessaire de savoir où trouver les chaînes de caractères à traduire. Chaque langue possède son propre sous-répertoire dans un répertoire parent nommé `i18n`. Par exemple, les fichiers de langue en Français sont situés dans `i18n/fr/`. Il existe sept fichiers différents : + +- `admin.php` pour tout ce qui est relatif à l'administration de FreshRSS ; +- `conf.php` pour l'aspect configuration ; +- `feedback.php` contient les traductions des messages de feedback ; +- `gen.php` stocke ce qui est global à FreshRSS (gen pour « general ») ; +- `index.php` pour la page principale qui liste les flux et la page « À propos » ; +- `install.php` contient les phrases relatives à l'installation de FreshRSS ; +- `sub.php` pour l'aspect gestion des abonnements (sub pour « subscription »). + +Cette organisation permet de ne pas avoir un unique énorme fichier de traduction. + +Les fichiers de traduction sont assez simples : il s'agit seulement de retourner un tableau PHP contenant les traductions. Extrait du fichier `app/i18n/fr/gen.php` : + +```php +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualiser', + 'back_to_rss_feeds' => '← Retour à vos flux RSS', + 'cancel' => 'Annuler', + 'create' => 'Créer', + 'disable' => 'Désactiver', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'À propos de FreshRSS', + ), +); + +?> +``` + +Pour accéder à ces traductions, `Minz_Translate` va nous aider à l'aide de sa méthode `Minz_Translate::t()`. Comme cela peut être un peu long à taper, il a été introduit un raccourci qui **doit** être utilisé en toutes circonstances : `_t()`. Exemple de code : + +```html +<p> + <a href="<?php echo _url('index', 'index'); ?>"> + <?php echo _t('gen.action.back_to_rss_feeds'); ?> + </a> +</p> +``` + +La chaîne à passer à la fonction `_t()` consiste en une série d'identifiants séparés par des points. Le premier identifiant indique de quel fichier on veut extraire la traduction (dans notre cas présent, de `gen.php`), tandis que les suivantes indiquent des entrées de tableaux. Ainsi `action` est une entrée du tableau principal et `back_to_rss_feeds` est une entrée du tableau `action`. Cela permet d'organiser encore un peu plus nos fichiers de traduction. + +Il existe un petit cas particulier qui permet parfois de se simplifier la vie : le cas de l'identifiant `_`. Celui-ci doit nécessairement être présent en bout de chaîne et permet de donner une valeur à l'identifiant de niveau supérieur. C'est assez dur à expliquer mais très simple à comprendre. Dans l'exemple donné plus haut, un `_` est associé à la valeur `FreshRSS` : cela signifie qu'il n'y a pas besoin d'écrire `_t('gen.freshrss._')` mais `_t('gen.freshrss')` suffit. + +### Gestion de la configuration + +## Écrire une extension pour FreshRSS + +Nous y voilà ! Nous avons abordé les fonctionnalités les plus utiles de Minz et qui permettent de faire tourner FreshRSS correctement et il est plus que temps d'aborder les extensions en elles-même. + +Une extension permet donc d'ajouter des fonctionnalités facilement à FreshRSS sans avoir à toucher au cœur du projet directement. + +### Les fichiers et répertoires de base + +La première chose à noter est que **toutes** les extensions **doivent** se situer dans le répertoire `extensions`, à la base de l'arborescence de FreshRSS. Une extension est un répertoire contenant un ensemble de fichiers et sous-répertoires obligatoires ou facultatifs. La convention veut que l'on précède le nom du répertoire principal par un « x » pour indiquer qu'il ne s'agit pas d'une extension incluse par défaut dans FreshRSS. + +Le répertoire principal d'une extension doit comporter au moins deux fichiers **obligatoire** : + +- Un fichier `metadata.json` qui contient une description de l'extension. Ce fichier est écrit en JSON ; +- Un fichier `extension.php` contenant le point d'entrée de l'extension. + +Il est possible aussi que vous ayez besoin de fichiers ou sous-répertoires additionnels selon vos besoins : + +- `configure.phtml` est le fichier contenant le formulaire permettant de paramétrer votre extension ; +- Un répertoire `static/` contenant fichiers CSS et JavaScript dont vous aurez besoin pour votre extension. Notez que si vous devez écrire beaucoup de CSS il est peut-être plus intéressant d'écrire un thème complet (mais ce n'est pas le sujet de cette fiche technique) ; +- Un répertoire `controllers` contenant des contrôleurs additionnels ; +- Un répertoire `i18n` contenant des traductions supplémentaires ; +- Des répertoires `layout` et `views` permettant de définir de nouvelles vues ou d'écraser les vues actuelles. + +De plus, il est de bon ton d'avoir un fichier `LICENSE` indiquant la licence sous laquelle est distribuée votre extension et un fichier `README` donnant une description détaillée de celle-ci. + +### Écrire le fichier metadata.json + +Le fichier `metadata.json` définit votre extension à travers un certain nombre d'éléments importants. Il doit contenir un tableau JSON valide contenant les entrées suivantes : + +- `name` : le nom de votre extension ; +- `author` : votre nom, éventuellement votre adresse mail mais il n'y a pas de format spécifique à adopter ; +- `description` : une description de votre extension ; +- `version` : le numéro de version actuel de l'extension ; +- `entrypoint` : indique le point d'entrée de votre extension. Il doit correspondre au nom de la classe contenue dans le fichier `extension.php` sans le suffixe `Extension` (donc si le point d'entrée est `HelloWorld`, votre classe s'appellera `HelloWorldExtension`) ; +- `type` : définit le type de votre extension. Il existe deux types : `system` et `user`. Nous étudierons cette différence juste après. + +Seuls les champs `name` et `entrypoint` sont requis. + +### Choisir entre extension « system » ou « user » + +### Écrire le fichier extension.php + +Ce fichier est le point d'entrée de votre extension. Il doit contenir une classe bien spécifique pour fonctionner. Comme évoqué plus haut, le nom de la classe doit être votre `entrypoint` suffixé par `Extension` (`HelloWorldExtension` par exemple). De plus, cette classe doit héritée de la classe `Minz_Extension` pour bénéficier des méthodes propres aux extensions. + +Votre classe va bénéficier de quatre méthodes à redéfinir : + +- `install()` est appelée lorsqu'un utilisateur va cliquer sur le bouton pour activer votre extension. Elle permet par exemple de mettre à jour la base de données d'un utilisateur afin de la rendre compatible avec l'extension. Elle retourne `true` si tout s'est bien passé ou, dans le cas contraire, une chaîne de caractères expliquant le problème ; +- `uninstall()` est appelée lorsqu'un utilisateur va cliquer sur le bouton pour désactiver votre extension. Ainsi, vous pourrez annuler les changements en base de données que vous avez potentiellement faits dans `install()`. Elle retourne `true` si tout s'est bien passé ou, dans le cas contraire, une chaîne de caractères expliquant le problème ; +- `init()` est appelée à chaque chargement de page *si l'extension est activée*. Elle va donc initialiser le comportement de l'extension. C'est la méthode la plus importante ; +- `handleConfigureAction()` est appelée lorsqu'un utilisateur charge le panneau de gestion de l'extension. Plus précisément, elle est appelée lorsque l'URL `?c=extension&a=configure&e=le-nom-de-votre-extension` est chargée. Vous devriez aussi écrire ici le comportement voulu lors de la validation du formulaire contenu dans votre fichier `configure.phtml`. + +De plus, vous disposerez d'un certain nombre de méthodes directement héritées de `Minz_Extension` que vous ne devriez pas redéfinir : + +- Les « getters » tout d'abord. La plupart sont suffisamment explicites pour ne pas les détailler : `getName()`, `getEntrypoint()`, `getPath()` (permet de récupérer le chemin vers votre extension), `getAuthor()`, `getDescription()`, `getVersion()`, `getType()` ; +- `getFileUrl($filename, $type)` va vous retourner l'URL vers un fichier du répertoire `static`. Le premier paramètre est le nom du fichier (sans `static/`), le deuxième est le type de fichier à servir (`css` ou `js`) ; +- `registerController($base_name)` va indiquer à Minz de prendre en compte le contrôleur donné dans le système de routage. Le contrôleur doit se situer dans votre répertoire `Controllers`, le nom du fichier doit être `<base_name>Controller.php` et le nom de la classe `FreshExtension_<base_name>_Controller`. + +TODO : + +- `registerViews()` +- `registerTranslates()` +- `registerHook($hook_name, $hook_function)` + +### Système de « hooks » + +TODO : + +- `entry_before_display` (`function($entry) -> Entry | null`) +- `entry_before_insert` (`function($entry) -> Entry | null`) +- `feed_before_insert` (`function($feed) -> Feed | null`) +- `post_update` (`function(none) -> none`) + +### Écrire le fichier configure.phtml + +TODO diff --git a/docs/fr/developers/04_Frontend/01_View_files.md b/docs/fr/developers/04_Frontend/01_View_files.md new file mode 100644 index 000000000..45174bf58 --- /dev/null +++ b/docs/fr/developers/04_Frontend/01_View_files.md @@ -0,0 +1,15 @@ +# Les fichiers .phtml + +**TODO** + +# Écrire une URL + +**TODO** + +# Afficher une icône + +**TODO** + +# Internationalisation + +**TODO** diff --git a/docs/fr/developers/04_Frontend/02_Design.md b/docs/fr/developers/04_Frontend/02_Design.md new file mode 100644 index 000000000..d05a4c44c --- /dev/null +++ b/docs/fr/developers/04_Frontend/02_Design.md @@ -0,0 +1,11 @@ +# Fichier modèle + +**TODO** + +# Écrire un nouveau thème + +**TODO** + +# Surcharger les icônes + +**TODO** diff --git a/docs/fr/developers/05_Release_new_version.md b/docs/fr/developers/05_Release_new_version.md new file mode 100644 index 000000000..731dc0c76 --- /dev/null +++ b/docs/fr/developers/05_Release_new_version.md @@ -0,0 +1,112 @@ +# Préparer la sortie + +Afin d'avoir le plus de retour possible avant une sortie, il est préférable de l'annoncer sur GitHub en créant un ticket dédié ([voir les exemples](https://github.com/FreshRSS/FreshRSS/search?utf8=%E2%9C%93&q=Call+for+testing&type=Issues)). Ceci est à faire **au moins une semaine à l'avance**. + +Il est aussi recommandé de faire l'annonce sur mailing@freshrss.org. + +# S'assurer de l'état de dev + +Avant de sortir une nouvelle version de FreshRSS, il faut vous assurer que le code est stable et ne présente pas de bugs majeurs. Idéalement, il faudrait que nos tests soient automatisés et exécutés avant toute publication. + +Il faut aussi **vous assurer que le fichier CHANGELOG est à jour** dans la branche de dev avec les mises à jour de la ou les version(s) à sortir. + +# Processus Git + +```bash +$ git checkout master +$ git pull +$ git merge --ff dev +$ vim constants.php +# Mettre à jour le numéro de version x.y.z de FRESHRSS_VERSION +$ git commit -a +Version x.y.z +$ git tag -a x.y.z +Version x.y.z +$ git push && git push --tags +``` + +# Mise à jour de update.freshrss.org + +Il est important de mettre à jour update.freshrss.org puisqu'il s'agit du service par défaut gérant les mises à jour automatiques de FreshRSS. + +Le dépot gérant le code se trouve sur GitHub : [FreshRSS/update.freshrss.org](https://github.com/FreshRSS/update.freshrss.org/). + +## Écriture du script de mise à jour + +Les scripts se trouvent dans le répertoire `./scripts/` et doivent être de la forme `update_to_x.y.z.php`. On trouve aussi dans ce répertoire `update_to_dev.php` destiné aux mises à jour de la branche de dev (ce script ne doit pas inclure de code spécifique à une version particulière !) et `update_util.php` contenant une liste de fonctions utiles à tous les scripts. + +Afin d'écrire un nouveau script, il est préférable de copier / coller celui de la dernière version ou de partir de `update_to_dev.php`. La première chose à faire est de définir l'URL à partir de laquelle sera téléchargée le package FreshRSS (`PACKAGE_URL`). L'URL est de la forme `https://codeload.github.com/FreshRSS/FreshRSS/zip/x.y.z`. + +Il existe ensuite 5 fonctions à remplir : + +- `apply_update()` qui se charge de sauvegarder le répertoire contenant les données, de vérifier sa structure, de télécharger le package FreshRSS, de le déployer et de tout nettoyer. Cette fonction est pré-remplie mais des ajustements peuvent être faits si besoin est (ex. réorganisation de la structure de `./data`). Elle retourne `true` si aucun problème n'est survenu ou une chaîne de caractères indiquant un soucis ; +- `need_info_update()` retourne `true` si l'utilisateur doit intervenir durant la mise à jour ou `false` sinon ; +- `ask_info_update()` affiche un formulaire à l'utilisateur si `need_info_update()` a retourné `true` ; +- `save_info_update()` est chargée de sauvegarder les informations renseignées par l'utilisateur (issues du formulaire de `ask_info_update()`) ; +- `do_post_update()` est exécutée à la fin de la mise à jour et prend en compte le code de la nouvelle version (ex. si la nouvelle version modifie l'objet `Minz_Configuration`, vous bénéficierez de ces améliorations). + +## Mise à jour du fichier de versions + +Lorsque le script a été écrit et versionné, il est nécessaire de mettre à jour le fichier `./versions.php` qui contient une table de correspondances indiquant quelles versions sont mises à jour vers quelles autres versions. + +Voici un exemple de fichier `versions.php` : + +```php +<?php + +return array( + // STABLE + '0.8.0' => '1.0.0', + '0.8.1' => '1.0.0', + '1.0.0' => '1.0.1', // doesn't exist (yet) + // DEV + '1.1.2-dev' => 'dev', + '1.1.3-dev' => 'dev', + '1.1.4-dev' => 'dev', +); +``` + +Et voici comment fonctionne cette table : + +- à gauche se trouve la version N, à droite la version N+1 ; +- les versions `x.y.z-dev` sont **toutes** mises à jour vers `dev` ; +- les versions stables sont mises à jour vers des versions stables ; +- il est possible de sauter plusieurs versions d'un coup à condition que les scripts de mise à jour le prennent en charge ; +- il est conseillé d'indiquer la correspondance de la version courante vers sa potentielle future version en précisant que cette version n'existe pas encore. Tant que le script correspondant n'existera pas, rien ne se passera. + +Il est **très fortement** indiqué de garder ce fichier rangé selon les numéros de versions en séparant les versions stables et de dev. + +## Déploiement + +Avant de mettre à jour update.freshrss.org, il est préférable de tester avec dev.update.freshrss.org qui correspond à la pré-production. Mettez donc à jour dev.update.freshrss.org et changez l'URL `FRESHRSS_UPDATE_WEBSITE` de votre instance FreshRSS. Lancez la mise à jour et vérifiez que celle-ci se déroule correctement. + +Lorsque vous serez satisfait, mettez à jour update.freshrss.org avec le nouveau script et en testant de nouveau puis passez à la suite. + +# Mise à jour des services FreshRSS + +Deux services sont à mettre à jour immédiatement après la mise à jour de update.freshrss.org : + +- rss.freshrss.org ; +- demo.freshrss.org (identifiants publics : `demo` / `demodemo`). + +# Annoncer publiquement la sortie + +Lorsque tout fonctionne, il est temps d'annoncer la sortie au monde entier ! + +- sur GitHub en créant [une nouvelle release](https://github.com/FreshRSS/FreshRSS/releases/new) ; +- sur le blog de freshrss.org au minimum pour les versions stables (écrire l'article sur [FreshRSS/freshrss.org](https://github.com/FreshRSS/freshrss.org)). +- sur Twitter (compte [@FreshRSS](https://twitter.com/FreshRSS)) ; +- et sur mailing@freshrss.org ; + +# Lancer la prochaine version de développement + +```bash +$ git checkout dev +$ vim constants.php +# Mettre à jour le numéro de version de FRESHRSS_VERSION +$ vim CHANGELOG.md +# Préparer la section pour la prochaine version +$ git add CHANGELOG.md && git commit && git push +``` + +Pensez aussi à mettre à jour update.freshrss.org pour qu'il prenne en compte la version de développement actuelle. diff --git a/docs/fr/img/doc.edit.png b/docs/fr/img/doc.edit.png Binary files differnew file mode 100644 index 000000000..bc850e514 --- /dev/null +++ b/docs/fr/img/doc.edit.png diff --git a/docs/fr/img/logo_freshrss.png b/docs/fr/img/logo_freshrss.png Binary files differnew file mode 100644 index 000000000..763b19cb1 --- /dev/null +++ b/docs/fr/img/logo_freshrss.png diff --git a/docs/fr/img/users/anonymous_access.1.png b/docs/fr/img/users/anonymous_access.1.png Binary files differnew file mode 100644 index 000000000..65f985705 --- /dev/null +++ b/docs/fr/img/users/anonymous_access.1.png diff --git a/docs/fr/img/users/feed.add.1.png b/docs/fr/img/users/feed.add.1.png Binary files differnew file mode 100644 index 000000000..b6146857f --- /dev/null +++ b/docs/fr/img/users/feed.add.1.png diff --git a/docs/fr/img/users/feed.filter.1.png b/docs/fr/img/users/feed.filter.1.png Binary files differnew file mode 100644 index 000000000..519ae41bf --- /dev/null +++ b/docs/fr/img/users/feed.filter.1.png diff --git a/docs/fr/img/users/feed.filter.2.png b/docs/fr/img/users/feed.filter.2.png Binary files differnew file mode 100644 index 000000000..5e8dd2899 --- /dev/null +++ b/docs/fr/img/users/feed.filter.2.png diff --git a/docs/fr/img/users/refresh.1.png b/docs/fr/img/users/refresh.1.png Binary files differnew file mode 100644 index 000000000..44b7cb156 --- /dev/null +++ b/docs/fr/img/users/refresh.1.png diff --git a/docs/fr/img/users/refresh.2.png b/docs/fr/img/users/refresh.2.png Binary files differnew file mode 100644 index 000000000..78e577704 --- /dev/null +++ b/docs/fr/img/users/refresh.2.png diff --git a/docs/fr/img/users/refresh.3.png b/docs/fr/img/users/refresh.3.png Binary files differnew file mode 100644 index 000000000..e80bfc29f --- /dev/null +++ b/docs/fr/img/users/refresh.3.png diff --git a/docs/fr/img/users/refresh.4.png b/docs/fr/img/users/refresh.4.png Binary files differnew file mode 100644 index 000000000..abbeb5cd4 --- /dev/null +++ b/docs/fr/img/users/refresh.4.png diff --git a/docs/fr/img/users/refresh.5.png b/docs/fr/img/users/refresh.5.png Binary files differnew file mode 100644 index 000000000..13c885cb1 --- /dev/null +++ b/docs/fr/img/users/refresh.5.png diff --git a/docs/fr/img/users/refresh.6.png b/docs/fr/img/users/refresh.6.png Binary files differnew file mode 100644 index 000000000..0d78e3976 --- /dev/null +++ b/docs/fr/img/users/refresh.6.png diff --git a/docs/fr/img/users/status.filter.0.7.png b/docs/fr/img/users/status.filter.0.7.png Binary files differnew file mode 100644 index 000000000..4516b937f --- /dev/null +++ b/docs/fr/img/users/status.filter.0.7.png diff --git a/docs/fr/img/users/status.filter.0.8.png b/docs/fr/img/users/status.filter.0.8.png Binary files differnew file mode 100644 index 000000000..5a0b9a3a1 --- /dev/null +++ b/docs/fr/img/users/status.filter.0.8.png diff --git a/docs/fr/img/users/token.1.png b/docs/fr/img/users/token.1.png Binary files differnew file mode 100644 index 000000000..9685e5b43 --- /dev/null +++ b/docs/fr/img/users/token.1.png diff --git a/docs/fr/index.md b/docs/fr/index.md new file mode 100644 index 000000000..d43eaec4e --- /dev/null +++ b/docs/fr/index.md @@ -0,0 +1,22 @@ + + +FreshRSS est un agrégateur et lecteur de flux RSS. Il permet de regrouper l'actualité de plusieurs sites différents dans un endroit unique pour que vous puissiez la lire sans devoir aller de site en site. + +FreshRSS a été conçu comme un agrégateur puissant et propose des tas de fonctionnalités : + +- Agrégation des flux RSS et Atom. +- Utilisez les favoris pour marquer les articles qui vous ont plu ou que vous souhaitez lire plus tard. +- Le système de filtrage et de recherche permettent de cibler exactement les articles que vous souhaitez lire. +- Les statistiques permettent de savoir en un coup d'œil quels sont les sites qui publient le plus, ou à l'inverse, le moins. +- Importation / exportation des flux au format OPML. +- Multi-thèmes pour changer l'habillage de FreshRSS. +- « *Responsive design* » : l'application s'adapte aux petits écrans pour emporter FreshRSS dans votre poche. +- Multi-utilisateurs pour héberger plusieurs personnes sur une même installation. +- API Google Reader pour pouvoir y brancher des applications Android. +- Auto-hébergeable : le code source est libre (AGPL3) et vous pouvez donc l'héberger sur votre propre serveur. +- Et bien d'autres ! + +Cette documentation est partagée en deux parties : + +- La [documentation utilisateurs](users/02_First_steps.md) pour découvrir plus en profondeur les fonctionnalités de FreshRSS. +- La [documentation développeurs](developers/01_First_steps.md) pour savoir comment contribuer et mieux comprendre le code source de FreshRSS. diff --git a/docs/fr/users/01_Installation.md b/docs/fr/users/01_Installation.md new file mode 100644 index 000000000..dd1bacd00 --- /dev/null +++ b/docs/fr/users/01_Installation.md @@ -0,0 +1,141 @@ +# Les pré-requis sur le serveur + +FreshRSS est un logiciel développé en PHP reposant sur le modèle client - serveur. C’est-à-dire qu’il vous faudra un serveur web pour en profiter. Ensuite, FreshRSS ne demande pas une configuration très fournie et peut donc, en théorie, tourner sur la plupart des serveurs mutualisés. + +Il est toutefois de votre responsabilité de vérifier que votre hébergement permettra de faire tourner FreshRSS avant de nous taper dessus. Dans le cas où les informations listées ci-dessous ne seraient pas à jour, vous pourrez. + + | Logiciel | Recommandé | Fonctionne aussi avec | + | -------- | ----------- | --------------------- | + | Serveur web | **Apache 2** | Nginx | + | PHP | **PHP 5.5+** | PHP 5.3.8+ | + | Modules PHP | Requis : libxml, cURL, PDO_MySQL, PCRE et ctype \\ Requis (32 bits seulement) : GMP \\ Recommandé : JSON, Zlib, mbstring et iconv, ZipArchive | | + | Base de données | **MySQL 5.0.3+** | SQLite 3.7.4+ | + | Navigateur | **Firefox** | Chrome, Opera, Safari, or IE 11+ | + +## Note importante + +FreshRSS **PEUT** fonctionner sur la version de PHP 5.3.8+. En effet, nous utilisons des fonctions spécifiques pour la connexion par formulaire et notamment la [bibliothèque ''password_compat''](https://github.com/ircmaxell/password_compat#requirements). + +# Choisir la bonne version de FreshRSS + +FreshRSS possède trois versions différentes (nous parlons de branches) qui sortent à des fréquences plus ou moins rapides. Aussi prenez le temps de comprendre à quoi correspond chacune de ces versions. + +## La version stable + +[Téléchargement](https://github.com/FreshRSS/FreshRSS/archive/master.zip) + +Cette version sort lorsqu’on considère qu’on a répondu à nos objectifs en terme de nouvelles fonctionnalités. Deux versions peuvent ainsi sortir de façon très rapprochée si les développeurs travaillent bien. En pratique, comme nous nous fixons de nombreux objectifs et que nous travaillons sur notre temps libre, les versions sont souvent assez espacées (plusieurs mois). Son avantage est que le code est particulièrement stable et vous ne devriez pas faire face à de méchants bugs. + +## La version de développement + +[Téléchargement](https://github.com/FreshRSS/FreshRSS/archive/dev.zip) + +Comme son nom l’indique, il s’agit de la version sur laquelle les développeurs travaillent. **Elle est donc instable !** Si vous souhaitez recevoir les améliorations au jour le jour, vous pouvez l’utiliser, mais attention à bien suivre les évolutions sur Github (via [le flux RSS de la branche](https://github.com/FreshRSS/FreshRSS/commits/dev.atom) par exemple). On raconte que les développeurs principaux l’utilisent quotidiennement sans avoir de soucis. Sans doute savent-ils ce qu’ils font… + +# Installation sur Apache + +``` +<VirtualHost *:80> + DocumentRoot /var/www/html/ + + #Site par défaut... + + ErrorLog ${APACHE_LOG_DIR}/error.default.log + CustomLog ${APACHE_LOG_DIR}/access.default.log vhost_combined +</VirtualHost> + +<VirtualHost *:80> + ServerName rss.example.net + DocumentRoot /path/to/FreshRSS/p/ + + <Directory /path/to/FreshRSS/p> + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted + </Directory> + + ErrorLog ${APACHE_LOG_DIR}/freshrss_error.log + CustomLog ${APACHE_LOG_DIR}/freshrss_access.log combined + + AllowEncodedSlashes On +</VirtualHost> + +<IfModule mod_ssl.c> + <VirtualHost *:443> + ServerName rss.example.net + DocumentRoot /path/to/FreshRSS/p/ + + <Directory /path/to/FreshRSS/p> + AllowOverride AuthConfig FileInfo Indexes Limit + Require all granted + </Directory> + + ErrorLog ${APACHE_LOG_DIR}/freshrss_error.log + CustomLog ${APACHE_LOG_DIR}/freshrss_access.log combined + + <IfModule mod_http2.c> + Protocols h2 http/1.1 + </IfModule> + + # Pour l’API + AllowEncodedSlashes On + + SSLEngine on + SSLCompression off + SSLCertificateFile /path/to/server.crt + SSLCertificateKeyFile /path/to/server.key + # Additional SSL configuration, e.g. with LetsEncrypt + </VirtualHost> +</IfModule> +``` + +# Installation sur Nginx + +Voici un fichier de configuration pour nginx. Il couvre la configuration pour HTTP, HTTPS, et PHP. + +_Vous pourrez trouver d’autres fichiers de configuration plus simples mais ces derniers ne seront peut-être pas compatibles avec l’API FreshRSS._ + +``` +server { + listen 80; + listen 443 ssl; + + # configuration https + ssl on; + ssl_certificate /etc/nginx/server.crt; + ssl_certificate_key /etc/nginx/server.key; + + # l’URL ou les URLs de votre serveur + server_name rss.example.net; + + # le répertoire où se trouve le dossier p de FreshRSS + root /srv/FreshRSS/p/; + + index index.php index.html index.htm; + + # les fichiers de log nginx + access_log /var/log/nginx/rss.access.log; + error_log /var/log/nginx/rss.error.log; + + # gestion des fichiers php + # il est nécessaire d’utiliser cette expression régulière pour le bon fonctionnement de l’API + location ~ ^.+?\.php(/.*)?$ { + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + # Par défaut la variable PATH_INFO n’est pas définie sous PHP-FPM + # or l’API FreshRSS greader.php en a besoin. Si vous avez un “Bad Request”, vérifiez bien cette dernière ! + fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + location / { + try_files $uri $uri/ index.php; + } +} +``` + +Pour un tutoriel pas à pas, vous pouvez suivre [cet article dédié](http://www.pihomeserver.fr/2013/05/08/raspberry-pi-home-server-installer-un-agregateur-de-flux-rss-pour-remplacer-google-reader/). + +# Conseils de sécurité + +**TODO** diff --git a/docs/fr/users/02_First_steps.md b/docs/fr/users/02_First_steps.md new file mode 100644 index 000000000..589453f28 --- /dev/null +++ b/docs/fr/users/02_First_steps.md @@ -0,0 +1,25 @@ +Découvrir un nouveau logiciel n'est pas toujours facile. Si nous avons voulu FreshRSS le plus intuitif possible, vous aurez peut-être besoin d'un coup de main pour le maîtriser. + +Cette section se propose de vous aider dans la prise en main de l'outil. Il ne s'agit que de liens menant vers les autres pages de la documentation mais ordonnées dans un ordre spécifique aux nouveaux arrivants. + +[Après l'installation](01_Installation.md), la première chose à faire est d'ajouter un ou plusieurs sites à suivre. Pour cela plusieurs choix s'offrent à vous : + + 1. [Ajouter un flux manuellement](04_Subscriptions.md#ajouter-un-flux) + 2. [Importer un fichier OPML ou JSON](04_Subscriptions.md#import-et-export) + 3. [Utiliser le bookmark dédié](04_Subscriptions.md#utiliser-le-bookmark) + +Une fois que vous avez ajouté vos flux à FreshRSS, il est temps de les lire. Pour cela, trois modes de lecture s'offrent à vous : + + 1. [La vue normale](03_Main_view.md#la-vue-normale) qui permet de voir et de lire rapidement les nouveaux articles + 2. [La vue globale](03_Main_view.md#la-vue-globale) est destinée à vous offrir un panorama de l'état de vos flux + 3. [La vue lecture](03_Main_view.md#la-vue-lecture) est pensée pour vous offrir un meilleur confort de lecture + +Bien, vous maitrisez maintenant la vue que vous préférez ? Il est temps de vous offrir un peu plus de confort de lecture. FreshRSS est grandement configurable et c'est à vous de trouver la configuration qui vous conviendra le plus. Voici tout de même quelques pistes pour améliorer votre quotidien sur FreshRSS : + +* [Rangez vos flux dans des catégories](04_Subscriptions.md#organisation_des_flux) +* [Configurez votre page d'accueil](05_Configuration.md#personnaliser-la-vue) +* [Configurez vos options de lecture](05_Configuration.md#options-de-lecture) +* [Mettez à jour vos flux](03_Main_view.md#rafraichir-les-flux) +* [Filtrez les articles](03_Main_view.md#filtrer-les-articles) pour accéder rapidement à ceux que vous voulez lire en priorité +* [Retrouvez un article](03_Main_view.md#rechercher-des-articles) qui a été publié il y a quelques jours ou mois +* [Accédez à vos flux même sur mobile](06_Mobile_access.md) diff --git a/docs/fr/users/03_Main_view.md b/docs/fr/users/03_Main_view.md new file mode 100644 index 000000000..744141b7d --- /dev/null +++ b/docs/fr/users/03_Main_view.md @@ -0,0 +1,183 @@ +# La vue normale + +**TODO** + +# La vue globale + +**TODO** + +# La vue lecture + +**TODO** + +# Rafraîchir les flux + +Pour profiter pleinement de FreshRSS, il faut qu’il récupère les nouveaux articles disponibles des flux auxquels vous avez souscrit. Pour cela, il existe plusieurs méthodes. + +## Mise à jour automatique + +C’est la méthode recommandée car il n’y a pas besoin d’y penser, elle se fait toute seule, à la fréquence que vous avez choisi. + +### Par le script actualize_script.php + +Cette méthode n’est possible que si vous avez accès aux tâches planifiées de la machine sur laquelle est installée votre instance de FreshRSS. + +Le script qui permet de mettre à jour les articles s’appelle *actualize_script.php* et se trouve dans le répertoire *app* de votre instance de FreshRSS. La syntaxe des tâches planifiées ne sera pas expliqué ici, cependant voici [une introduction rapide à crontab](http://www.adminschoice.com/crontab-quick-reference/) qui peut vous aider. + +Ci-dessous vous trouverez un exemple permettant la mise à jour des articles toutes les heures. + +```cron +0 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +``` + + +### Cron en-ligne + +Il se peut que vous n’ayez pas accès aux tâches planifiées du serveur hébergeant votre instance de FreshRSS. Il reste une possibilité pour mettre les flux à jour automatiquement. + +Pour cela vous devez paramétrer une tâche cron qui devra charger régulièrement une url spécifique : https://votre.serveur.net/FreshRSS/p/i/?c=feed&a=actualize (à adapter selon votre installation). Différents cas de figure peuvent se présenter à vous désormais. + +##### Aucune authentification + +C’est le cas le plus simple, puisque votre instance est publique, vous n’avez rien de particulier à préciser : + +```cron +0 * * * * curl 'https://votre.serveur.net/FreshRSS/p/i/?c=feed&a=actualize' +``` + +##### Authentification par formulaire ou Persona + +Dans ces cas-là, si vous avez autorisé la lecture anonyme des articles, vous pouvez aussi permettre à n’importe qui de rafraîchir vos flux (« Autoriser le rafraîchissement anonyme des flux »). + + + +L’url précédente devient donc accessible à n’importe qui et vous pouvez utiliser la tâche cron de la partie précédente. + +Vous pouvez aussi configurer un jeton d’authentification pour accorder un droit spécial sur votre serveur. + + + +La tâche cron à utiliser sera de la forme suivante : + +```cron +0 * * * * curl 'https://votre.serveur.net/FreshRSS/p/i/?c=feed&a=actualize&token=mon-token' +``` + + +##### Authentification HTTP + +Dans ce cas-là, le token et les permissions “anonymes” sont inutilisables et il vous sera nécessaire d’indiquer vos identifiants dans la tâche cron. **Notez que cette solution est grandement déconseillée puisqu’elle implique que vos identifiants seront visibles en clair !** + +```cron +0 * * * * curl -u alice:password123 'https://votre.serveur.net/FreshRSS/p/i/?c=feed&a=actualize' +``` + +## Mise à jour manuelle + +Si vous ne pouvez pas ou ne voulez pas utiliser la méthode automatique, vous pouvez le faire de façon manuelle. Il existe deux méthodes qui permettent de mettre à jour tout ou partie des flux. + +### Mise à jour complète + +Cette mise à jour se fait pour l’ensemble des flux de l’instance. Pour initier cette mise à jour, il suffit de cliquer sur le lien de mise à jour disponible dans le menu de navigation. + + + +Lorsque la mise à jour démarre, une barre de progression apparait et s’actualise au fur et à mesure de la récupération des articles. + + + +### Mise à jour partielle + +Cette mise à jour se fait pour le flux sélectionné uniquement. Pour initier cette mise à jour, il suffit de cliquer sur le lien de mise à jour disponible dans le menu du flux. + + + +# Filtrer les articles + +Avec le nombre croissant d’articles stockés par FreshRSS, il devient important d’avoir des filtres efficaces pour n’afficher qu’une partie des articles. Il existe plusieurs méthodes qui filtrent selon des critères différents. Ces méthodes peuvent être combinées dans la plus part des cas. + +##Par catégorie + +C’est la méthode la plus simple. Il suffit de cliquer sur le titre d’une catégorie dans le panneau latéral. Il existe deux catégories spéciales qui sont placées en haut dudit panneau : + + * *Flux principal* qui affiche uniquement les articles des flux marqués comme visible dans cette catégorie + * *Favoris* qui affiche uniquement les articles, tous flux confondus, marqués comme favoris + +##Par flux + +Il existe plusieurs méthodes pour filtrer les articles par flux : + + * en cliquant sur le titre du flux dans le panneau latéral + * en cliquant sur le titre du flux dans le détail de l’article + * en filtrant dans les options du flux dans le panneau latéral + * en filtrant dans la configuration du flux + + + +##Par statut + +Chaque article possède deux attributs qui peuvent être combinés. Le premier attribut indique si l’article a été lu ou non. Le second attribut indique si l’article a été noté comme favori ou non. + +Dans la version 0.7.x, les filtres sur les attributs sont accessibles depuis la liste déroulante qui gère l’affichage des articles. Dans cette version, il n’est pas possible de combiner les filtres. Par exemple, on ne peut pas afficher les articles lus qui ont été notés comme favori. + + + +À partir de la version 0.8, les filtres sur les attributs sont directement accessibles. Il est maintenant possible de les combiner. Comme il est possible de faire toutes les combinaisons, il y en a certaines qui retournent le même résultat. Par exemple, si les quatre filtres sont activés ou désactivés, le résultat sera le même. + + + +Par défaut, le filtre n’affiche que les articles qui n’ont pas été lus. + +##Par contenu + +Il est possible de filtrer les articles par leur contenu en entrant une chaine de caractères dans le champ de recherche prévu à cet effet. + +##Grâce au champ de recherche + +Il est possible d’utiliser le champ de recherche pour raffiner les résultats : + +* par auteur : `author:nom` or `author:'nom composé'` +* par titre : `intitle:mot` or `intitle:'mot composé'` +* par URL: `inurl:mot` or `inurl:'mot composé'` +* par tag: `#tag` +* par texte libre : `mot` or `'mot composé'` +* par date de découverte, en utilisant le [format d’intervalle de dates ISO 8601](https://fr.wikipedia.org/wiki/ISO_8601#Les_dur.C3.A9es_et_intervalles) : `date:<intervalle>` + * D’un jour, mois, ou année : + * `date:2014-03-30` + * `date:2014-03` or `date:201403` + * `date:2014` + * D’une heure précise d’un jour donné : + * `date:2014-05-30T13` + * `date:2014-05-30T13:30` + * Entre deux dates : + * `date:2014-02/2014-04` + * `date:2014-02--2014-04` + * `date:2014-02/04` + * `date:2014-02-03/05` + * `date:2014-02-03T22:00/22:15` + * `date:2014-02-03T22:00/15` + * Après une date donnée : + * `date:2014-03/` + * Avant une date donnée : + * `date:/2014-03` + * Pour une certaine durée après une date donnée : + * `date:2014-03/P1W` + * Pour une certaine durée avant une date donnée : + * `date:P1W/2014-05-25T23:59:59` + * Pour une certaine durée avant l’instant présent (la barre oblique est optionnelle) : + * `date:P1Y/` ou `date:P1Y` (depuis un an) + * `date:P2M/` (depuis deux mois) + * `date:P3W/` (depuis trois semaines) + * `date:P4D/` (depuis quatre jours) + * `date:PT5H/` (depuis cinq heures) + * `date:PT30M/` (depuis trente minutes) + * `date:PT90S/` (depuis 90 seconds) + * `date:P1DT1H/` (depuis un jour et une heure) +* par date de publication, en utilisant le même format : `pubdate:<intervalle>` + +Attention à ne pas introduire d’espace entre l’opérateur et la valeur recherchée. + +Certains opérateurs peuvent être utilisé négativement, pour exclure des articles, avec la même syntaxe que ci-dessus, mais préfixé par `!` ou `-` : +`-author:nom`, `-intitle:mot`, `-inurl:mot`, `-#tag`, `!mot`. + +Il est également possible de combiner les mots-clefs pour faire un filtrage encore plus précis, and et il est autorisé d’avoir plusieurs instances de : `author:`, `intitle:`, `inurl:`, `#`, et texte libre. diff --git a/docs/fr/users/04_Subscriptions.md b/docs/fr/users/04_Subscriptions.md new file mode 100644 index 000000000..ae4541c29 --- /dev/null +++ b/docs/fr/users/04_Subscriptions.md @@ -0,0 +1,15 @@ +# Ajouter un flux + +**TODO** + +# Import et export + +**TODO** + +# Utiliser le « bookmark » + +**TODO** + +# Organisation des flux + +**TODO** diff --git a/docs/fr/users/05_Configuration.md b/docs/fr/users/05_Configuration.md new file mode 100644 index 000000000..75deff462 --- /dev/null +++ b/docs/fr/users/05_Configuration.md @@ -0,0 +1,119 @@ +# Personnaliser la vue + +##Langue +À l'heure actuelle, FreshRSS est disponible en français et en anglais. Après validation de ce choix, la totalité de l'interface sera affichée dans la langue choisie. + +Il y a des parties de FreshRSS qui ne sont pas traduites et qui n'ont pas vocation à l'être. Pour le moment, les logs visibles dans l'application ainsi que celle générées par le script de mise à jour automatique en font partie. + +##Thème +Les goûts et les couleurs, ça ne se discute pas. C'est pourquoi FreshRSS propose six thèmes officiels : + + * *Blue Lagoon* par **Mister aiR** + * *Dark* par **AD** + * *Flat design* par **Marien Fressinaud** + * *Origine* par **Marien Fressinaud** + * *Pafat* par **Plopoyop** + * *Screwdriver* par **Mister aiR** + +Si aucun de ceux proposés ne convient, il est toujours possible de créer son propre thème. + +Pour sélectionner un thème, il suffit de faire défiler les thèmes jusqu'à l'apparition du thème choisi. Après validation, le thème sera appliqué à l'interface. + +##Largeur du contenu +Il y en a qui préfère des lignes de texte courtes, d'autres qui préfèrent maximiser l'espace disponible sur l'écran. Pour satisfaire le maximum de personne, il est possible de choisir la largeur du contenu affiché. Il y a quatre réglages disponibles : + + * **Fine** qui affiche le contenu jusqu'à 550 pixels + * **Moyenne** qui affiche le contenu jusqu'à 800 pixels + * **Large** qui affiche le contenu jusqu'à 1000 pixels + * **Pas de limite** qui affiche le contenu sur 100% de la place disponible + +##Icônes d'article + +**TODO** + +##Temps d'affichage de la notification HTML5 +Après la mise à jour automatique des flux, FreshRSS utilise l'API de notification de HTML5 pour avertir de l'arrivée de nouveaux articles. + +Il est possible de régler la durée d'affichage de cette notification. Par défaut, la valeur est 0. + +# Options de lecture + +**TODO** + +# Archivage + +**TODO** + +# Partage + +**TODO** + +# Raccourcis + +**TODO** + +# Filtres + +**TODO** + +# Utilisateurs + +**TODO** + +## Méthodes d'authentification + +**Brouillon** + +### Authentification HTTP + + 1. Ne laisse rien de visible + 2. Pour Apache, basé sur un fichier .htaccess + - Exemple de .htaccess pour un utilisateur "marie" à placer dans le répertoire de FreshRSS ou dans un répertoire parent : + +``` +AuthUserFile /home/marie/repertoire/.htpasswd +AuthGroupFile /dev/null +AuthName "Chez Marie" +AuthType Basic +Require user marie +``` + +Plus d'informations dans [la documentation d'Apache.](http://httpd.apache.org/docs/trunk/howto/auth.html#gettingitworking) + + +# Gestion des flux + +## Informations + +**TODO** + +## Archivage + +**TODO** + +## Identification + +**TODO** + +## Avancé + +### Récupérer un flux tronqué + +La question revient régulièrement, je vais essayer de clarifier ici comment on peut récupérer un flux RSS tronqué avec FreshRSS. Sachez avant tout que la manière de s'y prendre n'est absolument pas "user friendly", mais elle fonctionne :) + +Sachez aussi que par cette manière vous générez beaucoup plus de trafic vers les sites d'origines et qu'ils peuvent vous bloquer par conséquent. Les performances de FreshRSS sont aussi moins bonnes car vous devez alors aller chercher le contenu des articles un par un. C'est donc une fonctionnalité à utiliser avec parcimonie ! + +Ce que j'entends par "Chemin CSS des articles sur le site d’origine" correspond en fait au "chemin" constitué par les IDs et les classes (en html, correspond aux attributs id et class) pour récupérer uniquement la partie intéressante qui correspond à l'article. L'idéal est que ce chemin commence par un id (qui est unique pour la page) + +#### Exemple 1 : Rue89 + +Pour trouver ce chemin, il faut se rendre à l'adresse d'un des articles tronqués (par exemple http://www.rue89.com/2013/10/15/prof-maths-jai-atteint-lextase-dihn-pedagogie-inversee-246635). Il faut alors chercher le "bloc" HTML correspondant au contenu de l'article (dans le code source !) + +On trouve ici que le bloc qui englobe uniquement le contenu de l'article est ```<div class="content clearfix">```. On ne va garder que la classe .content ici. Néanmoins, comme je le disais plus haut, il est préférable de commencer le chemin avec un id. Si on remonte au bloc parent, il s'agit du bloc ```<div id="article">``` et c'est parfait ! Le chemin sera donc ```#article .content``` + +#### Liste de correspondances site -> chemin css + +* Rue89 : ```#article .content``` +* PCINpact : ```#actu_content``` +* Lesnumériques : ```article#body div.text.clearfix``` + diff --git a/docs/fr/users/06_Mobile_access.md b/docs/fr/users/06_Mobile_access.md new file mode 100644 index 000000000..185c94098 --- /dev/null +++ b/docs/fr/users/06_Mobile_access.md @@ -0,0 +1,49 @@ +Cette page suppose que vous avez fini [l’installation du serveur](01_Installation.md). + +# Activer l’API dans FreshRSS + +1. Dans la section “Authentification”, cocher l’option “Autoriser l’accès par API (nécessaire pour les applis mobiles)”. +2. Dans la section “Profil”, remplir le champ “Mot de passe API (ex. : pour applis mobiles)”. + * Chaque utilisateur doit choisir son mot de passe API. + * La raison d’être d’un mot de passe API différent du mot de passe principal est que le mot de passe API est potentiellement utilisé de manière moins sûre, mais il permet aussi moins de choses. + + +# Tester + +3. Dans la section “Profil”, cliquer sur le lien de la forme `https://rss.example.net/api/` à côté du champ “Mot de passe API”. +4. Cliquer sur le premier lien “Check full server configuration”: + * Si vous obtenez `PASS`, tout est bon : passer à l’étape 6. + * Si vous obtenez *Bad Request!* ou *Not Found*, alors votre serveur ne semble pas accepter les slashs `/` qui sont encodés `%2F`. Passer à l’étape 5. + * Si vous obtenez un autre message d’erreur, passer à l’étape 5. + + +# Débogger la configuration du serveur + +5. Cliquer sur le second lien “Check partial server configuration (without `%2F` support)”: + * Si vous obtenez `PASS`, alors le problème est bien que votre serveur n’accepte pas les slashs `/` qui sont encodés `%2F`. + * Avec Apache, vérifiez la directive [`AllowEncodedSlashes On`](http://httpd.apache.org/docs/trunk/mod/core.html#allowencodedslashes) + * Ou utilisez un client qui n’encode pas les slashs (comme EasyRSS), auquel cas passer à l’étape 6. + * Si vous obtenez *Service Unavailable!*, retourner à l’étape 6. + * Avec __Apache__: + * Si vous obtenez *FAIL getallheaders!*, alors la combinaison de votre version de PHP et de votre serveur Web ne permet pas l’accès à [`getallheaders`](http://php.net/getallheaders) + * Utilisez au moins PHP 5.4+, ou utilisez PHP en tant que module plutôt que CGI. Sinon, activer Apache `mod_rewrite` : + * Autoriser [`FileInfo` dans `.htaccess`](http://httpd.apache.org/docs/trunk/mod/core.html#allowoverride) : revoir [l’installation du serveur](01_Installation.md). + * Activer [`mod_rewrite`](http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html) : + * Sur Debian / Ubuntu : `sudo a2enmod rewrite` + * Avec __nginx__: + * Si vous obtenez *Bad Request!*, vérifier la configuration `PATH_INFO` de votre serveur. + * Si vous obtenez *File not found!*, vérifier la configuration `fastcgi_split_path_info` de votre serveur. + * Si vous obtenez *FAIL 64-bit or GMP extension!*, alors votre installation PHP soit n’est pas en 64 bit, soit n’a pas l’extension PHP [GMP](http://php.net/gmp) activée. + * Le plus simple est d’activer l’extension GMP. Sur Debian / Ubuntu : `sudo apt install php-gmp` + * Mettre à jour et retourner à l’étape 3. + + +# Clients compatibles + +Tout client supportant une API de type Google Reader. Sélection : + +* Android + * [News+](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus) avec [News+ Google Reader extension](https://play.google.com/store/apps/details?id=com.noinnion.android.newsplus.extension.google_reader) (Propriétaire) + * [EasyRSS](https://github.com/Alkarex/EasyRSS) (Libre, F-Droid) +* Linux + * [FeedReader 2.0+](https://jangernert.github.io/FeedReader/) (Libre) diff --git a/docs/fr/users/07_Frequently_Asked_Questions.md b/docs/fr/users/07_Frequently_Asked_Questions.md new file mode 100644 index 000000000..9dc80b2e4 --- /dev/null +++ b/docs/fr/users/07_Frequently_Asked_Questions.md @@ -0,0 +1,35 @@ +Il est possible que nous n'ayons pas répondu à toutes vos questions dans les parties précédentes. La FAQ regroupe certaines interrogations qui n'ont pas trouvé leur réponse ailleurs. + +## C'est quoi ce /i à la fin de l'URL ? + +Bien entendu, le ```/i``` n'est pas là pour faire joli ! Il s'agit d'une question de performances et de praticité : + +* Cela permet de servir les icônes, images, styles, scripts sans cookie. Sans cela, ces fichiers seraient souvent re-téléchargés, en particulier lorsque Persona ou le formulaire de connexion sont utilisés. De plus, les requêtes vers ces ressources seraient plus lourdes. +* La racine publique ```./p/``` peut être servie sans restriction d'accès HTTP (qui peut avantageusement être mise en place dans ```./p/i/```). +* Cela permet d'éviter des problèmes pour des fichiers qui doivent être publics pour bien fonctionner, comme ```favicon.ico```, ```robots.txt```, etc. +* Cela permet aussi d'avoir un logo FreshRSS plutôt qu'une page blanche pour accueillir l'utilisateur par exemple dans le cas de la restriction d'accès HTTP ou lors de l'attente du chargement plus lourd du reste de l'interface. + +## Pourquoi le ```robots.txt``` se trouve dans un sous-répertoire ? + +Afin d'améliorer la sécurité, FreshRSS est découpé en deux parties : une partie publique (le répertoire ```./p```) et une partie privée (tout le reste !). Le ```robots.txt``` se trouve donc dans le sous-répertoire ```./p```. + +Comme expliqué dans les [conseils de sécurité](01_Installation.md#conseils-de-securite), il est recommandé de faire pointer un nom de domaine vers ce sous-répertoire afin que seule la partie publique ne soit accessible par un navigateur web. De cette manière http://demo.freshrss.org/ pointe vers le répertoire ```./p``` et le ```robots.txt``` se trouve bien à la racine du site : http://demo.freshrss.org/robots.txt. + +L'explication est la même pour les fichiers ```favicon.ico``` et ```.htaccess```. + +## Pourquoi j'ai des erreurs quand j'essaye d'enregistrer un flux ? + +Il peut y avoir différentes origines à ce problème. +Le flux peut avoir une syntaxe invalide, il peut ne pas être reconnu par la bibliothèque SimplePie, l'hébergement peut avoir des problèmes, FreshRSS peut être boggué. +Il faut dans un premier temps déterminer la cause du problème. +Voici la liste des étapes à suivre pour la déterminer : + +1. __Vérifier la validité du flux__ grâce à l'[outil en ligne du W3C](http://validator.w3.org/feed/ "Validateur en ligne de flux RSS et Atom"). Si ça ne fonctionne pas, nous ne pouvons rien faire. +1. __Vérifier la reconnaissance par SimplePie__ grâce à l'[outil en ligne de SimplePie](http://simplepie.org/demo/ "Démo officielle de SimplePie"). Si ça ne fonctionne pas, nous ne pouvons rien faire. +1. __Vérifier l'intégration dans FreshRSS__ grâce à la [démo](http://demo.freshrss.org "Démo officielle de FreshRSS"). Si ça ne fonctionne pas, il faut [créer un ticket sur Github](https://github.com/FreshRSS/FreshRSS/issues/new "Créer un ticket pour FreshRSS") pour que l'on puisse regarder ce qui se passe. Si ça fonctionne, il y a probablement un problème avec l'hébergement. + +Voici une liste des flux qui ne fonctionnent pas : + +* http://foulab.org/fr/rss/Foulab_News : ne passe pas la validation W3C (novembre 2014) +* http://eu.battle.net/hearthstone/fr/feed/news : ne passe pas la validation W3C (novembre 2014) +* http://webseriesmag.blogs.liberation.fr/we/atom.xml : ne fonctionne pas chez l'utilisateur mais passe l'ensemble des validations ci-dessus (novembre 2014) diff --git a/docs/fr/users/08_PubSubHubbub.md b/docs/fr/users/08_PubSubHubbub.md new file mode 100644 index 000000000..0f2f14794 --- /dev/null +++ b/docs/fr/users/08_PubSubHubbub.md @@ -0,0 +1,15 @@ +# Qu'est-ce que PubSubHubbub ? + +Derrière ce nom barbare se cache un protocole qui vient compléter Atom et RSS. En effet, le fonctionnement de base de ces deux derniers implique de vérifier à intervalles réguliers s'il existe de nouveaux articles sur les sites suivis. Cela même si le site concerné n'a rien publié depuis la dernière synchronisation. Le protocole PubSubHubbub permet d'éviter des synchronisations inutiles en notifiant en temps réel l'agrégateur de la présence de nouveaux articles. + +# Fonctionnement de PubSubHubbub + +On va retrouver trois notions dans PubSubHubbub : les éditeurs (les sites qui publient du contenu), les abonnés (les agrégateurs de flux RSS) et les hubs. + +Lorsqu'un agrégateur s'abonne à un site et récupère son flux RSS, il peut y trouver l'adresse d'un hub. Si c'est le cas — car un site peut ne pas en préciser —, l'agrégateur va s'abonner au hub et non pas à l'éditeur directement. Ainsi, lorsqu'un éditeur va publier du contenu, il va notifier le hub qui va lui-même notifier et envoyer le contenu à tous ses abonnés. + +Pour pouvoir être notifié, les abonnés doivent fournir une adresse accessible publiquement sur Internet. + +# PubSubHubbub et FreshRSS + +Depuis la version 1.1.2-beta, FreshRSS supporte officiellement PubSubHubbub. Vous pouvez donc recevoir en temps réel les articles des sites qui affichent dans leur flux RSS un « hub ». diff --git a/docs/img/FreshRSS-logo.png b/docs/img/FreshRSS-logo.png Binary files differnew file mode 100644 index 000000000..763b19cb1 --- /dev/null +++ b/docs/img/FreshRSS-logo.png diff --git a/docs/img/FreshRSS-screenshot.png b/docs/img/FreshRSS-screenshot.png Binary files differnew file mode 100644 index 000000000..2bcd6e6bf --- /dev/null +++ b/docs/img/FreshRSS-screenshot.png diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..9afdcec38 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,6 @@ +# Welcome on FreshRSS documentation center! + +This documentation is under construction. If you want to contribute, [find us on GitHub](https://github.com/FreshRSS/FreshRSS). + +- [English documentation](./en/index.md) +- [Documentation française](./fr/index.md) diff --git a/extensions/README.md b/extensions/README.md index 4c1a81f5c..62766d6f2 100644 --- a/extensions/README.md +++ b/extensions/README.md @@ -1,3 +1,5 @@ # FreshRSS extensions -You may place in this directory some custom extensions for FreshRSS. +You may place custom extensions for FreshRSS in this directory. + +You can find some extensions in our [GitHub repository](https://github.com/FreshRSS/Extensions). diff --git a/force-https.default.txt b/force-https.default.txt new file mode 100644 index 000000000..044620098 --- /dev/null +++ b/force-https.default.txt @@ -0,0 +1,7 @@ +dailymotion.com +feedburner.com +gravatar.com +gstatic.com +tumblr.com +wordpress.com +youtube.com diff --git a/index.html b/index.html index 6ac025960..5414211a1 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ <meta charset="UTF-8" /> <meta http-equiv="Refresh" content="0; url=p/" /> <title>Redirection</title> -<meta name="robots" content="noindex,nofollow" /> +<meta name="robots" content="noindex" /> </head> <body> diff --git a/lib/Favicon/DataAccess.php b/lib/Favicon/DataAccess.php deleted file mode 100644 index 2bfdf640e..000000000 --- a/lib/Favicon/DataAccess.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -namespace Favicon; - -/** - * DataAccess is a wrapper used to read/write data locally or remotly - * Aside from SOLID principles, this wrapper is also useful to mock remote resources in unit tests - * Note: remote access warning are silenced because we don't care if a website is unreachable - **/ -class DataAccess { - public function retrieveUrl($url) { - $this->set_context(); - return @file_get_contents($url); - } - - public function retrieveHeader($url) { - $this->set_context(); - return @get_headers($url, TRUE); - } - - public function saveCache($file, $data) { - file_put_contents($file, $data); - } - - public function readCache($file) { - return file_get_contents($file); - } - - private function set_context() { - stream_context_set_default( - array( - 'http' => array( - 'method' => 'GET', - 'timeout' => 10, - 'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0; Favicon; +https://github.com/ArthurHoaro/favicon) Gecko/20100101 Firefox/32.0\r\n", - ) - ) - ); - } -}
\ No newline at end of file diff --git a/lib/Favicon/Favicon.php b/lib/Favicon/Favicon.php deleted file mode 100644 index 7ea6ccf16..000000000 --- a/lib/Favicon/Favicon.php +++ /dev/null @@ -1,293 +0,0 @@ -<?php - -namespace Favicon; - -class Favicon -{ - protected $url = ''; - protected $cacheDir; - protected $cacheTimeout; - protected $dataAccess; - - public function __construct($args = array()) - { - if (isset($args['url'])) { - $this->url = $args['url']; - } - - $this->cacheDir = __DIR__ . '/../../resources/cache'; - $this->dataAccess = new DataAccess(); - } - - public function cache($args = array()) { - if (isset($args['dir'])) { - $this->cacheDir = $args['dir']; - } - - if (!empty($args['timeout'])) { - $this->cacheTimeout = $args['timeout']; - } else { - $this->cacheTimeout = 0; - } - } - - public static function baseUrl($url, $path = false) - { - $return = ''; - - if (!$url = parse_url($url)) { - return FALSE; - } - - // Scheme - $scheme = isset($url['scheme']) ? strtolower($url['scheme']) : null; - if ($scheme != 'http' && $scheme != 'https') { - - return FALSE; - } - $return .= "{$scheme}://"; - - // Username and password - if (isset($url['user'])) { - $return .= $url['user']; - if (isset($url['pass'])) { - $return .= ":{$url['pass']}"; - } - $return .= '@'; - } - - // Hostname - if( !isset($url['host']) ) { - return FALSE; - } - - $return .= $url['host']; - - // Port - if (isset($url['port'])) { - $return .= ":{$url['port']}"; - } - - // Path - if( $path && isset($url['path']) ) { - $return .= $url['path']; - } - $return .= '/'; - - return $return; - } - - public function info($url) - { - if(empty($url) || $url === false) { - return false; - } - - $max_loop = 5; - - // Discover real status by following redirects. - $loop = TRUE; - while ($loop && $max_loop-- > 0) { - $headers = $this->dataAccess->retrieveHeader($url); - $exploded = explode(' ', $headers[0]); - - if( !isset($exploded[1]) ) { - return false; - } - list(,$status) = $exploded; - - switch ($status) { - case '301': - case '302': - $url = $headers['Location']; - break; - default: - $loop = FALSE; - break; - } - } - - return array('status' => $status, 'url' => $url); - } - - public function endRedirect($url) { - $out = $this->info($url); - return !empty($out['url']) ? $out['url'] : false; - } - - /** - * Find remote (or cached) favicon - * @return favicon URL, false if nothing was found - **/ - public function get($url = '') - { - // URLs passed to this method take precedence. - if (!empty($url)) { - $this->url = $url; - } - - // Get the base URL without the path for clearer concatenations. - $original = rtrim($this->baseUrl($this->url, true), '/'); - $url = rtrim($this->endRedirect($this->baseUrl($this->url, false)), '/'); - - if(($favicon = $this->checkCache($url)) || ($favicon = $this->getFavicon($url))) { - $base = true; - } - elseif(($favicon = $this->checkCache($original)) || ($favicon = $this->getFavicon($original, false))) { - $base = false; - } - else - return false; - - // Save cache if necessary - $cache = $this->cacheDir . '/' . md5($base ? $url : $original); - if ($this->cacheTimeout && !file_exists($cache) || (is_writable($cache) && time() - filemtime($cache) > $this->cacheTimeout)) { - $this->dataAccess->saveCache($cache, $favicon); - } - - return $favicon; - } - - private function getFavicon($url, $checkDefault = true) { - $favicon = false; - - if(empty($url)) { - return false; - } - - // Try /favicon.ico first. - if( $checkDefault ) { - $info = $this->info("{$url}/favicon.ico"); - if ($info['status'] == '200') { - $favicon = $info['url']; - } - } - - // See if it's specified in a link tag in domain url. - if (!$favicon) { - $favicon = $this->getInPage($url); - } - - // Make sure the favicon is an absolute URL. - if( $favicon && filter_var($favicon, FILTER_VALIDATE_URL) === false ) { - $favicon = $url . '/' . $favicon; - } - - // Sometimes people lie, so check the status. - // And sometimes, it's not even an image. Sneaky bastards! - // If cacheDir isn't writable, that's not our problem - if ($favicon && is_writable($this->cacheDir) && !$this->checkImageMType($favicon)) { - $favicon = false; - } - - return $favicon; - } - - private function getInPage($url) { - $html = $this->dataAccess->retrieveUrl("{$url}/"); - preg_match('!<head.*?>.*</head>!ims', $html, $match); - - if(empty($match) || count($match) == 0) { - return false; - } - - $head = $match[0]; - - $dom = new \DOMDocument(); - // Use error supression, because the HTML might be too malformed. - if (@$dom->loadHTML($head)) { - $links = $dom->getElementsByTagName('link'); - foreach ($links as $link) { - if ($link->hasAttribute('rel') && strtolower($link->getAttribute('rel')) == 'shortcut icon') { - return $link->getAttribute('href'); - } elseif ($link->hasAttribute('rel') && strtolower($link->getAttribute('rel')) == 'icon') { - return $link->getAttribute('href'); - } elseif ($link->hasAttribute('href') && strpos($link->getAttribute('href'), 'favicon') !== FALSE) { - return $link->getAttribute('href'); - } - } - } - return false; - } - - private function checkCache($url) { - if ($this->cacheTimeout) { - $cache = $this->cacheDir . '/' . md5($url); - if (file_exists($cache) && is_readable($cache) && (time() - filemtime($cache) < $this->cacheTimeout)) { - return $this->dataAccess->readCache($cache); - } - } - return false; - } - - private function checkImageMType($url) { - $tmpFile = $this->cacheDir . '/tmp.ico'; - - $fileContent = $this->dataAccess->retrieveUrl($url); - $this->dataAccess->saveCache($tmpFile, $fileContent); - - $finfo = finfo_open(FILEINFO_MIME_TYPE); - $isImage = strpos(finfo_file($finfo, $tmpFile), 'image') !== false; - finfo_close($finfo); - - unlink($tmpFile); - - return $isImage; - } - - /** - * @return mixed - */ - public function getCacheDir() - { - return $this->cacheDir; - } - - /** - * @param mixed $cacheDir - */ - public function setCacheDir($cacheDir) - { - $this->cacheDir = $cacheDir; - } - - /** - * @return mixed - */ - public function getCacheTimeout() - { - return $this->cacheTimeout; - } - - /** - * @param mixed $cacheTimeout - */ - public function setCacheTimeout($cacheTimeout) - { - $this->cacheTimeout = $cacheTimeout; - } - - /** - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * @param string $url - */ - public function setUrl($url) - { - $this->url = $url; - } - - /** - * @param DataAccess $dataAccess - */ - public function setDataAccess($dataAccess) - { - $this->dataAccess = $dataAccess; - } -} diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php index b47c54554..232a4ef9b 100644 --- a/lib/Minz/ActionController.php +++ b/lib/Minz/ActionController.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ @@ -24,7 +24,7 @@ class Minz_ActionController { public function view () { return $this->view; } - + /** * Méthodes à redéfinir (ou non) par héritage * firstAction est la première méthode exécutée par le Dispatcher @@ -34,5 +34,3 @@ class Minz_ActionController { public function firstAction () { } public function lastAction () { } } - - diff --git a/lib/Minz/ActionException.php b/lib/Minz/ActionException.php index c566a076f..f1f70c1bc 100644 --- a/lib/Minz/ActionException.php +++ b/lib/Minz/ActionException.php @@ -3,7 +3,7 @@ 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/Configuration.php b/lib/Minz/Configuration.php index ab5bb4fc2..5470dc85f 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -39,7 +39,7 @@ class Minz_Configuration { throw new Minz_FileNotExistException($filename); } - $data = @include($filename); + $data = include($filename); if (is_array($data)) { return $data; } else { @@ -85,11 +85,6 @@ class Minz_Configuration { private $data = array(); /** - * The default values, an empty array by default. - */ - private $data_default = array(); - - /** * An object which help to set good values in configuration. */ private $configuration_setter = null; @@ -109,7 +104,7 @@ class Minz_Configuration { /** * Create a new Minz_Configuration object. - * + * * @param $namespace the name of the current configuration. * @param $config_filename the file containing configuration values. * @param $default_filename the file containing default values, null by default. @@ -119,21 +114,22 @@ class Minz_Configuration { $configuration_setter = null) { $this->namespace = $namespace; $this->config_filename = $config_filename; + $this->default_filename = $default_filename; + $this->_configurationSetter($configuration_setter); + + if (!is_null($this->default_filename)) { + $this->data = self::load($this->default_filename); + } try { - $this->data = self::load($this->config_filename); + $this->data = array_replace_recursive( + $this->data, self::load($this->config_filename) + ); } catch (Minz_FileNotExistException $e) { - if (is_null($default_filename)) { + if (is_null($this->default_filename)) { throw $e; } } - - $this->default_filename = $default_filename; - if (!is_null($this->default_filename)) { - $this->data_default = self::load($this->default_filename); - } - - $this->_configurationSetter($configuration_setter); } /** @@ -149,7 +145,7 @@ class Minz_Configuration { /** * Return the value of the given param. - * + * * @param $key the name of the param. * @param $default default value to return if key does not exist. * @return the value corresponding to the key. @@ -160,8 +156,6 @@ class Minz_Configuration { return $this->data[$key]; } elseif (!is_null($default)) { return $default; - } elseif (isset($this->data_default[$key])) { - return $this->data_default[$key]; } else { Minz_Log::warning($key . ' does not exist in configuration'); return null; diff --git a/lib/Minz/ControllerNotActionControllerException.php b/lib/Minz/ControllerNotActionControllerException.php index 535a1377e..1a8e0729c 100644 --- a/lib/Minz/ControllerNotActionControllerException.php +++ b/lib/Minz/ControllerNotActionControllerException.php @@ -3,7 +3,7 @@ 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 index 523867d11..24a09a635 100644 --- a/lib/Minz/ControllerNotExistException.php +++ b/lib/Minz/ControllerNotExistException.php @@ -3,7 +3,7 @@ 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 index 74214d879..3e3d9d1b4 100644 --- a/lib/Minz/CurrentPagePaginationException.php +++ b/lib/Minz/CurrentPagePaginationException.php @@ -2,7 +2,7 @@ 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 125ce5757..bdb1c76f6 100644 --- a/lib/Minz/Dispatcher.php +++ b/lib/Minz/Dispatcher.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index d7ee8fe81..78b8a2725 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -168,7 +168,7 @@ class Minz_Extension { $url = '/ext.php?f=' . $file_name_url . '&t=' . $type . '&' . $mtime; - return Minz_Url::display($url); + return Minz_Url::display($url, 'php'); } /** diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index c5c68a8d4..02a99701f 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -94,8 +94,8 @@ class Minz_ExtensionManager { * If the extension class name is `TestExtension`, entry point will be `Test`. * `entry_point` must be composed of alphanumeric characters. * - * @param $meta is an array of values. - * @return true if the array is valid, false else. + * @param array $meta is an array of values. + * @return bool true if the array is valid, false else. */ public static function isValidMetadata($meta) { $valid_chars = array('_'); @@ -107,8 +107,8 @@ class Minz_ExtensionManager { /** * Load the extension source code based on info metadata. * - * @param $info an array containing information about extension. - * @return an extension inheriting from Minz_Extension. + * @param array $info an array containing information about extension. + * @return Minz_Extension|null an extension inheriting from Minz_Extension. */ public static function load($info) { $entry_point_filename = $info['path'] . '/' . self::$ext_entry_point; @@ -127,9 +127,9 @@ class Minz_ExtensionManager { $extension = null; try { $extension = new $ext_class_name($info); - } catch (Minz_ExtensionException $e) { + } catch (Exception $e) { // We cannot load the extension? Invalid! - Minz_Log::warning('In `' . $metadata_filename . '`: ' . $e->getMessage()); + Minz_Log::warning('Invalid extension `' . $ext_class_name . '`: ' . $e->getMessage()); return null; } @@ -149,7 +149,7 @@ class Minz_ExtensionManager { * If the extension is present in $ext_auto_enabled and if its type is "system", * it will be enabled in the same time. * - * @param $ext a valid extension. + * @param Minz_Extension $ext a valid extension. */ public static function register($ext) { $name = $ext->getName(); @@ -168,7 +168,7 @@ class Minz_ExtensionManager { * * The extension init() method will be called. * - * @param $ext_name is the name of a valid extension present in $ext_list. + * @param Minz_Extension $ext_name is the name of a valid extension present in $ext_list. */ public static function enable($ext_name) { if (isset(self::$ext_list[$ext_name])) { @@ -182,7 +182,7 @@ class Minz_ExtensionManager { /** * Enable a list of extensions. * - * @param $ext_list the names of extensions we want to load. + * @param string[] $ext_list the names of extensions we want to load. */ public static function enableByList($ext_list) { foreach ($ext_list as $ext_name) { @@ -193,8 +193,8 @@ class Minz_ExtensionManager { /** * Return a list of extensions. * - * @param $only_enabled if true returns only the enabled extensions (false by default). - * @return an array of extensions. + * @param bool $only_enabled if true returns only the enabled extensions (false by default). + * @return Minz_Extension[] an array of extensions. */ public static function listExtensions($only_enabled = false) { if ($only_enabled) { @@ -207,8 +207,8 @@ class Minz_ExtensionManager { /** * Return an extension by its name. * - * @param $ext_name the name of the extension. - * @return the corresponding extension or null if it doesn't exist. + * @param string $ext_name the name of the extension. + * @return Minz_Extension|null the corresponding extension or null if it doesn't exist. */ public static function findExtension($ext_name) { if (!isset(self::$ext_list[$ext_name])) { @@ -224,9 +224,9 @@ class Minz_ExtensionManager { * The hook name must be a valid one. For the valid list, see self::$hook_list * array keys. * - * @param $hook_name the hook name (must exist). - * @param $hook_function the function name to call (must be callable). - * @param $ext the extension which register the hook. + * @param string $hook_name the hook name (must exist). + * @param callable $hook_function the function name to call (must be callable). + * @param Minz_Extension $ext the extension which register the hook. */ public static function addHook($hook_name, $hook_function, $ext) { if (isset(self::$hook_list[$hook_name]) && is_callable($hook_function)) { @@ -241,8 +241,8 @@ class Minz_ExtensionManager { * The hook name must be a valid one. For the valid list, see self::$hook_list * array keys. * - * @param $hook_name the hook to call. - * @param additionnal parameters (for signature, please see self::$hook_list). + * @param string $hook_name the hook to call. + * @param additional parameters (for signature, please see self::$hook_list). * @return the final result of the called hook. */ public static function callHook($hook_name) { diff --git a/lib/Minz/FileNotExistException.php b/lib/Minz/FileNotExistException.php index f8dfbdf66..f97f161af 100644 --- a/lib/Minz/FileNotExistException.php +++ b/lib/Minz/FileNotExistException.php @@ -2,7 +2,7 @@ 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 f9eff3db6..066278b7c 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -33,7 +33,7 @@ class Minz_FrontController { try { Minz_Configuration::register('system', DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + FRESHRSS_PATH . '/config.default.php'); $this->setReporting(); Minz_Request::init(); @@ -119,12 +119,12 @@ class Minz_FrontController { switch($conf->environment) { case 'production': error_reporting(E_ALL); - ini_set('display_errors','Off'); + ini_set('display_errors', 'Off'); ini_set('log_errors', 'On'); break; case 'development': error_reporting(E_ALL); - ini_set('display_errors','On'); + ini_set('display_errors', 'On'); ini_set('log_errors', 'On'); break; case 'silent': diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index f4a547c4e..c328d9e6b 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ @@ -13,7 +13,7 @@ class Minz_Helper { * @param $var variable à traiter (tableau ou simple variable) */ public static function stripslashes_r($var) { - if (is_array($var)){ + if (is_array($var)) { return array_map(array('Minz_Helper', 'stripslashes_r'), $var); } else { return stripslashes($var); diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index 2a9e10993..5e7831cdb 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -29,6 +29,7 @@ class Minz_Log { * @param $information message d'erreur / information à enregistrer * @param $level niveau d'erreur * @param $file_name fichier de log + * @throws Minz_PermissionDeniedException */ public static function record ($information, $level, $file_name = null) { try { @@ -42,7 +43,11 @@ class Minz_Log { || ($env === 'production' && ($level >= Minz_Log::NOTICE)))) { if ($file_name === null) { - $file_name = join_path(USERS_PATH, Minz_Session::param('currentUser', '_'), 'log.txt'); + $username = Minz_Session::param('currentUser', ''); + if ($username == '') { + $username = '_'; + } + $file_name = join_path(USERS_PATH, $username, 'log.txt'); } switch ($level) { @@ -66,6 +71,8 @@ class Minz_Log { . ' [' . $level_label . ']' . ' --- ' . $information . "\n"; + self::ensureMaxLogSize($file_name); + if (file_put_contents($file_name, $log, FILE_APPEND | LOCK_EX) === false) { throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR); } @@ -73,6 +80,36 @@ class Minz_Log { } /** + * Make sure we do not waste a huge amount of disk space with old log messages. + * + * This method can be called multiple times for one script execution, but its result will not change unless + * you call clearstatcache() in between. We won't due do that for performance reasons. + * + * @param $file_name + * @throws Minz_PermissionDeniedException + */ + protected static function ensureMaxLogSize($file_name) { + $maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 1048576; + if ($maxSize > 0 && @filesize($file_name) > $maxSize) { + $fp = fopen($file_name, 'c+'); + if ($fp && flock($fp, LOCK_EX)) { + fseek($fp, -intval($maxSize / 2), SEEK_END); + $content = fread($fp, $maxSize); + rewind($fp); + ftruncate($fp, 0); + fwrite($fp, $content ? $content : ''); + fflush($fp); + flock($fp, LOCK_UN); + } else { + throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR); + } + if ($fp) { + fclose($fp); + } + } + } + + /** * Automatise le log des variables globales $_GET et $_POST * Fait appel à la fonction record(...) * Ne fonctionne qu'en environnement "development" diff --git a/lib/Minz/Model.php b/lib/Minz/Model.php index adbaba942..1310888cf 100644 --- a/lib/Minz/Model.php +++ b/lib/Minz/Model.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php index ff23dbc83..1ac2b313d 100644 --- a/lib/Minz/ModelArray.php +++ b/lib/Minz/ModelArray.php @@ -25,8 +25,7 @@ class Minz_ModelArray { protected function loadArray() { if (!file_exists($this->filename)) { throw new Minz_FileNotExistException($this->filename, Minz_Exception::WARNING); - } - elseif (($handle = $this->getLock()) === false) { + } elseif (($handle = $this->getLock()) === false) { throw new Minz_PermissionDeniedException($this->filename); } else { $data = include($this->filename); diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index ac7a1bed7..d769e0ff4 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -16,7 +16,6 @@ class Minz_ModelPdo { public static $useSharedBd = true; private static $sharedBd = null; private static $sharedPrefix; - private static $has_transaction = false; private static $sharedCurrentUser; protected static $sharedDbType; @@ -37,57 +36,61 @@ class Minz_ModelPdo { * HOST, BASE, USER et PASS définies dans le fichier de configuration */ public function __construct($currentUser = null) { - if (self::$useSharedBd && self::$sharedBd != null && $currentUser === null) { + if ($currentUser === null) { + $currentUser = Minz_Session::param('currentUser'); + } + if (self::$useSharedBd && self::$sharedBd != null && + ($currentUser == null || $currentUser === self::$sharedCurrentUser)) { $this->bd = self::$sharedBd; $this->prefix = self::$sharedPrefix; $this->current_user = self::$sharedCurrentUser; return; } + $this->current_user = $currentUser; + self::$sharedCurrentUser = $currentUser; $conf = Minz_Configuration::get('system'); $db = $conf->db; - if ($currentUser === null) { - $currentUser = Minz_Session::param('currentUser', '_'); - } - $this->current_user = $currentUser; - self::$sharedCurrentUser = $currentUser; + $driver_options = isset($conf->db['pdo_options']) && is_array($conf->db['pdo_options']) ? $conf->db['pdo_options'] : array(); + $dbServer = parse_url('db://' . $db['host']); try { - $type = $db['type']; - if ($type === 'mysql') { - $string = 'mysql:host=' . $db['host'] - . ';dbname=' . $db['base'] - . ';charset=utf8'; - $driver_options = array( - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', - ); - $this->prefix = $db['prefix'] . $currentUser . '_'; - } elseif ($type === 'sqlite') { - $string = 'sqlite:' . join_path(DATA_PATH, 'users', $currentUser, 'db.sqlite'); - $driver_options = array( - //PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ); - $this->prefix = ''; - } else { - throw new Minz_PDOConnectionException( - 'Invalid database type!', - $db['user'], Minz_Exception::ERROR - ); - } - self::$sharedDbType = $type; - self::$sharedPrefix = $this->prefix; - - $this->bd = new MinzPDO( - $string, - $db['user'], - $db['password'], - $driver_options - ); - if ($type === 'sqlite') { - $this->bd->exec('PRAGMA foreign_keys = ON;'); + switch ($db['type']) { + case 'mysql': + $string = 'mysql:host=' . $dbServer['host'] . ';dbname=' . $db['base'] . ';charset=utf8mb4'; + if (!empty($dbServer['port'])) { + $string .= ';port=' . $dbServer['port']; + } + $driver_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8mb4'; + $this->prefix = $db['prefix'] . $currentUser . '_'; + $this->bd = new MinzPDOMySql($string, $db['user'], $db['password'], $driver_options); + break; + case 'sqlite': + $string = 'sqlite:' . join_path(DATA_PATH, 'users', $currentUser, 'db.sqlite'); + $this->prefix = ''; + $this->bd = new MinzPDOMSQLite($string, $db['user'], $db['password'], $driver_options); + $this->bd->exec('PRAGMA foreign_keys = ON;'); + break; + case 'pgsql': + $string = 'pgsql:host=' . $dbServer['host'] . ';dbname=' . $db['base']; + if (!empty($dbServer['port'])) { + $string .= ';port=' . $dbServer['port']; + } + $this->prefix = $db['prefix'] . $currentUser . '_'; + $this->bd = new MinzPDOPGSQL($string, $db['user'], $db['password'], $driver_options); + $this->bd->exec("SET NAMES 'UTF8';"); + break; + default: + throw new Minz_PDOConnectionException( + 'Invalid database type!', + $db['user'], Minz_Exception::ERROR + ); + break; } self::$sharedBd = $this->bd; + self::$sharedDbType = $db['type']; + self::$sharedPrefix = $this->prefix; } catch (Exception $e) { throw new Minz_PDOConnectionException( $string, @@ -98,24 +101,27 @@ class Minz_ModelPdo { public function beginTransaction() { $this->bd->beginTransaction(); - self::$has_transaction = true; } - public function hasTransaction() { - return self::$has_transaction; + public function inTransaction() { + return $this->bd->inTransaction(); //requires PHP >= 5.3.3 } public function commit() { $this->bd->commit(); - self::$has_transaction = false; } public function rollBack() { $this->bd->rollBack(); - self::$has_transaction = false; } public static function clean() { self::$sharedBd = null; self::$sharedPrefix = ''; } + + public function disableBuffering() { + if ((self::$sharedDbType === 'mysql') && defined('PDO::MYSQL_ATTR_USE_BUFFERED_QUERY')) { + $this->bd->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + } + } } class MinzPDO extends PDO { @@ -125,13 +131,43 @@ class MinzPDO extends PDO { } } + protected function compatibility($statement) { + return $statement; + } + public function prepare($statement, $driver_options = array()) { MinzPDO::check($statement); + $statement = $this->compatibility($statement); return parent::prepare($statement, $driver_options); } public function exec($statement) { MinzPDO::check($statement); + $statement = $this->compatibility($statement); return parent::exec($statement); } + + public function query($statement) { + MinzPDO::check($statement); + $statement = $this->compatibility($statement); + return parent::query($statement); + } +} + +class MinzPDOMySql extends MinzPDO { + public function lastInsertId($name = null) { + return parent::lastInsertId(); //We discard the name, only used by PostgreSQL + } +} + +class MinzPDOMSQLite extends MinzPDO { + public function lastInsertId($name = null) { + return parent::lastInsertId(); //We discard the name, only used by PostgreSQL + } +} + +class MinzPDOPGSQL extends MinzPDO { + protected function compatibility($statement) { + return str_replace(array('`', ' LIKE '), array('"', ' ILIKE '), $statement); + } } diff --git a/lib/Minz/PDOConnectionException.php b/lib/Minz/PDOConnectionException.php index faf2e0fe9..064748708 100644 --- a/lib/Minz/PDOConnectionException.php +++ b/lib/Minz/PDOConnectionException.php @@ -3,7 +3,7 @@ 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 5858e76a5..795085a30 100644 --- a/lib/Minz/Paginator.php +++ b/lib/Minz/Paginator.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ @@ -51,7 +51,7 @@ class Minz_Paginator { */ public function render ($view, $getteur) { $view = APP_PATH . '/views/helpers/'.$view; - + if (file_exists ($view)) { include ($view); } @@ -129,7 +129,7 @@ class Minz_Paginator { $begin = ($this->currentPage - 1) * $this->nbItemsPerPage; $counter = 0; $i = 0; - + foreach ($this->items as $key => $item) { if ($i >= $begin) { $array[$key] = $item; @@ -164,7 +164,7 @@ class Minz_Paginator { if (is_array ($items)) { $this->items = $items; } - + $this->_nbPage (); } public function _nbItemsPerPage ($nbItemsPerPage) { diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index 6db2e9c7a..f80b707d6 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -85,44 +85,64 @@ class Minz_Request { } /** - * Retourn le nom de domaine du site + * Return true if the request is over HTTPS, false otherwise (HTTP) */ - public static function getDomainName() { - return $_SERVER['HTTP_HOST']; + public static function isHttps() { + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + return strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https'; + } else { + return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; + } } /** - * Détermine la base de l'url - * @return la base de l'url + * Try to guess the base URL from $_SERVER information + * + * @return the base url (e.g. http://example.com/) */ - public static function getBaseUrl() { - $conf = Minz_Configuration::get('system'); - $defaultBaseUrl = $conf->base_url; - if (!empty($defaultBaseUrl)) { - return $defaultBaseUrl; - } elseif (isset($_SERVER['REQUEST_URI'])) { - return dirname($_SERVER['REQUEST_URI']) . '/'; + public static function guessBaseUrl() { + $url = 'http'; + + $https = self::isHttps(); + + if (!empty($_SERVER['HTTP_HOST'])) { + $host = $_SERVER['HTTP_HOST']; + } elseif (!empty($_SERVER['SERVER_NAME'])) { + $host = $_SERVER['SERVER_NAME']; } else { - return '/'; + $host = 'localhost'; } - } - /** - * Récupère l'URI de la requête - * @return l'URI - */ - public static function getURI() { - if (isset($_SERVER['REQUEST_URI'])) { - $base_url = self::getBaseUrl(); - $uri = $_SERVER['REQUEST_URI']; + if (!empty($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $port = intval($_SERVER['HTTP_X_FORWARDED_PORT']); + } elseif (!empty($_SERVER['SERVER_PORT'])) { + $port = intval($_SERVER['SERVER_PORT']); + } else { + $port = $https ? 443 : 80; + } - $len_base_url = strlen($base_url); - $real_uri = substr($uri, $len_base_url); + if ($https) { + $url .= 's://' . $host . ($port == 443 ? '' : ':' . $port); } else { - $real_uri = ''; + $url .= '://' . $host . ($port == 80 ? '' : ':' . $port); } + if (isset($_SERVER['REQUEST_URI'])) { + $path = $_SERVER['REQUEST_URI']; + $url .= substr($path, -1) === '/' ? substr($path, 0, -1) : dirname($path); + } + + return filter_var($url, FILTER_SANITIZE_URL); + } - return $real_uri; + /** + * Return the base_url from configuration and add a suffix if given. + * + * @return the base_url with a suffix. + */ + public static function getBaseUrl() { + $conf = Minz_Configuration::get('system'); + $url = rtrim($conf->base_url, '/\\'); + return filter_var($url, FILTER_SANITIZE_URL); } /** diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php index 058685ada..c94f2b646 100644 --- a/lib/Minz/Session.php +++ b/lib/Minz/Session.php @@ -59,16 +59,21 @@ class Minz_Session { } } + public static function getCookieDir() { + // Get the script_name (e.g. /p/i/index.php) and keep only the path. + $cookie_dir = empty($_SERVER['REQUEST_URI']) ? '/' : $_SERVER['REQUEST_URI']; + if (substr($cookie_dir, -1) !== '/') { + $cookie_dir = dirname($cookie_dir) . '/'; + } + return $cookie_dir; + } /** * Spécifie la durée de vie des cookies * @param $l la durée de vie */ public static function keepCookie($l) { - // Get the script_name (e.g. /p/i/index.php) and keep only the path. - $cookie_dir = empty($_SERVER['SCRIPT_NAME']) ? '' : $_SERVER['SCRIPT_NAME']; - $cookie_dir = dirname($cookie_dir); - session_set_cookie_params($l, $cookie_dir, '', false, true); + session_set_cookie_params($l, self::getCookieDir(), '', Minz_Request::isHttps(), true); } @@ -81,11 +86,11 @@ class Minz_Session { } public static function deleteLongTermCookie($name) { - setcookie($name, '', 1, '', '', false, true); + setcookie($name, '', 1, '', '', Minz_Request::isHttps(), true); } public static function setLongTermCookie($name, $value, $expire) { - setcookie($name, $value, $expire, '', '', false, true); + setcookie($name, $value, $expire, '', '', Minz_Request::isHttps(), true); } public static function getLongTermCookie($name) { diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index baddcb424..d9cd59f7e 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -1,5 +1,5 @@ <?php -/** +/** * MINZ - Copyright 2011 Marien Fressinaud * Sous licence AGPL3 <http://www.gnu.org/licenses/> */ @@ -153,7 +153,7 @@ class Minz_Translate { * @param additional parameters for variable keys. * @return the value corresponding to the key. * If no value is found, return the key itself. - */ + */ public static function t($key) { $group = explode('.', $key); diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index af555a277..99c0443c1 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -10,7 +10,6 @@ class Minz_Url { * $url['c'] = controller * $url['a'] = action * $url['params'] = tableau des paramètres supplémentaires - * $url['protocol'] = protocole à utiliser (http par défaut) * ou comme une chaîne de caractère * @param $encodage pour indiquer comment encoder les & (& ou & pour html) * @return l'url formatée @@ -19,26 +18,30 @@ class Minz_Url { $isArray = is_array($url); if ($isArray) { - $url = self::checkUrl ($url); + $url = self::checkUrl($url); } $url_string = ''; if ($absolute) { - if ($isArray && isset ($url['protocol'])) { - $protocol = $url['protocol']; - } elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $protocol = 'https:'; - } else { - $protocol = 'http:'; + $url_string = Minz_Request::getBaseUrl(); + if ($url_string == '') { + $url_string = Minz_Request::guessBaseUrl(); + } + if ($isArray) { + $url_string .= PUBLIC_TO_INDEX_PATH; + } + if ($absolute === 'root') { + $url_string = parse_url($url_string, PHP_URL_PATH); } - $url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl (); } else { $url_string = $isArray ? '.' : PUBLIC_RELATIVE; } if ($isArray) { - $url_string .= self::printUri ($url, $encodage); + $url_string .= self::printUri($url, $encodage); + } elseif ($encodage === 'html') { + $url_string = Minz_Helper::htmlspecialchars_utf8($url_string . $url); } else { $url_string .= $url; } @@ -75,6 +78,8 @@ class Minz_Url { } if (isset($url['params'])) { + unset($url['params']['c']); + unset($url['params']['a']); foreach ($url['params'] as $key => $param) { $uri .= $separator . urlencode($key) . '=' . urlencode($param); $separator = $and; diff --git a/lib/Minz/View.php b/lib/Minz/View.php index ff5cce4a5..d6bf6ea2c 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -91,6 +91,7 @@ class Minz_View { * Construit le layout */ public function buildLayout () { + header('Content-Type: text/html; charset=UTF-8'); $this->includeFile(self::LAYOUT_PATH_NAME . self::LAYOUT_FILENAME); } @@ -261,5 +262,3 @@ class Minz_View { } } } - - diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index c4872b5be..5cd445b6d 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2017, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev-FreshRSS - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @version 1.5 + * @copyright 2004-2017 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -50,7 +50,7 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.4-dev-FreshRSS'); +define('SIMPLEPIE_VERSION', '1.5'); /** * SimplePie Build @@ -75,6 +75,12 @@ define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>'); /** + * Use syslog to report HTTP requests done by SimplePie. + * @see SimplePie::set_syslog() + */ +define('SIMPLEPIE_SYSLOG', true); //FreshRSS + +/** * No Autodiscovery * @see SimplePie::set_autodiscovery_level() */ @@ -450,7 +456,7 @@ class SimplePie * @see SimplePie::subscribe_url() * @access private */ - public $permanent_url = null; //FreshRSS + public $permanent_url = null; /** * @var object Instance of SimplePie_File to use as a feed @@ -474,6 +480,13 @@ class SimplePie public $timeout = 10; /** + * @var array Custom curl options + * @see SimplePie::set_curl_options() + * @access private + */ + public $curl_options = array(); + + /** * @var bool Forces fsockopen() to be used for remote files instead * of cURL, even if a new enough version is installed * @see SimplePie::force_fsockopen() @@ -497,6 +510,14 @@ class SimplePie public $cache = true; /** + * @var bool Force SimplePie to fallback to expired cache, if enabled, + * when feed is unavailable. + * @see SimplePie::force_cache_fallback() + * @access private + */ + public $force_cache_fallback = false; + + /** * @var int Cache duration (in seconds) * @see SimplePie::set_cache_duration() * @access private @@ -602,6 +623,12 @@ class SimplePie public $item_limit = 0; /** + * @var bool Stores if last-modified and/or etag headers were sent with the + * request when checking a feed. + */ + public $check_modified = false; + + /** * @var array Stores the default attributes to be stripped by strip_attributes(). * @see SimplePie::strip_attributes() * @access private @@ -613,7 +640,7 @@ class SimplePie * @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 + public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); /** * @var array Stores the default tags to be stripped by strip_htmltags(). @@ -623,6 +650,18 @@ class SimplePie public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); /** + * @var bool Should we throw exceptions, or use the old-style error property? + * @access private + */ + public $enable_exceptions = false; + + /** + * Use syslog to report HTTP requests done by SimplePie. + * @see SimplePie::set_syslog() + */ + public $syslog_enabled = SIMPLEPIE_SYSLOG; + + /** * The SimplePie class contains feed level data and options * * To use SimplePie, create the SimplePie object with no parameters. You can @@ -638,9 +677,9 @@ class SimplePie */ public function __construct() { - if (version_compare(PHP_VERSION, '5.2', '<')) + if (version_compare(PHP_VERSION, '5.3', '<')) { - trigger_error('PHP 4.x, 5.0 and 5.1 are no longer supported. Please upgrade to PHP 5.2 or newer.'); + trigger_error('Please upgrade to PHP 5.3 or newer.'); die(); } @@ -742,7 +781,7 @@ class SimplePie else { $this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1)); - $this->permanent_url = $this->feed_url; //FreshRSS + $this->permanent_url = $this->feed_url; } } @@ -757,7 +796,7 @@ class SimplePie if ($file instanceof SimplePie_File) { $this->feed_url = $file->url; - $this->permanent_url = $this->feed_url; //FreshRSS + $this->permanent_url = $this->feed_url; $this->file =& $file; return true; } @@ -797,6 +836,19 @@ class SimplePie } /** + * Set custom curl options + * + * This allows you to change default curl options + * + * @since 1.0 Beta 3 + * @param array $curl_options Curl options to add to default settings + */ + public function set_curl_options(array $curl_options = array()) + { + $this->curl_options = $curl_options; + } + + /** * Force SimplePie to use fsockopen() instead of cURL * * @since 1.0 Beta 3 @@ -822,6 +874,21 @@ class SimplePie } /** + * SimplePie to continue to fall back to expired cache, if enabled, when + * feed is unavailable. + * + * This tells SimplePie to ignore any file errors and fall back to cache + * instead. This only works if caching is enabled and cached content + * still exists. + + * @param bool $enable Force use of cache on fail. + */ + public function force_cache_fallback($enable = false) + { + $this->force_cache_fallback= (bool) $enable; + } + + /** * Set the length of time (in seconds) that the contents of a feed will be * cached * @@ -1091,6 +1158,7 @@ class SimplePie $this->strip_attributes(false); $this->add_attributes(false); $this->set_image_handler(false); + $this->set_https_domains(array()); } } @@ -1146,15 +1214,23 @@ class SimplePie } /** + * Use syslog to report HTTP requests done by SimplePie. + */ + public function set_syslog($value = SIMPLEPIE_SYSLOG) //FreshRSS + { + $this->syslog_enabled = $value == true; + } + + /** * Set the output encoding * * Allows you to override SimplePie's output to match that of your webpage. * This is useful for times when your webpages are not being served as - * UTF-8. This setting will be obeyed by {@see handle_content_type()}, and + * UTF-8. This setting will be obeyed by {@see handle_content_type()}, and * is similar to {@see set_input_encoding()}. * * It should be noted, however, that not all character encodings can support - * all characters. If your page is being served as ISO-8859-1 and you try + * all characters. If your page is being served as ISO-8859-1 and you try * to display a Japanese feed, you'll likely see garbled characters. * Because of this, it is highly recommended to ensure that your webpages * are served as UTF-8. @@ -1194,6 +1270,19 @@ class SimplePie } /** + * Set the list of domains for which force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * FreshRSS + */ + public function set_https_domains($domains = array()) + { + if (is_array($domains)) + { + $this->sanitize->set_https_domains($domains); + } + } + + /** * Set the handler to enable the display of cached images. * * @param str $page Web-accessible path to the handler_image.php file. @@ -1231,14 +1320,15 @@ class SimplePie $this->enable_exceptions = $enable; } - function cleanMd5($rss) { //FreshRSS + function cleanMd5($rss) + { return md5(preg_replace(array('#<(lastBuildDate|pubDate|updated|feedDate|dc:date|slash:comments)>[^<]+</\\1>#', '#<!--.+?-->#s'), '', $rss)); } /** * Initialize the feed object * - * This is what makes everything happen. Period. This is where all of the + * This is what makes everything happen. Period. This is where all of the * configuration options get processed, feeds are fetched, cached, and * parsed, and all of that other good stuff. * @@ -1249,6 +1339,7 @@ class SimplePie // Check absolute bare minimum requirements. if (!extension_loaded('xml') || !extension_loaded('pcre')) { + $this->error = 'XML or PCRE extensions not loaded!'; return false; } // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader. @@ -1276,7 +1367,7 @@ class SimplePie // Pass whatever was set with config options over to the sanitizer. // Pass the classes in for legacy support; new classes should use the registry instead $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache')); - $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen); + $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); if (!empty($this->multifeed_url)) { @@ -1305,6 +1396,7 @@ class SimplePie $this->error = null; $this->data = array(); + $this->check_modified = false; $this->multifeed_objects = array(); $cache = false; @@ -1321,7 +1413,7 @@ class SimplePie // Fetch the data via SimplePie_File into $this->raw_data if (($fetched = $this->fetch_data($cache)) === true) { - return $this->data['mtime']; //FreshRSS + return $this->data['mtime']; } elseif ($fetched === false) { return false; @@ -1329,10 +1421,18 @@ class SimplePie list($headers, $sniffed) = $fetched; - if (isset($this->data['md5'])) { //FreshRSS + if (isset($this->data['md5'])) + { $md5 = $this->data['md5']; } } + + // Empty response check + if(empty($this->raw_data)){ + $this->error = "A feed could not be found at `$this->feed_url`. Empty body."; + $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); + return false; + } // Set up array of possible encodings $encodings = array(); @@ -1375,7 +1475,7 @@ class SimplePie // Text MIME-type default elseif (substr($sniffed, 0, 5) === 'text/') { - $encodings[] = 'US-ASCII'; + $encodings[] = 'UTF-8'; } } @@ -1413,8 +1513,8 @@ class SimplePie $this->data['headers'] = $headers; } $this->data['build'] = SIMPLEPIE_BUILD; - $this->data['mtime'] = time(); //FreshRSS - $this->data['md5'] = empty($md5) ? $this->cleanMd5($this->raw_data) : $md5; //FreshRSS + $this->data['mtime'] = time(); + $this->data['md5'] = empty($md5) ? $this->cleanMd5($this->raw_data) : $md5; // Cache the file if caching is enabled if ($cache && !$cache->save($this)) @@ -1429,11 +1529,27 @@ class SimplePie if (isset($parser)) { // We have an error, just set SimplePie_Misc::error to it and quit - $this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); + $this->error = $this->feed_url; + $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); } else { - $this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.'; + $this->error = 'The data could not be converted to UTF-8.'; + if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) { + $this->error .= ' You MUST have either the iconv, mbstring or intl (PHP 5.5+) extension installed and enabled.'; + } else { + $missingExtensions = array(); + if (!extension_loaded('iconv')) { + $missingExtensions[] = 'iconv'; + } + if (!extension_loaded('mbstring')) { + $missingExtensions[] = 'mbstring'; + } + if (!class_exists('\UConverter')) { + $missingExtensions[] = 'intl (PHP 5.5+)'; + } + $this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.'; + } } $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); @@ -1455,7 +1571,8 @@ class SimplePie { // Load the Cache $this->data = $cache->load(); - if ($cache->mtime() + $this->cache_duration > time()) { //FreshRSS + if ($cache->mtime() + $this->cache_duration > time()) + { $this->raw_data = false; return true; // If the cache is still valid, just return true } @@ -1491,65 +1608,59 @@ class SimplePie } } // Check if the cache has been updated - else //if ($cache->mtime() + $this->cache_duration < time()) //FreshRSS removed + else { - // If we have last-modified and/or etag set - //if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) //FreshRSS removed + $headers = array( + 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', + ); + if (isset($this->data['headers']['last-modified'])) { - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - if (isset($this->data['headers']['last-modified'])) - { - $headers['if-modified-since'] = $this->data['headers']['last-modified']; - } - if (isset($this->data['headers']['etag'])) - { - $headers['if-none-match'] = $this->data['headers']['etag']; - } + $headers['if-modified-since'] = $this->data['headers']['last-modified']; + } + if (isset($this->data['headers']['etag'])) + { + $headers['if-none-match'] = $this->data['headers']['etag']; + } - $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen)); //FreshRSS + $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options, $this->syslog_enabled)); - if ($file->success) + if ($file->success) + { + if ($file->status_code === 304) { - if ($file->status_code === 304) - { - $cache->touch(); - return true; - } + $cache->touch(); + return true; } - else + } + else + { + $this->check_modified = false; + $cache->touch(); + $this->error = $file->error; + return !empty($this->data); + } + + $md5 = $this->cleanMd5($file->body); + if ($this->data['md5'] === $md5) { + if ($this->syslog_enabled) { - $cache->touch(); //FreshRSS - $this->error = $file->error; //FreshRSS - return !empty($this->data); //FreshRSS - //unset($file); //FreshRSS removed + syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url)); } - } - { //FreshRSS - $md5 = $this->cleanMd5($file->body); - if ($this->data['md5'] === $md5) { - // syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); - $cache->touch(); - return true; //Content unchanged even though server did not send a 304 - } else { - // syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); - $this->data['md5'] = $md5; + $cache->touch(); + return true; //Content unchanged even though server did not send a 304 + } else { + if ($this->syslog_enabled) + { + syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url)); } + $this->data['md5'] = $md5; } } - //// If the cache is still valid, just return true - //else //FreshRSS removed - //{ - // $this->raw_data = false; - // return true; - //} - } - // If the cache is empty, delete it + } + // If the cache is empty else { - //$cache->unlink(); //FreshRSS removed - $cache->touch(); //FreshRSS + $cache->touch(); //To keep the date/time of the last tentative update $this->data = array(); } } @@ -1565,7 +1676,7 @@ class SimplePie $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); - $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen)); + $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options, $this->syslog_enabled)); } } // If the file connection has an error, set SimplePie::error to that and quit @@ -1582,15 +1693,15 @@ class SimplePie if (!$locate->is_feed($file)) { - $copyStatusCode = $file->status_code; //FreshRSS - $copyContentType = $file->headers['content-type']; //FreshRSS + $copyStatusCode = $file->status_code; + $copyContentType = $file->headers['content-type']; // We need to unset this so that if SimplePie::set_file() has been called that object is untouched unset($file); try { if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))) { - $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; //FreshRSS + $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } @@ -1605,8 +1716,8 @@ class SimplePie if ($cache) { $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); - $this->data['mtime'] = time(); //FreshRSS - $this->data['md5'] = empty($md5) ? $this->cleanMd5($file->body) : $md5; //FreshRSS + $this->data['mtime'] = time(); + $this->data['md5'] = empty($md5) ? $this->cleanMd5($file->body) : $md5; if (!$cache->save($this)) { trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); @@ -1618,8 +1729,9 @@ class SimplePie $locate = null; } + $file->body = trim($file->body); //FreshRSS $this->raw_data = $file->body; - $this->permanent_url = $file->permanent_url; //FreshRSS + $this->permanent_url = $file->permanent_url; $headers = $file->headers; $sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file)); $sniffed = $sniffer->get_type(); @@ -1818,23 +1930,28 @@ class SimplePie * @todo Support <itunes:new-feed-url> * @todo Also, |atom:link|@rel=self * @param bool $permanent Permanent mode to return only the original URL or the first redirection - * iff it is a 301 redirection + * iff it is a 301 redirection * @return string|null */ public function subscribe_url($permanent = false) { - if ($permanent) //FreshRSS + if ($permanent) { if ($this->permanent_url !== null) { - return $this->sanitize($this->permanent_url, SIMPLEPIE_CONSTRUCT_IRI); + // sanitize encodes ampersands which are required when used in a url. + return str_replace('&', '&', + $this->sanitize($this->permanent_url, + SIMPLEPIE_CONSTRUCT_IRI)); } } else { if ($this->feed_url !== null) { - return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI); + return str_replace('&', '&', + $this->sanitize($this->feed_url, + SIMPLEPIE_CONSTRUCT_IRI)); } } return null; @@ -2117,7 +2234,7 @@ class SimplePie * Get a category for the feed * * @since Unknown - * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 + * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 * @return SimplePie_Category|null */ public function get_category($key = 0) @@ -2202,7 +2319,7 @@ class SimplePie * Get an author for the feed * * @since 1.1 - * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 + * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 * @return SimplePie_Author|null */ public function get_author($key = 0) @@ -2300,7 +2417,7 @@ class SimplePie * Get a contributor for the feed * * @since 1.1 - * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 + * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 * @return SimplePie_Author|null */ public function get_contributor($key = 0) @@ -2386,7 +2503,7 @@ class SimplePie * Get a single link for the feed * * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8) - * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 + * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 * @param string $rel The relationship of the link to return * @return string|null Link URL */ @@ -2496,6 +2613,12 @@ class SimplePie { return $this->data['links'][$rel]; } + else if (isset($this->data['headers']['link']) && + preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', + $this->data['headers']['link'], $match)) + { + return array($match[1]); + } else { return null; @@ -2897,7 +3020,7 @@ class SimplePie * * @see get_item_quantity() * @since Beta 2 - * @param int $key The item that you want to return. Remember that arrays begin with 0, not 1 + * @param int $key The item that you want to return. Remember that arrays begin with 0, not 1 * @return SimplePie_Item|null */ public function get_item($key = 0) @@ -2924,7 +3047,7 @@ class SimplePie * @since Beta 2 * @param int $start Index to start at * @param int $end Number of items to return. 0 for all items after `$start` - * @return array|null List of {@see SimplePie_Item} objects + * @return SimplePie_Item[]|null List of {@see SimplePie_Item} objects */ public function get_items($start = 0, $end = 0) { @@ -2933,96 +3056,81 @@ class SimplePie if (!empty($this->multifeed_objects)) { $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); + if (empty($this->data['items'])) + { + return array(); + } + return $this->data['items']; } - else + $this->data['items'] = array(); + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) { - $this->data['items'] = array(); - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) + $keys = array_keys($items); + foreach ($keys as $key) { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } + $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) + { + $keys = array_keys($items); + foreach ($keys as $key) { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } + $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } + $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } + $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } - if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) + } + if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } + $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } } - if (!empty($this->data['items'])) + if (empty($this->data['items'])) { - // If we want to order it by date, check if all items have a date, and then sort it - if ($this->order_by_date && empty($this->multifeed_objects)) - { - if (!isset($this->data['ordered_items'])) - { - $do_sort = true; - foreach ($this->data['items'] as $item) - { - if (!$item->get_date('U')) - { - $do_sort = false; - break; - } - } - $item = null; - $this->data['ordered_items'] = $this->data['items']; - if ($do_sort) - { - usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); - } - } - $items = $this->data['ordered_items']; - } - else - { - $items = $this->data['items']; - } + return array(); + } - // Slice the data as desired - if ($end === 0) - { - return array_slice($items, $start); - } - else + if ($this->order_by_date) + { + if (!isset($this->data['ordered_items'])) { - return array_slice($items, $start, $end); - } + $this->data['ordered_items'] = $this->data['items']; + usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); + } + $items = $this->data['ordered_items']; } else { - return array(); + $items = $this->data['items']; + } + // Slice the data as desired + if ($end === 0) + { + return array_slice($items, $start); + } + else + { + return array_slice($items, $start, $end); } } @@ -3095,7 +3203,19 @@ class SimplePie */ public static function sort_items($a, $b) { - return $a->get_date('U') <= $b->get_date('U'); + $a_date = $a->get_date('U'); + $b_date = $b->get_date('U'); + if ($a_date && $b_date) { + return $a_date > $b_date ? -1 : 1; + } + // Sort items without dates to the top. + if ($a_date) { + return 1; + } + if ($b_date) { + return -1; + } + return 0; } /** @@ -3128,20 +3248,7 @@ class SimplePie } } - $do_sort = true; - foreach ($items as $item) - { - if (!$item->get_date('U')) - { - $do_sort = false; - break; - } - } - $item = null; - if ($do_sort) - { - usort($items, array(get_class($urls[0]), 'sort_items')); - } + usort($items, array(get_class($urls[0]), 'sort_items')); if ($end === 0) { @@ -3158,4 +3265,42 @@ class SimplePie return array(); } } + + /** + * Store PubSubHubbub links as headers + * + * There is no way to find PuSH links in the body of a microformats feed, + * so they are added to the headers when found, to be used later by get_links. + * @param SimplePie_File $file + * @param string $hub + * @param string $self + */ + private function store_links(&$file, $hub, $self) { + if (isset($file->headers['link']['hub']) || + (isset($file->headers['link']) && + preg_match('/rel=hub/', $file->headers['link']))) + { + return; + } + + if ($hub) + { + if (isset($file->headers['link'])) + { + if ($file->headers['link'] !== '') + { + $file->headers['link'] = ', '; + } + } + else + { + $file->headers['link'] = ''; + } + $file->headers['link'] .= '<'.$hub.'>; rel=hub'; + if ($self) + { + $file->headers['link'] .= ', <'.$self.'>; rel=self'; + } + } + } } diff --git a/lib/SimplePie/SimplePie/Author.php b/lib/SimplePie/SimplePie/Author.php index 19563c5cc..e6768ff29 100644 --- a/lib/SimplePie/SimplePie/Author.php +++ b/lib/SimplePie/SimplePie/Author.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Cache.php b/lib/SimplePie/SimplePie/Cache.php index 86b618693..d98cc6511 100644 --- a/lib/SimplePie/SimplePie/Cache.php +++ b/lib/SimplePie/SimplePie/Cache.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -62,8 +61,10 @@ class SimplePie_Cache * @var array */ protected static $handlers = array( - 'mysql' => 'SimplePie_Cache_MySQL', - 'memcache' => 'SimplePie_Cache_Memcache', + 'mysql' => 'SimplePie_Cache_MySQL', + 'memcache' => 'SimplePie_Cache_Memcache', + 'memcached' => 'SimplePie_Cache_Memcached', + 'redis' => 'SimplePie_Cache_Redis' ); /** diff --git a/lib/SimplePie/SimplePie/Cache/Base.php b/lib/SimplePie/SimplePie/Cache/Base.php index d3f353961..333fb05cf 100644 --- a/lib/SimplePie/SimplePie/Cache/Base.php +++ b/lib/SimplePie/SimplePie/Cache/Base.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Cache/DB.php b/lib/SimplePie/SimplePie/Cache/DB.php index d728a9a6d..7e8f77532 100644 --- a/lib/SimplePie/SimplePie/Cache/DB.php +++ b/lib/SimplePie/SimplePie/Cache/DB.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Cache/File.php b/lib/SimplePie/SimplePie/Cache/File.php index cb4b528c4..6ba6c5f6e 100644 --- a/lib/SimplePie/SimplePie/Cache/File.php +++ b/lib/SimplePie/SimplePie/Cache/File.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -136,11 +135,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base */ public function mtime() { - //if (file_exists($this->name)) //FreshRSS removed - { - return @filemtime($this->name); //FreshRSS - } - //return false; //FreshRSS removed + return @filemtime($this->name); } /** @@ -150,11 +145,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base */ public function touch() { - //if (file_exists($this->name)) //FreshRSS removed - { - return @touch($this->name); //FreshRSS - } - //return false; //FreshRSS removed + return @touch($this->name); } /** diff --git a/lib/SimplePie/SimplePie/Cache/Memcache.php b/lib/SimplePie/SimplePie/Cache/Memcache.php index 23b1c9367..5190eef93 100644 --- a/lib/SimplePie/SimplePie/Cache/Memcache.php +++ b/lib/SimplePie/SimplePie/Cache/Memcache.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Cache/Memcached.php b/lib/SimplePie/SimplePie/Cache/Memcached.php new file mode 100644 index 000000000..1f73b3890 --- /dev/null +++ b/lib/SimplePie/SimplePie/Cache/Memcached.php @@ -0,0 +1,166 @@ +<?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-2016, 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 + * @copyright 2004-2016 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 + */ + +/** + * Caches data to memcached + * + * Registered for URLs with the "memcached" protocol + * + * For example, `memcached://localhost:11211/?timeout=3600&prefix=sp_` will + * connect to memcached on `localhost` on port 11211. All tables will be + * prefixed with `sp_` and data will expire after 3600 seconds + * + * @package SimplePie + * @subpackage Caching + * @author Paul L. McNeely + * @uses Memcached + */ +class SimplePie_Cache_Memcached implements SimplePie_Cache_Base +{ + /** + * Memcached instance + * @var Memcached + */ + protected $cache; + + /** + * Options + * @var array + */ + protected $options; + + /** + * Cache name + * @var string + */ + protected $name; + + /** + * Create a new cache object + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $type) { + $this->options = array( + 'host' => '127.0.0.1', + 'port' => 11211, + 'extras' => array( + 'timeout' => 3600, // one hour + 'prefix' => 'simplepie_', + ), + ); + $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); + + $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); + + $this->cache = new Memcached(); + $this->cache->addServer($this->options['host'], (int)$this->options['port']); + } + + /** + * Save data to the cache + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) { + if ($data instanceof SimplePie) { + $data = $data->data; + } + + return $this->setData(serialize($data)); + } + + /** + * Retrieve the data saved to the cache + * @return array Data for SimplePie::$data + */ + public function load() { + $data = $this->cache->get($this->name); + + if ($data !== false) { + return unserialize($data); + } + return false; + } + + /** + * Retrieve the last modified time for the cache + * @return int Timestamp + */ + public function mtime() { + $data = $this->cache->get($this->name . '_mtime'); + return (int) $data; + } + + /** + * Set the last modified time to the current time + * @return bool Success status + */ + public function touch() { + $data = $this->cache->get($this->name); + return $this->setData($data); + } + + /** + * Remove the cache + * @return bool Success status + */ + public function unlink() { + return $this->cache->delete($this->name, 0); + } + + /** + * Set the last modified time and data to Memcached + * @return bool Success status + */ + private function setData($data) { + + if ($data !== false) { + $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); + return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); + } + + return false; + } +} diff --git a/lib/SimplePie/SimplePie/Cache/MySQL.php b/lib/SimplePie/SimplePie/Cache/MySQL.php index 511ef6d3a..8686b6c67 100644 --- a/lib/SimplePie/SimplePie/Cache/MySQL.php +++ b/lib/SimplePie/SimplePie/Cache/MySQL.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -94,6 +93,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB 'path' => '', 'extras' => array( 'prefix' => '', + 'cache_purge_time' => 2592000 ), ); @@ -131,16 +131,20 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); if ($query === false) { + trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING); $this->mysql = null; + return; } } if (!in_array($this->options['extras']['prefix'] . 'items', $db)) { - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); + $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); if ($query === false) { + trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING); $this->mysql = null; + return; } } } @@ -158,6 +162,17 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB return false; } + $query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' . + '`' . $this->options['extras']['prefix'] . 'items` i ' . + 'WHERE cd.id = i.feed_id ' . + 'AND cd.mtime < (unix_timestamp() - :purge_time)'); + $query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']); + + if (!$query->execute()) + { + return false; + } + if ($data instanceof SimplePie) { $data = clone $data; diff --git a/lib/SimplePie/SimplePie/Cache/Redis.php b/lib/SimplePie/SimplePie/Cache/Redis.php new file mode 100644 index 000000000..04d72c79a --- /dev/null +++ b/lib/SimplePie/SimplePie/Cache/Redis.php @@ -0,0 +1,166 @@ +<?php + +/** + * SimplePie Redis Cache Extension + * + * @package SimplePie + * @author Jan Kozak <galvani78@gmail.com> + * @link http://galvani.cz/ + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version 0.2.9 + */ + + +/** + * Caches data to redis + * + * Registered for URLs with the "redis" protocol + * + * For example, `redis://localhost:6379/?timeout=3600&prefix=sp_&dbIndex=0` will + * connect to redis on `localhost` on port 6379. All tables will be + * prefixed with `simple_primary-` and data will expire after 3600 seconds + * + * @package SimplePie + * @subpackage Caching + * @uses Redis + */ +class SimplePie_Cache_Redis implements SimplePie_Cache_Base { + /** + * Redis instance + * + * @var \Redis + */ + protected $cache; + + /** + * Options + * + * @var array + */ + protected $options; + + /** + * Cache name + * + * @var string + */ + protected $name; + + /** + * Cache Data + * + * @var type + */ + protected $data; + + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $options = null) { + //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); + $parsed = SimplePie_Cache::parse_URL($location); + $redis = new Redis(); + $redis->connect($parsed['host'], $parsed['port']); + $this->cache = $redis; + + if (!is_null($options) && is_array($options)) { + $this->options = $options; + } else { + $this->options = array ( + 'prefix' => 'rss:simple_primary:', + 'expire' => 0, + ); + } + + $this->name = $this->options['prefix'] . $name; + } + + /** + * @param \Redis $cache + */ + public function setRedisClient(\Redis $cache) { + $this->cache = $cache; + } + + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) { + if ($data instanceof SimplePie) { + $data = $data->data; + } + $response = $this->cache->set($this->name, serialize($data)); + if ($this->options['expire']) { + $this->cache->expire($this->name, $this->options['expire']); + } + + return $response; + } + + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load() { + $data = $this->cache->get($this->name); + + if ($data !== false) { + return unserialize($data); + } + return false; + } + + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime() { + + $data = $this->cache->get($this->name); + + if ($data !== false) { + return time(); + } + + return false; + } + + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch() { + + $data = $this->cache->get($this->name); + + if ($data !== false) { + $return = $this->cache->set($this->name, $data); + if ($this->options['expire']) { + return $this->cache->expire($this->name, $this->ttl); + } + return $return; + } + + return false; + } + + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink() { + return $this->cache->set($this->name, null); + } + +} diff --git a/lib/SimplePie/SimplePie/Caption.php b/lib/SimplePie/SimplePie/Caption.php index a77b02ef1..abf07de1b 100644 --- a/lib/SimplePie/SimplePie/Caption.php +++ b/lib/SimplePie/SimplePie/Caption.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Category.php b/lib/SimplePie/SimplePie/Category.php index c6a273989..df0f13f9a 100644 --- a/lib/SimplePie/SimplePie/Category.php +++ b/lib/SimplePie/SimplePie/Category.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -57,7 +56,7 @@ class SimplePie_Category /** * Category identifier * - * @var string + * @var string|null * @see get_term */ var $term; @@ -65,7 +64,7 @@ class SimplePie_Category /** * Categorization scheme identifier * - * @var string + * @var string|null * @see get_scheme() */ var $scheme; @@ -73,23 +72,36 @@ class SimplePie_Category /** * Human readable label * - * @var string + * @var string|null * @see get_label() */ var $label; /** + * Category type + * + * category for <category> + * subject for <dc:subject> + * + * @var string|null + * @see get_type() + */ + var $type; + + /** * Constructor, used to input the data * - * @param string $term - * @param string $scheme - * @param string $label + * @param string|null $term + * @param string|null $scheme + * @param string|null $label + * @param string|null $type */ - public function __construct($term = null, $scheme = null, $label = null) + public function __construct($term = null, $scheme = null, $label = null, $type = null) { $this->term = $term; $this->scheme = $scheme; $this->label = $label; + $this->type = $type; } /** @@ -110,14 +122,7 @@ class SimplePie_Category */ public function get_term() { - if ($this->term !== null) - { - return $this->term; - } - else - { - return null; - } + return $this->term; } /** @@ -127,31 +132,32 @@ class SimplePie_Category */ public function get_scheme() { - if ($this->scheme !== null) - { - return $this->scheme; - } - else - { - return null; - } + return $this->scheme; } /** * Get the human readable label * + * @param bool $strict * @return string|null */ - public function get_label() + public function get_label($strict = false) { - if ($this->label !== null) - { - return $this->label; - } - else + if ($this->label === null && $strict !== true) { return $this->get_term(); } + return $this->label; + } + + /** + * Get the category type + * + * @return string|null + */ + public function get_type() + { + return $this->type; } } diff --git a/lib/SimplePie/SimplePie/Content/Type/Sniffer.php b/lib/SimplePie/SimplePie/Content/Type/Sniffer.php index a32f47f59..6caf80f33 100644 --- a/lib/SimplePie/SimplePie/Content/Type/Sniffer.php +++ b/lib/SimplePie/SimplePie/Content/Type/Sniffer.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -109,9 +108,7 @@ class SimplePie_Content_Type_Sniffer { return $this->unknown(); } - elseif (substr($official, -4) === '+xml' - || $official === 'text/xml' - || $official === 'application/xml') + elseif (substr($official, -4) === '+xml') { return $official; } @@ -126,7 +123,9 @@ class SimplePie_Content_Type_Sniffer return $official; } } - elseif ($official === 'text/html') + elseif ($official === 'text/html' + || $official === 'text/xml' //FreshRSS + || $official === 'application/xml') //FreshRSS { return $this->feed_or_html(); } @@ -256,7 +255,7 @@ class SimplePie_Content_Type_Sniffer public function feed_or_html() { $len = strlen($this->file->body); - $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); + $pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF"); while ($pos < $len) { diff --git a/lib/SimplePie/SimplePie/Copyright.php b/lib/SimplePie/SimplePie/Copyright.php index 09f22f8df..3f3d07d3b 100644 --- a/lib/SimplePie/SimplePie/Copyright.php +++ b/lib/SimplePie/SimplePie/Copyright.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Core.php b/lib/SimplePie/SimplePie/Core.php index 7cf34876f..c856ba361 100644 --- a/lib/SimplePie/SimplePie/Core.php +++ b/lib/SimplePie/SimplePie/Core.php @@ -5,7 +5,7 @@ * 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 + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Credit.php b/lib/SimplePie/SimplePie/Credit.php index 50aef1c68..9bad9ef34 100644 --- a/lib/SimplePie/SimplePie/Credit.php +++ b/lib/SimplePie/SimplePie/Credit.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Decode/HTML/Entities.php b/lib/SimplePie/SimplePie/Decode/HTML/Entities.php index cde06c884..de3f2cb53 100644 --- a/lib/SimplePie/SimplePie/Decode/HTML/Entities.php +++ b/lib/SimplePie/SimplePie/Decode/HTML/Entities.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -169,7 +168,6 @@ class SimplePie_Decode_HTML_Entities case "\x09": case "\x0A": case "\x0B": - case "\x0B": case "\x0C": case "\x20": case "\x3C": diff --git a/lib/SimplePie/SimplePie/Enclosure.php b/lib/SimplePie/SimplePie/Enclosure.php index fa0217800..15060e193 100644 --- a/lib/SimplePie/SimplePie/Enclosure.php +++ b/lib/SimplePie/SimplePie/Enclosure.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -451,7 +450,7 @@ class SimplePie_Enclosure /** * Get the duration of the enclosure * - * @param string $convert Convert seconds into hh:mm:ss + * @param bool $convert Convert seconds into hh:mm:ss * @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found) */ public function get_duration($convert = false) diff --git a/lib/SimplePie/SimplePie/Exception.php b/lib/SimplePie/SimplePie/Exception.php index 73e104d69..53c015e77 100644 --- a/lib/SimplePie/SimplePie/Exception.php +++ b/lib/SimplePie/SimplePie/Exception.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php index 9625af2a9..8be38f145 100644 --- a/lib/SimplePie/SimplePie/File.php +++ b/lib/SimplePie/SimplePie/File.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -64,9 +63,9 @@ class SimplePie_File var $redirects = 0; var $error; var $method = SIMPLEPIE_FILE_SOURCE_NONE; - var $permanent_url; //FreshRSS + var $permanent_url; - public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) + public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = array(), $syslog_enabled = SIMPLEPIE_SYSLOG) { if (class_exists('idna_convert')) { @@ -75,11 +74,14 @@ class SimplePie_File $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); } $this->url = $url; - $this->permanent_url = $url; //FreshRSS + $this->permanent_url = $url; $this->useragent = $useragent; if (preg_match('/^http(s)?:\/\//i', $url)) { - // syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS + if ($syslog_enabled) + { + syslog(LOG_INFO, 'SimplePie GET ' . SimplePie_Misc::url_remove_credentials($url)); //FreshRSS + } if ($useragent === null) { $useragent = ini_get('user_agent'); @@ -105,17 +107,20 @@ class SimplePie_File curl_setopt($fp, CURLOPT_URL, $url); curl_setopt($fp, CURLOPT_HEADER, 1); curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($fp, CURLOPT_FAILONERROR, 1); curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($fp, CURLOPT_REFERER, $url); curl_setopt($fp, CURLOPT_USERAGENT, $useragent); curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); - curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false); //FreshRSS if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) { curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); } + foreach ($curl_options as $curl_param => $curl_value) { + curl_setopt($fp, $curl_param, $curl_value); + } $this->headers = curl_exec($fp); if (curl_errno($fp) === 23 || curl_errno($fp) === 61) @@ -130,15 +135,17 @@ class SimplePie_File } else { - $info = curl_getinfo($fp); + // Use the updated url provided by curl_getinfo after any redirects. + if ($info = curl_getinfo($fp)) { + $this->url = $info['url']; + } curl_close($fp); - $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1); - $this->headers = array_pop($this->headers); + $this->headers = SimplePie_HTTP_Parser::prepareHeaders($this->headers, $info['redirect_count'] + 1); $parser = new SimplePie_HTTP_Parser($this->headers); if ($parser->parse()) { $this->headers = $parser->headers; - $this->body = $parser->body; + $this->body = trim($parser->body); $this->status_code = $parser->status_code; if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) { @@ -146,7 +153,7 @@ class SimplePie_File $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); $previousStatusCode = $this->status_code; $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); - $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; //FreshRSS + $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; return; } } @@ -231,7 +238,7 @@ class SimplePie_File $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); $previousStatusCode = $this->status_code; $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); - $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; //FreshRSS + $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; return; } if (isset($this->headers['content-encoding'])) @@ -249,7 +256,7 @@ class SimplePie_File } else { - $this->body = $decoder->data; + $this->body = trim($decoder->data); } break; @@ -292,7 +299,7 @@ class SimplePie_File else { $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS; - if (empty($url) || !($this->body = file_get_contents($url))) + if (empty($url) || !($this->body = trim(file_get_contents($url)))) { $this->error = 'file_get_contents could not read the file'; $this->success = false; diff --git a/lib/SimplePie/SimplePie/HTTP/Parser.php b/lib/SimplePie/SimplePie/HTTP/Parser.php index 2fc3a6779..3899c53fa 100644 --- a/lib/SimplePie/SimplePie/HTTP/Parser.php +++ b/lib/SimplePie/SimplePie/HTTP/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -497,4 +496,22 @@ class SimplePie_HTTP_Parser } } } + + /** + * Prepare headers (take care of proxies headers) + * + * @param string $headers Raw headers + * @param integer $count Redirection count. Default to 1. + * + * @return string + */ + static public function prepareHeaders($headers, $count = 1) + { + $data = explode("\r\n\r\n", $headers, $count); + $data = array_pop($data); + if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n\r\n")) { + $data = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $data); + } + return $data; + } } diff --git a/lib/SimplePie/SimplePie/IRI.php b/lib/SimplePie/SimplePie/IRI.php index ed0574701..2b3fbaf07 100644 --- a/lib/SimplePie/SimplePie/IRI.php +++ b/lib/SimplePie/SimplePie/IRI.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -260,6 +259,15 @@ class SimplePie_IRI } /** + * Clean up + */ + public function __destruct() { + $this->set_iri(null, true); + $this->set_path(null, true); + $this->set_authority(null, true); + } + + /** * Create a new IRI object by resolving a relative IRI * * Returns false if $base is not absolute, otherwise an IRI. @@ -768,24 +776,20 @@ class SimplePie_IRI */ public function is_valid() { - $isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null; - if ($this->ipath !== '' && - ( - $isauthority && ( - $this->ipath[0] !== '/' || - substr($this->ipath, 0, 2) === '//' - ) || - ( - $this->scheme === null && - !$isauthority && - strpos($this->ipath, ':') !== false && - (strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/')) - ) - ) - ) - { - return false; - } + if ($this->ipath === '') return true; + + $isauthority = $this->iuserinfo !== null || $this->ihost !== null || + $this->port !== null; + if ($isauthority && $this->ipath[0] === '/') return true; + + if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) return false; + + // Relative urls cannot have a colon in the first path segment (and the + // slashes themselves are not included so skip the first character). + if (!$this->scheme && !$isauthority && + strpos($this->ipath, ':') !== false && + strpos($this->ipath, '/', 1) !== false && + strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; return true; } @@ -797,9 +801,14 @@ class SimplePie_IRI * @param string $iri * @return bool */ - public function set_iri($iri) + public function set_iri($iri, $clear_cache = false) { static $cache; + if ($clear_cache) + { + $cache = null; + return; + } if (!$cache) { $cache = array(); @@ -879,9 +888,14 @@ class SimplePie_IRI * @param string $authority * @return bool */ - public function set_authority($authority) + public function set_authority($authority, $clear_cache = false) { static $cache; + if ($clear_cache) + { + $cache = null; + return; + } if (!$cache) $cache = array(); @@ -1049,9 +1063,14 @@ class SimplePie_IRI * @param string $ipath * @return bool */ - public function set_path($ipath) + public function set_path($ipath, $clear_cache = false) { static $cache; + if ($clear_cache) + { + $cache = null; + return; + } if (!$cache) { $cache = array(); diff --git a/lib/SimplePie/SimplePie/Item.php b/lib/SimplePie/SimplePie/Item.php index 7bd96c15f..425538606 100644 --- a/lib/SimplePie/SimplePie/Item.php +++ b/lib/SimplePie/SimplePie/Item.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -203,14 +202,14 @@ class SimplePie_Item * * Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute * for RDF. If none of these are supplied (or `$hash` is true), creates an - * MD5 hash based on the permalink and title. If either of those are not - * supplied, creates a hash based on the full feed data. + * MD5 hash based on the permalink, title and content. * * @since Beta 2 * @param boolean $hash Should we force using a hash instead of the supplied ID? - * @return string + * @param string|false $fn User-supplied function to generate an hash + * @return string|null */ - public function get_id($hash = false) + public function get_id($hash = false, $fn = 'md5') { if (!$hash) { @@ -238,23 +237,18 @@ class SimplePie_Item { return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT); } - elseif (($return = $this->get_permalink()) !== null) - { - return $return; - } - elseif (($return = $this->get_title()) !== null) - { - return $return; - } } - if ($this->get_permalink() !== null || $this->get_title() !== null) + if ($fn === false) { - return md5($this->get_permalink() . $this->get_title()); + return null; } - else + elseif (!is_callable($fn)) { - return md5(serialize($this->data)); + trigger_error('User-supplied function $fn must be callable', E_USER_WARNING); + $fn = 'md5'; } + return call_user_func($fn, + $this->get_permalink().$this->get_title().$this->get_content()); } /** @@ -322,41 +316,50 @@ class SimplePie_Item */ public function get_description($description_only = false) { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) + if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) && + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) && + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML); + return $return; } elseif (!$description_only) @@ -385,17 +388,20 @@ class SimplePie_Item */ public function get_content($content_only = false) { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) + if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) && + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) && + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); + return $return; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) + elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) && + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + return $return; } elseif (!$content_only) { @@ -406,6 +412,30 @@ class SimplePie_Item return null; } } + + /** + * Get the media:thumbnail of the item + * + * Uses `<media:thumbnail>` + * + * + * @return array|null + */ + public function get_thumbnail() + { + if (!isset($this->data['thumbnail'])) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) + { + $this->data['thumbnail'] = $return[0]['attribs']['']; + } + else + { + $this->data['thumbnail'] = null; + } + } + return $this->data['thumbnail']; + } /** * Get a category for the item @@ -433,53 +463,56 @@ class SimplePie_Item * Uses `<atom:category>`, `<category>` or `<dc:subject>` * * @since Beta 3 - * @return array|null List of {@see SimplePie_Category} objects + * @return SimplePie_Category[]|null List of {@see SimplePie_Category} objects */ public function get_categories() { $categories = array(); - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) + $type = 'category'; + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, $type) as $category) { $term = null; $scheme = null; $label = null; if (isset($category['attribs']['']['term'])) { - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); + $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_HTML); } if (isset($category['attribs']['']['scheme'])) { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_HTML); } if (isset($category['attribs']['']['label'])) { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_HTML); } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); + $categories[] = $this->registry->create('Category', array($term, $scheme, $label, $type)); } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, $type) as $category) { // This is really the label, but keep this as the term also for BC. // Label will also work on retrieving because that falls back to term. - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML); if (isset($category['attribs']['']['domain'])) { - $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); + $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_HTML); } else { $scheme = null; } - $categories[] = $this->registry->create('Category', array($term, $scheme, null)); + $categories[] = $this->registry->create('Category', array($term, $scheme, null, $type)); } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) + + $type = 'subject'; + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, $type) as $category) { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); + $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null, $type)); } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, $type) as $category) { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); + $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null, $type)); } if (!empty($categories)) @@ -616,7 +649,7 @@ class SimplePie_Item $email = null; if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { @@ -624,7 +657,7 @@ class SimplePie_Item } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); } if ($name !== null || $email !== null || $uri !== null) { @@ -638,7 +671,7 @@ class SimplePie_Item $email = null; if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { @@ -646,7 +679,7 @@ class SimplePie_Item } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); } if ($name !== null || $email !== null || $url !== null) { @@ -655,19 +688,19 @@ class SimplePie_Item } if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) { - $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))); + $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); } if (!empty($authors)) @@ -738,31 +771,31 @@ class SimplePie_Item { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) { $this->data['date']['raw'] = $return[0]['data']; } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) { $this->data['date']['raw'] = $return[0]['data']; } @@ -1081,7 +1114,7 @@ class SimplePie_Item * @since Beta 2 * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4). * @todo If an element exists at a level, but its value is empty, we should fall back to the value from the parent (if it exists). - * @return array|null List of SimplePie_Enclosure items + * @return SimplePie_Enclosure[]|null List of SimplePie_Enclosure items */ public function get_enclosures() { @@ -2658,7 +2691,9 @@ class SimplePie_Item // PLAYER if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) { - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'])) { + $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } } else { @@ -2733,7 +2768,9 @@ class SimplePie_Item { foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + if (isset($thumbnail['attribs']['']['url'])) { + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } } if (is_array($thumbnails)) { @@ -2789,9 +2826,17 @@ class SimplePie_Item { $length = ceil($link['attribs']['']['length']); } + if (isset($link['attribs']['']['title'])) + { + $title = $this->sanitize($link['attribs']['']['title'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $title = $title_parent; + } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width)); + $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title, $width)); } } @@ -2851,6 +2896,7 @@ class SimplePie_Item $width = null; $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0])); + $url = $this->feed->sanitize->https_url($url); //FreshRSS if (isset($enclosure[0]['attribs']['']['type'])) { $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); diff --git a/lib/SimplePie/SimplePie/Locator.php b/lib/SimplePie/SimplePie/Locator.php index 4e5f7c1ca..bc314c2cd 100644 --- a/lib/SimplePie/SimplePie/Locator.php +++ b/lib/SimplePie/SimplePie/Locator.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -121,34 +120,41 @@ class SimplePie_Locator { if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) { - return $working; + return $working[0]; } if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local)) { - return $working; + return $working[0]; } if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere)) { - return $working; + return $working[0]; } if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere)) { - return $working; + return $working[0]; } } return null; } - public function is_feed($file) + public function is_feed($file, $check_html = false) { if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) { $sniffer = $this->registry->create('Content_Type_Sniffer', array($file)); $sniffed = $sniffer->get_type(); - if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml', 'application/x-rss+xml'))) //FreshRSS + $mime_types = array('application/rss+xml', 'application/rdf+xml', + 'text/rdf', 'application/atom+xml', 'text/xml', + 'application/xml', 'application/x-rss+xml'); + if ($check_html) + { + $mime_types[] = 'text/html'; + } + if (in_array($sniffed, $mime_types)) { return true; } @@ -226,7 +232,7 @@ class SimplePie_Locator } if ($link->hasAttribute('href') && $link->hasAttribute('rel')) { - $rel = array_unique($this->registry->call('Misc', 'space_seperated_tokens', array(strtolower($link->getAttribute('rel'))))); + $rel = array_unique($this->registry->call('Misc', 'space_separated_tokens', array(strtolower($link->getAttribute('rel'))))); $line = method_exists($link, 'getLineNo') ? $link->getLineNo() : 1; if ($this->base_location < $line) @@ -242,14 +248,14 @@ class SimplePie_Locator continue; } - if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) + if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('text/html', 'application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) { $this->checked_feeds++; $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); $feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent)); - if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) + if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true)) { $feeds[$href] = $feed; } @@ -275,7 +281,7 @@ class SimplePie_Locator { $href = trim($link->getAttribute('href')); $parsed = $this->registry->call('Misc', 'parse_url', array($href)); - if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme'])) + if ($parsed['scheme'] === '' || preg_match('/^(https?|feed)?$/i', $parsed['scheme'])) { if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo()) { @@ -312,6 +318,57 @@ class SimplePie_Locator return null; } + public function get_rel_link($rel) + { + if ($this->dom === null) + { + throw new SimplePie_Exception('DOMDocument not found, unable to use '. + 'locator'); + } + if (!class_exists('DOMXpath')) + { + throw new SimplePie_Exception('DOMXpath not found, unable to use '. + 'get_rel_link'); + } + + $xpath = new DOMXpath($this->dom); + $query = '//a[@rel and @href] | //link[@rel and @href]'; + foreach ($xpath->query($query) as $link) + { + $href = trim($link->getAttribute('href')); + $parsed = $this->registry->call('Misc', 'parse_url', array($href)); + if ($parsed['scheme'] === '' || + preg_match('/^https?$/i', $parsed['scheme'])) + { + if (method_exists($link, 'getLineNo') && + $this->base_location < $link->getLineNo()) + { + $href = + $this->registry->call('Misc', 'absolutize_url', + array(trim($link->getAttribute('href')), + $this->base)); + } + else + { + $href = + $this->registry->call('Misc', 'absolutize_url', + array(trim($link->getAttribute('href')), + $this->http_base)); + } + if ($href === false) + { + return null; + } + $rel_values = explode(' ', strtolower($link->getAttribute('rel'))); + if (in_array($rel, $rel_values)) + { + return $href; + } + } + } + return null; + } + public function extension(&$array) { foreach ($array as $key => $value) @@ -330,7 +387,7 @@ class SimplePie_Locator $feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent)); if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) { - return $feed; + return array($feed); } else { @@ -358,7 +415,7 @@ class SimplePie_Locator $feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent)); if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) { - return $feed; + return array($feed); } else { diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php index 5a263a2e5..40477c01e 100644 --- a/lib/SimplePie/SimplePie/Misc.php +++ b/lib/SimplePie/SimplePie/Misc.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -79,9 +78,9 @@ 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; + if (substr($relative, 0, 2) === '//') + {//Protocol-relative URLs "//www.example.net" + return 'https:' . $relative; } $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); if ($iri === false) @@ -128,7 +127,7 @@ class SimplePie_Misc { $attribs[$j][2] = $attribs[$j][1]; } - $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8'); //FreshRSS + $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j])); } } } @@ -142,7 +141,7 @@ class SimplePie_Misc foreach ($element['attribs'] as $key => $value) { $key = strtolower($key); - $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; //FreshRSS + $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; } if ($element['self_closing']) { @@ -338,11 +337,16 @@ class SimplePie_Misc { return $return; } - // This is last, as behaviour of this varies with OS userland and PHP version + // This is third, as behaviour of this varies with OS userland and PHP version elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) { return $return; } + // This is last, as behaviour of this varies with OS userland and PHP version + elseif (class_exists('\UConverter') && ($return = SimplePie_Misc::change_encoding_uconverter($data, $input, $output))) + { + return $return; + } // If we can't do anything, just fail else { @@ -394,6 +398,17 @@ class SimplePie_Misc } /** + * @param string $data + * @param string $input + * @param string $output + * @return string|false + */ + protected static function change_encoding_uconverter($data, $input, $output) + { + return @\UConverter::transcode($data, $output, $input); + } + + /** * Normalize an encoding name * * This is automatically generated by create.php @@ -1947,7 +1962,7 @@ class SimplePie_Misc return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); } - public static function space_seperated_tokens($string) + public static function space_separated_tokens($string) { $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; $string_length = strlen($string); @@ -2178,7 +2193,8 @@ function embed_wmedia(width, height, link) { /** * Get the SimplePie build timestamp * - * Return SimplePie.php modification time. + * Uses the git index if it exists, otherwise uses the modification time + * of the newest file. */ public static function get_build() { @@ -2240,5 +2256,15 @@ function embed_wmedia(width, height, link) { { // No-op } + + /** + * Sanitize a URL by removing HTTP credentials. + * @param $url the URL to sanitize. + * @return the same URL without HTTP credentials. + */ + public static function url_remove_credentials($url) //FreshRSS + { + return preg_replace('#^(https?://)[^/:@]+:[^/:@]+@#i', '$1', $url); + } } diff --git a/lib/SimplePie/SimplePie/Net/IPv6.php b/lib/SimplePie/SimplePie/Net/IPv6.php index 2ff1afc90..47658aff2 100644 --- a/lib/SimplePie/SimplePie/Net/IPv6.php +++ b/lib/SimplePie/SimplePie/Net/IPv6.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Parse/Date.php b/lib/SimplePie/SimplePie/Parse/Date.php index ba7c0703e..1f2156655 100644 --- a/lib/SimplePie/SimplePie/Parse/Date.php +++ b/lib/SimplePie/SimplePie/Parse/Date.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -173,7 +172,7 @@ class SimplePie_Parse_Date 'aug' => 8, 'august' => 8, 'sep' => 9, - 'september' => 8, + 'september' => 9, 'oct' => 10, 'october' => 10, 'nov' => 11, @@ -331,7 +330,7 @@ class SimplePie_Parse_Date 'CCT' => 23400, 'CDT' => -18000, 'CEDT' => 7200, - 'CEST' => 7200, //FreshRSS + 'CEST' => 7200, 'CET' => 3600, 'CGST' => -7200, 'CGT' => -10800, @@ -631,7 +630,7 @@ class SimplePie_Parse_Date /** * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as * well as allowing any of upper or lower case "T", horizontal tabs, or - * spaces to be used as the time seperator (including more than one)) + * spaces to be used as the time separator (including more than one)) * * @access protected * @return int Timestamp @@ -691,7 +690,7 @@ class SimplePie_Parse_Date } // Convert the number of seconds to an integer, taking decimals into account - $second = round($match[6] + $match[7] / pow(10, strlen($match[7]))); + $second = round((int)$match[6] + (int)$match[7] / pow(10, strlen($match[7]))); return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; } @@ -721,7 +720,7 @@ class SimplePie_Parse_Date { $output .= substr($string, $position, $pos - $position); $position = $pos + 1; - if ($string[$pos - 1] !== '\\') + if ($pos === 0 || $string[$pos - 1] !== '\\') { $depth++; while ($depth && $position < $length) diff --git a/lib/SimplePie/SimplePie/Parser.php b/lib/SimplePie/SimplePie/Parser.php index 7fb7bd9be..9348382ad 100644 --- a/lib/SimplePie/SimplePie/Parser.php +++ b/lib/SimplePie/SimplePie/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -435,4 +434,231 @@ class SimplePie_Parser } return $cache[$string]; } -} + + private function parse_hcard($data, $category = false) { + $name = ''; + $link = ''; + // Check if h-card is set and pass that information on in the link. + if (isset($data['type']) && in_array('h-card', $data['type'])) { + if (isset($data['properties']['name'][0])) { + $name = $data['properties']['name'][0]; + } + if (isset($data['properties']['url'][0])) { + $link = $data['properties']['url'][0]; + if ($name === '') { + $name = $link; + } + else { + // can't have commas in categories. + $name = str_replace(',', '', $name); + } + $person_tag = $category ? '<span class="person-tag"></span>' : ''; + return '<a class="h-card" href="'.$link.'">'.$person_tag.$name.'</a>'; + } + } + return isset($data['value']) ? $data['value'] : ''; + } + + private function parse_microformats(&$data, $url) { + $feed_title = ''; + $feed_author = NULL; + $author_cache = array(); + $items = array(); + $entries = array(); + $mf = Mf2\parse($data, $url); + // First look for an h-feed. + $h_feed = array(); + foreach ($mf['items'] as $mf_item) { + if (in_array('h-feed', $mf_item['type'])) { + $h_feed = $mf_item; + break; + } + // Also look for an h-feed in the children of each top level item. + if (!isset($mf_item['children'][0]['type'])) continue; + if (in_array('h-feed', $mf_item['children'][0]['type'])) { + $h_feed = $mf_item['children'][0]; + // In this case the parent of the h-feed may be an h-card, so use it as + // the feed_author. + if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item; + break; + } + } + if (isset($h_feed['children'])) { + $entries = $h_feed['children']; + // Also set the feed title and store author from the h-feed if available. + if (isset($mf['items'][0]['properties']['name'][0])) { + $feed_title = $mf['items'][0]['properties']['name'][0]; + } + if (isset($mf['items'][0]['properties']['author'][0])) { + $feed_author = $mf['items'][0]['properties']['author'][0]; + } + } + else { + $entries = $mf['items']; + } + for ($i = 0; $i < count($entries); $i++) { + $entry = $entries[$i]; + if (in_array('h-entry', $entry['type'])) { + $item = array(); + $title = ''; + $description = ''; + if (isset($entry['properties']['url'][0])) { + $link = $entry['properties']['url'][0]; + if (isset($link['value'])) $link = $link['value']; + $item['link'] = array(array('data' => $link)); + } + if (isset($entry['properties']['uid'][0])) { + $guid = $entry['properties']['uid'][0]; + if (isset($guid['value'])) $guid = $guid['value']; + $item['guid'] = array(array('data' => $guid)); + } + if (isset($entry['properties']['name'][0])) { + $title = $entry['properties']['name'][0]; + if (isset($title['value'])) $title = $title['value']; + $item['title'] = array(array('data' => $title)); + } + if (isset($entry['properties']['author'][0]) || isset($feed_author)) { + // author is a special case, it can be plain text or an h-card array. + // If it's plain text it can also be a url that should be followed to + // get the actual h-card. + $author = isset($entry['properties']['author'][0]) ? + $entry['properties']['author'][0] : $feed_author; + if (!is_string($author)) { + $author = $this->parse_hcard($author); + } + else if (strpos($author, 'http') === 0) { + if (isset($author_cache[$author])) { + $author = $author_cache[$author]; + } + else { + $mf = Mf2\fetch($author); + foreach ($mf['items'] as $hcard) { + // Only interested in an h-card by itself in this case. + if (!in_array('h-card', $hcard['type'])) { + continue; + } + // It must have a url property matching what we fetched. + if (!isset($hcard['properties']['url']) || + !(in_array($author, $hcard['properties']['url']))) { + continue; + } + // Save parse_hcard the trouble of finding the correct url. + $hcard['properties']['url'][0] = $author; + // Cache this h-card for the next h-entry to check. + $author_cache[$author] = $this->parse_hcard($hcard); + $author = $author_cache[$author]; + break; + } + } + } + $item['author'] = array(array('data' => $author)); + } + if (isset($entry['properties']['photo'][0])) { + // If a photo is also in content, don't need to add it again here. + $content = ''; + if (isset($entry['properties']['content'][0]['html'])) { + $content = $entry['properties']['content'][0]['html']; + } + $photo_list = array(); + for ($j = 0; $j < count($entry['properties']['photo']); $j++) { + $photo = $entry['properties']['photo'][$j]; + if (strpos($content, $photo) === false) { + $photo_list[] = $photo; + } + } + // When there's more than one photo show the first and use a lightbox. + $count = count($photo_list); + if ($count > 1) { + $description = '<p>'; + for ($j = 0; $j < $count; $j++) { + $hidden = $j === 0 ? '' : 'class="hidden" '; + $description .= '<a href="'.$photo_list[$j].'" '.$hidden. + 'data-lightbox="image-set-'.$i.'">'. + '<img src="'.$photo_list[$j].'"></a>'; + } + $description .= '<br><b>'.$count.' photos</b></p>'; + } + else if ($count == 1) { + $description = '<p><img src="'.$photo_list[0].'"></p>'; + } + } + if (isset($entry['properties']['content'][0]['html'])) { + // e-content['value'] is the same as p-name when they are on the same + // element. Use this to replace title with a strip_tags version so + // that alt text from images is not included in the title. + if ($entry['properties']['content'][0]['value'] === $title) { + $title = strip_tags($entry['properties']['content'][0]['html']); + $item['title'] = array(array('data' => $title)); + } + $description .= $entry['properties']['content'][0]['html']; + if (isset($entry['properties']['in-reply-to'][0]['value'])) { + $in_reply_to = $entry['properties']['in-reply-to'][0]['value']; + $description .= '<p><span class="in-reply-to"></span> '. + '<a href="'.$in_reply_to.'">'.$in_reply_to.'</a><p>'; + } + $item['description'] = array(array('data' => $description)); + } + if (isset($entry['properties']['category'])) { + $category_csv = ''; + // Categories can also contain h-cards. + foreach ($entry['properties']['category'] as $category) { + if ($category_csv !== '') $category_csv .= ', '; + if (is_string($category)) { + // Can't have commas in categories. + $category_csv .= str_replace(',', '', $category); + } + else { + $category_csv .= $this->parse_hcard($category, true); + } + } + $item['category'] = array(array('data' => $category_csv)); + } + if (isset($entry['properties']['published'][0])) { + $timestamp = strtotime($entry['properties']['published'][0]); + $pub_date = date('F j Y g:ia', $timestamp).' GMT'; + $item['pubDate'] = array(array('data' => $pub_date)); + } + // The title and description are set to the empty string to represent + // a deleted item (which also makes it an invalid rss item). + if (isset($entry['properties']['deleted'][0])) { + $item['title'] = array(array('data' => '')); + $item['description'] = array(array('data' => '')); + } + $items[] = array('child' => array('' => $item)); + } + } + // Mimic RSS data format when storing microformats. + $link = array(array('data' => $url)); + $image = ''; + if (!is_string($feed_author) && + isset($feed_author['properties']['photo'][0])) { + $image = array(array('child' => array('' => array('url' => + array(array('data' => $feed_author['properties']['photo'][0])))))); + } + // Use the a name given for the h-feed, or get the title from the html. + if ($feed_title !== '') { + $feed_title = array(array('data' => htmlspecialchars($feed_title))); + } + else if ($position = strpos($data, '<title>')) { + $start = $position < 200 ? 0 : $position - 200; + $check = substr($data, $start, 400); + $matches = array(); + if (preg_match('/<title>(.+)<\/title>/', $check, $matches)) { + $feed_title = array(array('data' => htmlspecialchars($matches[1]))); + } + } + $channel = array('channel' => array(array('child' => array('' => + array('link' => $link, 'image' => $image, 'title' => $feed_title, + 'item' => $items))))); + $rss = array(array('attribs' => array('' => array('version' => '2.0')), + 'child' => array('' => $channel))); + $this->data = array('child' => array('' => array('rss' => $rss))); + return true; + } + + private function declare_html_entities() { + // This is required because the RSS specification says that entity-encoded + // html is allowed, but the xml specification says they must be declared. + return '<!DOCTYPE html [ <!ENTITY nbsp " "> <!ENTITY iexcl "¡"> <!ENTITY cent "¢"> <!ENTITY pound "£"> <!ENTITY curren "¤"> <!ENTITY yen "¥"> <!ENTITY brvbar "¦"> <!ENTITY sect "§"> <!ENTITY uml "¨"> <!ENTITY copy "©"> <!ENTITY ordf "ª"> <!ENTITY laquo "«"> <!ENTITY not "¬"> <!ENTITY shy "­"> <!ENTITY reg "®"> <!ENTITY macr "¯"> <!ENTITY deg "°"> <!ENTITY plusmn "±"> <!ENTITY sup2 "²"> <!ENTITY sup3 "³"> <!ENTITY acute "´"> <!ENTITY micro "µ"> <!ENTITY para "¶"> <!ENTITY middot "·"> <!ENTITY cedil "¸"> <!ENTITY sup1 "¹"> <!ENTITY ordm "º"> <!ENTITY raquo "»"> <!ENTITY frac14 "¼"> <!ENTITY frac12 "½"> <!ENTITY frac34 "¾"> <!ENTITY iquest "¿"> <!ENTITY Agrave "À"> <!ENTITY Aacute "Á"> <!ENTITY Acirc "Â"> <!ENTITY Atilde "Ã"> <!ENTITY Auml "Ä"> <!ENTITY Aring "Å"> <!ENTITY AElig "Æ"> <!ENTITY Ccedil "Ç"> <!ENTITY Egrave "È"> <!ENTITY Eacute "É"> <!ENTITY Ecirc "Ê"> <!ENTITY Euml "Ë"> <!ENTITY Igrave "Ì"> <!ENTITY Iacute "Í"> <!ENTITY Icirc "Î"> <!ENTITY Iuml "Ï"> <!ENTITY ETH "Ð"> <!ENTITY Ntilde "Ñ"> <!ENTITY Ograve "Ò"> <!ENTITY Oacute "Ó"> <!ENTITY Ocirc "Ô"> <!ENTITY Otilde "Õ"> <!ENTITY Ouml "Ö"> <!ENTITY times "×"> <!ENTITY Oslash "Ø"> <!ENTITY Ugrave "Ù"> <!ENTITY Uacute "Ú"> <!ENTITY Ucirc "Û"> <!ENTITY Uuml "Ü"> <!ENTITY Yacute "Ý"> <!ENTITY THORN "Þ"> <!ENTITY szlig "ß"> <!ENTITY agrave "à"> <!ENTITY aacute "á"> <!ENTITY acirc "â"> <!ENTITY atilde "ã"> <!ENTITY auml "ä"> <!ENTITY aring "å"> <!ENTITY aelig "æ"> <!ENTITY ccedil "ç"> <!ENTITY egrave "è"> <!ENTITY eacute "é"> <!ENTITY ecirc "ê"> <!ENTITY euml "ë"> <!ENTITY igrave "ì"> <!ENTITY iacute "í"> <!ENTITY icirc "î"> <!ENTITY iuml "ï"> <!ENTITY eth "ð"> <!ENTITY ntilde "ñ"> <!ENTITY ograve "ò"> <!ENTITY oacute "ó"> <!ENTITY ocirc "ô"> <!ENTITY otilde "õ"> <!ENTITY ouml "ö"> <!ENTITY divide "÷"> <!ENTITY oslash "ø"> <!ENTITY ugrave "ù"> <!ENTITY uacute "ú"> <!ENTITY ucirc "û"> <!ENTITY uuml "ü"> <!ENTITY yacute "ý"> <!ENTITY thorn "þ"> <!ENTITY yuml "ÿ"> <!ENTITY OElig "Œ"> <!ENTITY oelig "œ"> <!ENTITY Scaron "Š"> <!ENTITY scaron "š"> <!ENTITY Yuml "Ÿ"> <!ENTITY fnof "ƒ"> <!ENTITY circ "ˆ"> <!ENTITY tilde "˜"> <!ENTITY Alpha "Α"> <!ENTITY Beta "Β"> <!ENTITY Gamma "Γ"> <!ENTITY Epsilon "Ε"> <!ENTITY Zeta "Ζ"> <!ENTITY Eta "Η"> <!ENTITY Theta "Θ"> <!ENTITY Iota "Ι"> <!ENTITY Kappa "Κ"> <!ENTITY Lambda "Λ"> <!ENTITY Mu "Μ"> <!ENTITY Nu "Ν"> <!ENTITY Xi "Ξ"> <!ENTITY Omicron "Ο"> <!ENTITY Pi "Π"> <!ENTITY Rho "Ρ"> <!ENTITY Sigma "Σ"> <!ENTITY Tau "Τ"> <!ENTITY Upsilon "Υ"> <!ENTITY Phi "Φ"> <!ENTITY Chi "Χ"> <!ENTITY Psi "Ψ"> <!ENTITY Omega "Ω"> <!ENTITY alpha "α"> <!ENTITY beta "β"> <!ENTITY gamma "γ"> <!ENTITY delta "δ"> <!ENTITY epsilon "ε"> <!ENTITY zeta "ζ"> <!ENTITY eta "η"> <!ENTITY theta "θ"> <!ENTITY iota "ι"> <!ENTITY kappa "κ"> <!ENTITY lambda "λ"> <!ENTITY mu "μ"> <!ENTITY nu "ν"> <!ENTITY xi "ξ"> <!ENTITY omicron "ο"> <!ENTITY pi "π"> <!ENTITY rho "ρ"> <!ENTITY sigmaf "ς"> <!ENTITY sigma "σ"> <!ENTITY tau "τ"> <!ENTITY upsilon "υ"> <!ENTITY phi "φ"> <!ENTITY chi "χ"> <!ENTITY psi "ψ"> <!ENTITY omega "ω"> <!ENTITY thetasym "ϑ"> <!ENTITY upsih "ϒ"> <!ENTITY piv "ϖ"> <!ENTITY ensp " "> <!ENTITY emsp " "> <!ENTITY thinsp " "> <!ENTITY zwnj "‌"> <!ENTITY zwj "‍"> <!ENTITY lrm "‎"> <!ENTITY rlm "‏"> <!ENTITY ndash "–"> <!ENTITY mdash "—"> <!ENTITY lsquo "‘"> <!ENTITY rsquo "’"> <!ENTITY sbquo "‚"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY bdquo "„"> <!ENTITY dagger "†"> <!ENTITY Dagger "‡"> <!ENTITY bull "•"> <!ENTITY hellip "…"> <!ENTITY permil "‰"> <!ENTITY prime "′"> <!ENTITY Prime "″"> <!ENTITY lsaquo "‹"> <!ENTITY rsaquo "›"> <!ENTITY oline "‾"> <!ENTITY frasl "⁄"> <!ENTITY euro "€"> <!ENTITY image "ℑ"> <!ENTITY weierp "℘"> <!ENTITY real "ℜ"> <!ENTITY trade "™"> <!ENTITY alefsym "ℵ"> <!ENTITY larr "←"> <!ENTITY uarr "↑"> <!ENTITY rarr "→"> <!ENTITY darr "↓"> <!ENTITY harr "↔"> <!ENTITY crarr "↵"> <!ENTITY lArr "⇐"> <!ENTITY uArr "⇑"> <!ENTITY rArr "⇒"> <!ENTITY dArr "⇓"> <!ENTITY hArr "⇔"> <!ENTITY forall "∀"> <!ENTITY part "∂"> <!ENTITY exist "∃"> <!ENTITY empty "∅"> <!ENTITY nabla "∇"> <!ENTITY isin "∈"> <!ENTITY notin "∉"> <!ENTITY ni "∋"> <!ENTITY prod "∏"> <!ENTITY sum "∑"> <!ENTITY minus "−"> <!ENTITY lowast "∗"> <!ENTITY radic "√"> <!ENTITY prop "∝"> <!ENTITY infin "∞"> <!ENTITY ang "∠"> <!ENTITY and "∧"> <!ENTITY or "∨"> <!ENTITY cap "∩"> <!ENTITY cup "∪"> <!ENTITY int "∫"> <!ENTITY there4 "∴"> <!ENTITY sim "∼"> <!ENTITY cong "≅"> <!ENTITY asymp "≈"> <!ENTITY ne "≠"> <!ENTITY equiv "≡"> <!ENTITY le "≤"> <!ENTITY ge "≥"> <!ENTITY sub "⊂"> <!ENTITY sup "⊃"> <!ENTITY nsub "⊄"> <!ENTITY sube "⊆"> <!ENTITY supe "⊇"> <!ENTITY oplus "⊕"> <!ENTITY otimes "⊗"> <!ENTITY perp "⊥"> <!ENTITY sdot "⋅"> <!ENTITY lceil "⌈"> <!ENTITY rceil "⌉"> <!ENTITY lfloor "⌊"> <!ENTITY rfloor "⌋"> <!ENTITY lang "〈"> <!ENTITY rang "〉"> <!ENTITY loz "◊"> <!ENTITY spades "♠"> <!ENTITY clubs "♣"> <!ENTITY hearts "♥"> <!ENTITY diams "♦"> ]>'; + } +}
\ No newline at end of file diff --git a/lib/SimplePie/SimplePie/Rating.php b/lib/SimplePie/SimplePie/Rating.php index b5fe80516..eaf57080c 100644 --- a/lib/SimplePie/SimplePie/Rating.php +++ b/lib/SimplePie/SimplePie/Rating.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Registry.php b/lib/SimplePie/SimplePie/Registry.php index bd9c1f535..e0909bb74 100755 --- a/lib/SimplePie/SimplePie/Registry.php +++ b/lib/SimplePie/SimplePie/Registry.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -113,7 +112,7 @@ class SimplePie_Registry */ public function register($type, $class, $legacy = false) { - if (!is_subclass_of($class, $this->default[$type])) + if (!@is_subclass_of($class, $this->default[$type])) { return false; } @@ -222,4 +221,4 @@ class SimplePie_Registry $result = call_user_func_array(array($class, $method), $parameters); return $result; } -}
\ No newline at end of file +} diff --git a/lib/SimplePie/SimplePie/Restriction.php b/lib/SimplePie/SimplePie/Restriction.php index a1d59916d..001a5cd28 100644 --- a/lib/SimplePie/SimplePie/Restriction.php +++ b/lib/SimplePie/SimplePie/Restriction.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/Sanitize.php b/lib/SimplePie/SimplePie/Sanitize.php index 168a5e2e8..c55ee50b7 100644 --- a/lib/SimplePie/SimplePie/Sanitize.php +++ b/lib/SimplePie/SimplePie/Sanitize.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue @@ -61,8 +60,8 @@ class SimplePie_Sanitize var $image_handler = ''; 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_attributes = array('bgsound', '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')); var $strip_comments = false; var $output_encoding = 'UTF-8'; var $enable_cache = true; @@ -73,6 +72,15 @@ class SimplePie_Sanitize var $force_fsockopen = false; var $replace_url_attributes = null; + /** + * List of domains for which force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * Array is tree split at DNS levels. Example: + * array('biz' => true, 'com' => array('example' => true), 'net' => array('example') => array('www' => true)) + * FreshRSS + */ + var $https_domains = array('com' => array('dailymotion' => true, 'youtube' => true)); + public function __construct() { // Set defaults @@ -161,7 +169,7 @@ class SimplePie_Sanitize $this->encode_instead_of_strip = (bool) $encode; } - public function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) + public function strip_attributes($attribs = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) { if ($attribs) { @@ -242,6 +250,71 @@ class SimplePie_Sanitize $this->replace_url_attributes = (array) $element_attribute; } + /** + * Set the list of domains for which force HTTPS. + * @see SimplePie_Misc::https_url() + * Example array('biz', 'example.com', 'example.org', 'www.example.net'); + * FreshRSS + */ + public function set_https_domains($domains) + { + $this->https_domains = array(); + foreach ($domains as $domain) + { + $domain = trim($domain, ". \t\n\r\0\x0B"); + $segments = array_reverse(explode('.', $domain)); + $node =& $this->https_domains; + foreach ($segments as $segment) + {//Build a tree + if ($node === true) + { + break; + } + if (!isset($node[$segment])) + { + $node[$segment] = array(); + } + $node =& $node[$segment]; + } + $node = true; + } + } + + /** + * Check if the domain is in the list of forced HTTPS + * FreshRSS + */ + protected function is_https_domain($domain) + { + $domain = trim($domain, '. '); + $segments = array_reverse(explode('.', $domain)); + $node =& $this->https_domains; + foreach ($segments as $segment) + {//Explore the tree + if (isset($node[$segment])) + { + $node =& $node[$segment]; + } + else + { + break; + } + } + return $node === true; + } + + /** + * Force HTTPS for selected Web sites + * FreshRSS + */ + public function https_url($url) + { + return (strtolower(substr($url, 0, 7)) === 'http://') && + $this->is_https_domain(parse_url($url, PHP_URL_HOST)) ? + substr_replace($url, 's', 4, 0) : //Add the 's' to HTTPS + $url; + } + public function sanitize($data, $type, $base = '') { $data = trim($data); @@ -249,6 +322,7 @@ class SimplePie_Sanitize { if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML) { + $data = htmlspecialchars_decode($data, ENT_QUOTES); //FreshRSS if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data)) { $type |= SIMPLEPIE_CONSTRUCT_HTML; @@ -273,13 +347,14 @@ class SimplePie_Sanitize } $document = new DOMDocument(); $document->encoding = 'UTF-8'; + $data = $this->preprocess($data, $type); set_error_handler(array('SimplePie_Misc', 'silence_errors')); $document->loadHTML($data); restore_error_handler(); - $xpath = new DOMXPath($document); //FreshRSS + $xpath = new DOMXPath($document); // Strip comments if ($this->strip_comments) @@ -362,19 +437,17 @@ class SimplePie_Sanitize } } - // Remove the DOCTYPE - // Seems to cause segfaulting if we don't do this - if ($document->firstChild instanceof DOMDocumentType) + // Get content node + $div = $document->getElementsByTagName('body')->item(0)->firstChild; + // Finally, convert to a HTML string + if (version_compare(PHP_VERSION, '5.3.6', '>=')) { - $document->removeChild($document->firstChild); + $data = trim($document->saveHTML($div)); + } + else + { + $data = trim($document->saveXML($div)); } - - // Move everything from the body to the root - $real_body = $document->getElementsByTagName('body')->item(0)->childNodes->item(0); - $document->replaceChild($real_body, $document->firstChild); - - // Finally, convert to a HTML string - $data = trim($document->saveHTML()); if ($this->remove_div) { @@ -450,7 +523,8 @@ class SimplePie_Sanitize if ($element->hasAttribute($attribute)) { $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base)); - if ($value !== false) + $value = $this->https_url($value); //FreshRSS + if ($value) { $element->setAttribute($attribute, $value); } diff --git a/lib/SimplePie/SimplePie/Source.php b/lib/SimplePie/SimplePie/Source.php index 2613798fd..1a66a392d 100644 --- a/lib/SimplePie/SimplePie/Source.php +++ b/lib/SimplePie/SimplePie/Source.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/XML/Declaration/Parser.php b/lib/SimplePie/SimplePie/XML/Declaration/Parser.php index 589e452a2..99e751672 100644 --- a/lib/SimplePie/SimplePie/XML/Declaration/Parser.php +++ b/lib/SimplePie/SimplePie/XML/Declaration/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/SimplePie/SimplePie/gzdecode.php b/lib/SimplePie/SimplePie/gzdecode.php index 6e65f0811..0e8bc8fc6 100644 --- a/lib/SimplePie/SimplePie/gzdecode.php +++ b/lib/SimplePie/SimplePie/gzdecode.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,8 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.4-dev - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon * @author Ryan McCue diff --git a/lib/favicons.php b/lib/favicons.php new file mode 100644 index 000000000..2d6f7aab7 --- /dev/null +++ b/lib/favicons.php @@ -0,0 +1,110 @@ +<?php +$favicons_dir = DATA_PATH . '/favicons/'; +$default_favicon = PUBLIC_PATH . '/themes/icons/default_favicon.ico'; + +function isImgMime($content) { + //Based on https://github.com/ArthurHoaro/favicon/blob/3a4f93da9bb24915b21771eb7873a21bde26f5d1/src/Favicon/Favicon.php#L311-L319 + if ($content == '') { + return false; + } + if (!extension_loaded('fileinfo')) { + return true; + } + $isImage = true; + try { + $fInfo = finfo_open(FILEINFO_MIME_TYPE); + $isImage = strpos(finfo_buffer($fInfo, $content), 'image') !== false; + finfo_close($fInfo); + } catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + } + return $isImage; +} + +function downloadHttp(&$url, $curlOptions = array()) { + syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url); + if (substr($url, 0, 2) === '//') { + $url = 'https:' . $favicon; + } + if ($url == '' || filter_var($url, FILTER_VALIDATE_URL) === false) { + return ''; + } + $ch = curl_init($url); + curl_setopt_array($ch, array( + CURLOPT_RETURNTRANSFER => true, + CURLOPT_TIMEOUT => 15, + CURLOPT_USERAGENT => FRESHRSS_USERAGENT, + CURLOPT_MAXREDIRS => 10, + )); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //Keep option separated for open_basedir bug + if (defined('CURLOPT_ENCODING')) { + curl_setopt($ch, CURLOPT_ENCODING, ''); //Enable all encodings + } + curl_setopt_array($ch, $curlOptions); + $response = curl_exec($ch); + $info = curl_getinfo($ch); + curl_close($ch); + if (!empty($info['url']) && (filter_var($info['url'], FILTER_VALIDATE_URL) !== false)) { + $url = $info['url']; //Possible redirect + } + return $info['http_code'] == 200 ? $response : ''; +} + +function searchFavicon(&$url) { + $dom = new DOMDocument(); + $html = downloadHttp($url); + if ($html != '' && @$dom->loadHTML($html, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING)) { + $rels = array('shortcut icon', 'icon'); + $links = $dom->getElementsByTagName('link'); + foreach ($rels as $rel) { + foreach ($links as $link) { + if ($link->hasAttribute('rel') && $link->hasAttribute('href') && + strtolower(trim($link->getAttribute('rel'))) === $rel) { + $href = trim($link->getAttribute('href')); + if (substr($href, 0, 2) === '//') { + // Case of protocol-relative URLs + if (preg_match('%^(https?:)//%i', $url, $matches)) { + $href = $matches[1] . $href; + } else { + $href = 'https:' . $href; + } + } + if (filter_var($href, FILTER_VALIDATE_URL) === false) { + $href = SimplePie_IRI::absolutize($url, $href); + } + $favicon = downloadHttp($href, array( + CURLOPT_REFERER => $url, + )); + if (isImgMime($favicon)) { + return $favicon; + } + } + } + } + } + return ''; +} + +function download_favicon($url, $dest) { + global $default_favicon; + $url = trim($url); + $favicon = searchFavicon($url); + if ($favicon == '') { + $rootUrl = preg_replace('%^(https?://[^/]+).*$%i', '$1/', $url); + if ($rootUrl != $url) { + $url = $rootUrl; + $favicon = searchFavicon($url); + } + if ($favicon == '') { + $link = $rootUrl . 'favicon.ico'; + $favicon = downloadHttp($link, array( + CURLOPT_REFERER => $url, + )); + if (!isImgMime($favicon)) { + $favicon = ''; + } + } + } + return ($favicon != '' && file_put_contents($dest, $favicon)) || + @copy($default_favicon, $dest); +} diff --git a/lib/http-conditional.php b/lib/http-conditional.php index 59fbef41f..6d3a0a97f 100644 --- a/lib/http-conditional.php +++ b/lib/http-conditional.php @@ -35,12 +35,12 @@ ... //Rest of the script, just as you would do normally. ?> - Version 1.7 beta, 2013-12-02, http://alexandre.alapetite.fr/doc-alex/php-http-304/ + Version 1.8 beta, 2016-08-07, http://alexandre.alapetite.fr/doc-alex/php-http-304/ ------------------------------------------------------------------ Written by Alexandre Alapetite, http://alexandre.alapetite.fr/cv/ - Copyright 2004-2013, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR), + Copyright 2004-2016, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR), http://creativecommons.org/licenses/by-sa/2.0/fr/ http://alexandre.alapetite.fr/divers/apropos/#by-sa - Attribution. You must give the original author credit @@ -96,7 +96,8 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod if ((!$is412)&&isset($_SERVER['HTTP_IF_MATCH'])) {//rfc2616-sec14.html#sec14.24 $etagsClient=stripslashes($_SERVER['HTTP_IF_MATCH']); - $is412=(($etagClient!=='*')&&(strpos($etagsClient,$etagServer)===false)); + $etagsClient=str_ireplace('-gzip','',$etagsClient); + $is412=(($etagsClient!=='*')&&(strpos($etagsClient,$etagServer)===false)); } if ($is304&&isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {//rfc2616-sec14.html#sec14.25 //rfc1945.txt @@ -111,6 +112,7 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod {//rfc2616-sec14.html#sec14.26 $nbCond++; $etagClient=stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); + $etagClient=str_ireplace('-gzip','',$etagClient); $is304=(($etagClient===$etagServer)||($etagClient==='*')); } if ((!$is412)&&isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) diff --git a/lib/lib_date.php b/lib/lib_date.php index 9533711e3..cb1f1d1e2 100644 --- a/lib/lib_date.php +++ b/lib/lib_date.php @@ -1,6 +1,6 @@ <?php /** - * Author: Alexandre Alapetite http://alexandre.alapetite.fr + * Author: Alexandre Alapetite https://alexandre.alapetite.fr * 2014-06-01 * License: GNU AGPLv3 http://www.gnu.org/licenses/agpl-3.0.html * @@ -63,8 +63,7 @@ function _dateCeiling($isoDate) { } function _noDelimit($isoDate) { - return $isoDate === null || $isoDate === '' ? null : - str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone + return $isoDate === null || $isoDate === '' ? null : str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone } function _dateRelative($d1, $d2) { diff --git a/lib/lib_install.php b/lib/lib_install.php new file mode 100644 index 000000000..7305d8e28 --- /dev/null +++ b/lib/lib_install.php @@ -0,0 +1,147 @@ +<?php + +define('BCRYPT_COST', 9); + +Minz_Configuration::register('default_system', join_path(FRESHRSS_PATH, 'config.default.php')); +Minz_Configuration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php')); + +function checkRequirements($dbType = '') { + $php = version_compare(PHP_VERSION, '5.3.8') >= 0; + $minz = file_exists(join_path(LIB_PATH, 'Minz')); + $curl = extension_loaded('curl'); + $pdo_mysql = extension_loaded('pdo_mysql'); + $pdo_sqlite = extension_loaded('pdo_sqlite'); + $pdo_pgsql = extension_loaded('pdo_pgsql'); + $message = ''; + switch ($dbType) { + case 'mysql': + $pdo_sqlite = $pdo_pgsql = true; + $pdo = $pdo_mysql; + break; + case 'sqlite': + $pdo_mysql = $pdo_pgsql = true; + $pdo = $pdo_sqlite; + break; + case 'pgsql': + $pdo_mysql = $pdo_sqlite = true; + $pdo = $pdo_pgsql; + break; + case '': + $pdo = $pdo_mysql || $pdo_sqlite || $pdo_pgsql; + break; + default: + $pdo_mysql = $pdo_sqlite = $pdo_pgsql = true; + $pdo = false; + $message = 'Invalid database type!'; + break; + } + $pcre = extension_loaded('pcre'); + $ctype = extension_loaded('ctype'); + $fileinfo = extension_loaded('fileinfo'); + $dom = class_exists('DOMDocument'); + $xml = function_exists('xml_parser_create'); + $json = function_exists('json_encode'); + $data = DATA_PATH && is_writable(DATA_PATH); + $cache = CACHE_PATH && is_writable(CACHE_PATH); + $users = USERS_PATH && is_writable(USERS_PATH); + $favicons = is_writable(join_path(DATA_PATH, 'favicons')); + $http_referer = is_referer_from_same_domain(); + + return array( + 'php' => $php ? 'ok' : 'ko', + 'minz' => $minz ? 'ok' : 'ko', + 'curl' => $curl ? 'ok' : 'ko', + 'pdo-mysql' => $pdo_mysql ? 'ok' : 'ko', + 'pdo-sqlite' => $pdo_sqlite ? 'ok' : 'ko', + 'pdo-pgsql' => $pdo_pgsql ? 'ok' : 'ko', + 'pdo' => $pdo ? 'ok' : 'ko', + 'pcre' => $pcre ? 'ok' : 'ko', + 'ctype' => $ctype ? 'ok' : 'ko', + 'fileinfo' => $fileinfo ? 'ok' : 'ko', + 'dom' => $dom ? 'ok' : 'ko', + 'xml' => $xml ? 'ok' : 'ko', + 'json' => $json ? 'ok' : 'ko', + 'data' => $data ? 'ok' : 'ko', + 'cache' => $cache ? 'ok' : 'ko', + 'users' => $users ? 'ok' : 'ko', + 'favicons' => $favicons ? 'ok' : 'ko', + 'http_referer' => $http_referer ? 'ok' : 'ko', + 'message' => $message ?: 'ok', + 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml && + $data && $cache && $users && $favicons && $http_referer && $message == '' ? 'ok' : 'ko' + ); +} + +function generateSalt() { + return sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); +} + +function checkDb(&$dbOptions) { + $dsn = ''; + $driver_options = null; + try { + switch ($dbOptions['type']) { + case 'mysql': + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4' + ); + try { // on ouvre une connexion juste pour créer la base si elle n'existe pas + $dsn = 'mysql:host=' . $dbOptions['host'] . ';'; + $c = new PDO($dsn, $dbOptions['user'], $dbOptions['password'], $driver_options); + $sql = sprintf(SQL_CREATE_DB, $dbOptions['base']); + $res = $c->query($sql); + } catch (PDOException $e) { + syslog(LOG_DEBUG, 'FreshRSS MySQL warning: ' . $e->getMessage()); + } + // on écrase la précédente connexion en sélectionnant la nouvelle BDD + $dsn = 'mysql:host=' . $dbOptions['host'] . ';dbname=' . $dbOptions['base']; + break; + case 'sqlite': + include_once(APP_PATH . '/SQL/install.sql.sqlite.php'); + $path = join_path(USERS_PATH, $dbOptions['default_user']); + if (!is_dir($path)) { + mkdir($path); + } + $dsn = 'sqlite:' . join_path($path, 'db.sqlite'); + $driver_options = array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + ); + break; + case 'pgsql': + include_once(APP_PATH . '/SQL/install.sql.pgsql.php'); + $driver_options = array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + ); + try { // on ouvre une connexion juste pour créer la base si elle n'existe pas + $dsn = 'pgsql:host=' . $dbOptions['host'] . ';dbname=postgres'; + $c = new PDO($dsn, $dbOptions['user'], $dbOptions['password'], $driver_options); + $sql = sprintf(SQL_CREATE_DB, $dbOptions['base']); + $res = $c->query($sql); + } catch (PDOException $e) { + syslog(LOG_DEBUG, 'FreshRSS PostgreSQL warning: ' . $e->getMessage()); + } + // on écrase la précédente connexion en sélectionnant la nouvelle BDD + $dsn = 'pgsql:host=' . $dbOptions['host'] . ';dbname=' . $dbOptions['base']; + break; + default: + return false; + } + + $c = new PDO($dsn, $dbOptions['user'], $dbOptions['password'], $driver_options); + $res = $c->query('SELECT 1'); + } catch (PDOException $e) { + $dsn = ''; + syslog(LOG_DEBUG, 'FreshRSS SQL warning: ' . $e->getMessage()); + $dbOptions['error'] = $e->getMessage(); + } + $dbOptions['dsn'] = $dsn; + $dbOptions['options'] = $driver_options; + return $dsn != ''; +} + +function deleteInstall() { + $path = join_path(DATA_PATH, 'do-install.txt'); + @unlink($path); + return !file_exists($path); +} diff --git a/lib/lib_opml.php b/lib/lib_opml.php index 02ae5f55c..b89e92977 100644 --- a/lib/lib_opml.php +++ b/lib/lib_opml.php @@ -12,7 +12,7 @@ * * @author Marien Fressinaud <dev@marienfressinaud.fr> * @link https://github.com/marienfressinaud/lib_opml - * @version 0.2 + * @version 0.2-FreshRSS~1.5.1 * @license public domain * * Usages: @@ -105,6 +105,10 @@ function libopml_parse_outline($outline_xml, $strict = true) { ); } + if (empty($outline['text']) && isset($outline['title'])) { + $outline['text'] = $outline['title']; + } + foreach ($outline_xml->children() as $key => $value) { // An outline may contain any number of outline children if ($key === 'outline') { @@ -119,6 +123,32 @@ function libopml_parse_outline($outline_xml, $strict = true) { return $outline; } +/** + * Reformat the XML document as a hierarchy when + * the OPML 2.0 category attribute is used + */ +function preprocessing_categories($doc) { + $outline_categories = array(); + $body = $doc->getElementsByTagName('body')->item(0); + $xpath = new DOMXpath($doc); + $outlines = $xpath->query('/opml/body/outline[@category]'); + foreach ($outlines as $outline) { + $category = trim($outline->getAttribute('category')); + if ($category != '') { + $outline_categorie = null; + if (!isset($outline_categories[$category])) { + $outline_categorie = $doc->createElement('outline'); + $outline_categorie->setAttribute('text', $category); + $body->insertBefore($outline_categorie, $body->firstChild); + $outline_categories[$category] = $outline_categorie; + } else { + $outline_categorie = $outline_categories[$category]; + } + $outline->parentNode->removeChild($outline); + $outline_categorie->appendChild($outline); + } + } +} /** * Parse a string as a XML one and returns the corresponding array @@ -136,6 +166,9 @@ function libopml_parse_string($xml, $strict = true) { $dom->loadXML($xml); $dom->encoding = 'UTF-8'; + //Partial compatibility with the category attribute of OPML 2.0 + preprocessing_categories($dom); + $opml = simplexml_import_dom($dom); if (!$opml) { diff --git a/lib/lib_rss.php b/lib/lib_rss.php index e5fe73041..e9c4da049 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -1,20 +1,26 @@ <?php +if (version_compare(PHP_VERSION, '5.3.8', '<')) { + die('FreshRSS error: FreshRSS requires PHP 5.3.8+!'); +} + if (!function_exists('json_decode')) { - require_once('JSON.php'); - function json_decode($var) { - $JSON = new Services_JSON; - return (array)($JSON->decode($var)); + require_once(__DIR__ . '/JSON.php'); + function json_decode($var, $assoc = false) { + $JSON = new Services_JSON($assoc ? SERVICES_JSON_LOOSE_TYPE : 0); + return $JSON->decode($var); } } if (!function_exists('json_encode')) { - require_once('JSON.php'); + require_once(__DIR__ . '/JSON.php'); function json_encode($var) { - $JSON = new Services_JSON; + $JSON = new Services_JSON(); return $JSON->encodeUnsafe($var); } } +defined('JSON_UNESCAPED_UNICODE') or define('JSON_UNESCAPED_UNICODE', 256); //PHP 5.3 + /** * Build a directory path by concatenating a list of directory names. * @@ -38,7 +44,7 @@ function classAutoloader($class) { include(APP_PATH . '/Models/' . $components[1] . '.php'); return; case 3: //Controllers, Exceptions - @include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); + include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); return; } } elseif (strpos($class, 'Minz') === 0) { @@ -51,22 +57,71 @@ function classAutoloader($class) { spl_autoload_register('classAutoloader'); //</Auto-loading> +function idn_to_puny($url) { + if (function_exists('idn_to_ascii')) { + $parts = parse_url($url); + if (!empty($parts['host'])) { + $idn = $parts['host']; + // INTL_IDNA_VARIANT_UTS46 is defined starting in PHP 5.4 + if (defined('INTL_IDNA_VARIANT_UTS46')) { + $puny = idn_to_ascii($idn, 0, INTL_IDNA_VARIANT_UTS46); + } else { + $puny = idn_to_ascii($idn); + } + $pos = strpos($url, $idn); + if ($pos !== false) { + return substr_replace($url, $puny, $pos, strlen($idn)); + } + } + } + return $url; +} + function checkUrl($url) { - if (empty ($url)) { + if ($url == '') { return ''; } - if (!preg_match ('#^https?://#i', $url)) { + 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)))) { + $url = idn_to_puny($url); //PHP bug #53474 IDN + if (filter_var($url, FILTER_VALIDATE_URL)) { return $url; } else { return false; } } +function safe_ascii($text) { + return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); +} + +/** + * Test if a given server address is publicly accessible. + * + * Note: for the moment it tests only if address is corresponding to a + * localhost address. + * + * @param $address the address to test, can be an IP or a URL. + * @return true if server is accessible, false else. + * @todo improve test with a more valid technique (e.g. test with an external server?) + */ +function server_is_public($address) { + $host = parse_url($address, PHP_URL_HOST); + + $is_public = !in_array($host, array( + '127.0.0.1', + 'localhost', + 'localhost.localdomain', + '[::1]', + 'localhost6', + 'localhost6.localdomain6', + )); + + return $is_public; +} + + function format_number($n, $precision = 0) { // number_format does not seem to be Unicode-compatible return str_replace(' ', ' ', //Espace fine insécable @@ -81,6 +136,8 @@ function format_bytes($bytes, $precision = 2, $system = 'IEC') { } elseif ($system === 'SI') { $base = 1000; $units = array('B', 'KB', 'MB', 'GB', 'TB'); + } else { + return format_number($bytes, $precision); } $bytes = max(intval($bytes), 0); $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base)); @@ -122,10 +179,12 @@ function customSimplePie() { $system_conf = Minz_Configuration::get('system'); $limits = $system_conf->limits; $simplePie = new SimplePie(); - $simplePie->set_useragent(_t('gen.freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); + $simplePie->set_useragent(FRESHRSS_USERAGENT); + $simplePie->set_syslog($system_conf->simplepie_syslog_enabled); $simplePie->set_cache_location(CACHE_PATH); $simplePie->set_cache_duration($limits['cache_duration']); $simplePie->set_timeout($limits['timeout']); + $simplePie->set_curl_options($system_conf->curl_options); $simplePie->strip_htmltags(array( 'base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', @@ -133,14 +192,13 @@ function customSimplePie() { 'object', 'param', 'plaintext', 'script', 'style', )); $simplePie->strip_attributes(array_merge($simplePie->strip_attributes, array( - 'autoplay', 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', + 'autoplay', 'class', 'onload', 'onunload', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onfocus', 'onblur', - 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange', 'seamless'))); + 'onkeypress', 'onkeydown', 'onkeyup', 'onselect', 'onchange', 'seamless', 'sizes', 'srcset'))); $simplePie->add_attributes(array( - 'img' => array('lazyload' => '', 'postpone' => ''), //http://www.w3.org/TR/resource-priorities/ - 'audio' => array('lazyload' => '', 'postpone' => '', 'preload' => 'none'), - 'iframe' => array('lazyload' => '', 'postpone' => '', 'sandbox' => 'allow-scripts allow-same-origin'), - 'video' => array('lazyload' => '', 'postpone' => '', 'preload' => 'none'), + 'audio' => array('controls' => 'controls', 'preload' => 'none'), + 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), + 'video' => array('controls' => 'controls', 'preload' => 'none'), )); $simplePie->set_url_replacements(array( 'a' => 'href', @@ -164,6 +222,16 @@ function customSimplePie() { 'src', ), )); + $https_domains = array(); + $force = @file(FRESHRSS_PATH . '/force-https.default.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (is_array($force)) { + $https_domains = array_merge($https_domains, $force); + } + $force = @file(DATA_PATH . '/force-https.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (is_array($force)) { + $https_domains = array_merge($https_domains, $force); + } + $simplePie->set_https_domains($https_domains); return $simplePie; } @@ -178,17 +246,27 @@ function sanitizeHTML($data, $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'); + require_once(LIB_PATH . '/lib_phpQuery.php'); - Minz_Log::notice('FreshRSS GET ' . url_remove_credentials($url)); - $html = file_get_contents ($url); + Minz_Log::notice('FreshRSS GET ' . SimplePie_Misc::url_remove_credentials($url)); + $html = file_get_contents($url); if ($html) { - $doc = phpQuery::newDocument ($html); - $content = $doc->find ($path); + $doc = phpQuery::newDocument($html); + $content = $doc->find($path); + + foreach (pq('img[data-src]') as $img) { + $imgP = pq($img); + $dataSrc = $imgP->attr('data-src'); + if (strlen($dataSrc) > 4) { + $imgP->attr('src', $dataSrc); + $imgP->removeAttr('data-src'); + } + } + return sanitizeHTML($content->__toString(), $url); } else { - throw new Exception (); + throw new Exception(); } } @@ -215,9 +293,12 @@ function uSecString() { return str_pad($t['usec'], 6, '0'); } -function invalidateHttpCache() { - Minz_Session::_param('touch', uTimeString()); - return touch(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt')); +function invalidateHttpCache($username = '') { + if (!FreshRSS_user_Controller::checkUsername($username)) { + Minz_Session::_param('touch', uTimeString()); + $username = Minz_Session::param('currentUser', '_'); + } + return touch(join_path(DATA_PATH, 'users', $username, 'log.txt')); } function listUsers() { @@ -227,18 +308,32 @@ function listUsers() { scandir($base_path), array('..', '.', '_') )); - foreach ($dir_list as $file) { - if (is_dir(join_path($base_path, $file))) { + if ($file[0] !== '.' && is_dir(join_path($base_path, $file)) && file_exists(join_path($base_path, $file, 'config.php'))) { $final_list[] = $file; } } - return $final_list; } /** + * Return if the maximum number of registrations has been reached. + * + * Note a max_regstrations of 0 means there is no limit. + * + * @return true if number of users >= max registrations, false else. + */ +function max_registrations_reached() { + $system_conf = Minz_Configuration::get('system'); + $limit_registrations = $system_conf->limits['max_registrations']; + $number_accounts = count(listUsers()); + + return $limit_registrations > 0 && $number_accounts >= $limit_registrations; +} + + +/** * Register and return the configuration for a given user. * * Note this function has been created to generate temporary configuration @@ -248,13 +343,17 @@ function listUsers() { * @return a Minz_Configuration object, null if the configuration cannot be loaded. */ function get_user_configuration($username) { + if (!FreshRSS_user_Controller::checkUsername($username)) { + return null; + } $namespace = 'user_' . $username; try { Minz_Configuration::register($namespace, join_path(USERS_PATH, $username, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php')); + join_path(FRESHRSS_PATH, 'config-user.default.php')); } catch (Minz_ConfigurationNamespaceException $e) { // namespace already exists, do nothing. + Minz_Log::warning($e->getMessage()); } catch (Minz_FileNotExistException $e) { Minz_Log::warning($e->getMessage()); return null; @@ -269,19 +368,18 @@ function httpAuthUser() { } function cryptAvailable() { - if (version_compare(PHP_VERSION, '5.3.3', '>=')) { - try { - $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; - return $hash === @crypt('password', $hash); - } catch (Exception $e) { - } + try { + $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; + return $hash === @crypt('password', $hash); + } catch (Exception $e) { + Minz_Log::warning($e->getMessage()); } return false; } function is_referer_from_same_domain() { if (empty($_SERVER['HTTP_REFERER'])) { - return false; + return true; //Accept empty referer while waiting for good support of meta referrer same-origin policy in browsers } $host = parse_url(((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https://' : 'http://') . (empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'])); @@ -304,14 +402,16 @@ function is_referer_from_same_domain() { */ function check_install_php() { $pdo_mysql = extension_loaded('pdo_mysql'); + $pdo_pgsql = extension_loaded('pdo_pgsql'); $pdo_sqlite = extension_loaded('pdo_sqlite'); return array( - 'php' => version_compare(PHP_VERSION, '5.2.1') >= 0, + 'php' => version_compare(PHP_VERSION, '5.3.8') >= 0, 'minz' => file_exists(LIB_PATH . '/Minz'), 'curl' => extension_loaded('curl'), - 'pdo' => $pdo_mysql || $pdo_sqlite, + 'pdo' => $pdo_mysql || $pdo_sqlite || $pdo_pgsql, 'pcre' => extension_loaded('pcre'), 'ctype' => extension_loaded('ctype'), + 'fileinfo' => extension_loaded('fileinfo'), 'dom' => class_exists('DOMDocument'), 'json' => extension_loaded('json'), 'zip' => extension_loaded('zip'), @@ -330,7 +430,6 @@ function check_install_files() { 'cache' => CACHE_PATH && is_writable(CACHE_PATH), 'users' => USERS_PATH && is_writable(USERS_PATH), 'favicons' => is_writable(DATA_PATH . '/favicons'), - 'persona' => is_writable(DATA_PATH . '/persona'), 'tokens' => is_writable(DATA_PATH . '/tokens'), ); } @@ -430,12 +529,15 @@ function array_remove(&$array, $value) { $array = array_diff($array, array($value)); } +//RFC 4648 +function base64url_encode($data) { + return strtr(rtrim(base64_encode($data), '='), '+/', '-_'); +} +//RFC 4648 +function base64url_decode($data) { + return base64_decode(strtr($data, '-_', '+/')); +} -/** - * Sanitize a URL by removing HTTP credentials. - * @param $url the URL to sanitize. - * @return the same URL without HTTP credentials. - */ -function url_remove_credentials($url) { - return preg_replace('/[^\/]*:[^:]*@/', '', $url); +function _i($icon, $url_only = false) { + return FreshRSS_Themes::icon($icon, $url_only); } diff --git a/p/.htaccess b/p/.htaccess index 2b1e27a88..74ba7ed11 100644 --- a/p/.htaccess +++ b/p/.htaccess @@ -8,11 +8,11 @@ AddDefaultCharset UTF-8 <IfModule mod_mime.c> AddType application/json .map AddType application/font-woff .woff + AddType application/font-woff2 .woff2 AddCharset UTF-8 .css AddCharset UTF-8 .html AddCharset UTF-8 .js - AddCharset UTF-8 .svg </IfModule> <IfModule mod_deflate.c> @@ -22,14 +22,10 @@ AddDefaultCharset UTF-8 <IfModule mod_expires.c> ExpiresActive on ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/font-woff2 "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 month" - ExpiresByType text/css "access plus 1 month" ExpiresByType text/html "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" <FilesMatch "\.php$"> @@ -38,7 +34,7 @@ AddDefaultCharset UTF-8 </IfModule> <IfModule mod_headers.c> - <FilesMatch "\.(css|html|js|ico|gif|png|woff)$"> + <FilesMatch "\.(css|gif|html|ico|js|png|svg|woff|woff2)$"> Header merge Cache-Control "public" </FilesMatch> </IfModule> diff --git a/p/api/greader.php b/p/api/greader.php index ab1a02244..99304f4ec 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -2,10 +2,10 @@ /** == Description == Server-side API compatible with Google Reader API layer 2 - for the FreshRSS project http://freshrss.org + for the FreshRSS project https://freshrss.org == Credits == -* 2014-03: Released by Alexandre Alapetite http://alexandre.alapetite.fr +* 2014-03: Released by Alexandre Alapetite https://alexandre.alapetite.fr under GNU AGPL 3 license http://www.gnu.org/licenses/agpl-3.0.html == Documentation == @@ -20,10 +20,10 @@ Server-side API compatible with Google Reader API layer 2 * https://github.com/theoldreader/api */ -require('../../constants.php'); +require(__DIR__ . '/../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader -$ORIGINAL_INPUT = file_get_contents('php://input'); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); if (PHP_INT_SIZE < 8) { //32-bit function dec2hex($dec) { @@ -46,6 +46,8 @@ function headerVariable($headerName, $varName) { $upName = 'HTTP_' . strtoupper($headerName); if (isset($_SERVER[$upName])) { $header = $_SERVER[$upName]; + } elseif (isset($_SERVER['REDIRECT_' . $upName])) { + $header = $_SERVER['REDIRECT_' . $upName]; } elseif (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); if (isset($ALL_HEADERS[$headerName])) { @@ -76,15 +78,11 @@ class MyPDO extends Minz_ModelPdo { } } -function logMe($text) { - file_put_contents(join_path(USERS_PATH, '_', 'log_api.txt'), $text, FILE_APPEND); -} - function debugInfo() { if (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); } else { //nginx http://php.net/getallheaders#84262 - $ALL_HEADERS = ''; + $ALL_HEADERS = array(); foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) === 'HTTP_') { $ALL_HEADERS[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; @@ -92,20 +90,27 @@ function debugInfo() { } } global $ORIGINAL_INPUT; - return print_r(array('date' => date('c'), 'headers' => $ALL_HEADERS, '_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, 'INPUT' => $ORIGINAL_INPUT), true); + return print_r( + array( + 'date' => date('c'), + 'headers' => $ALL_HEADERS, + '_SERVER' => $_SERVER, + '_GET' => $_GET, + '_POST' => $_POST, + '_COOKIE' => $_COOKIE, + 'INPUT' => $ORIGINAL_INPUT + ), true); } function badRequest() { - logMe("badRequest()\n"); - logMe(debugInfo()); + Minz_Log::warning('badRequest() ' . debugInfo(), API_LOG); header('HTTP/1.1 400 Bad Request'); header('Content-Type: text/plain; charset=UTF-8'); die('Bad Request!'); } function unauthorized() { - logMe("unauthorized()\n"); - logMe(debugInfo()); + Minz_Log::warning('unauthorized() ' . debugInfo(), API_LOG); header('HTTP/1.1 401 Unauthorized'); header('Content-Type: text/plain; charset=UTF-8'); header('Google-Bad-Token: true'); @@ -113,27 +118,27 @@ function unauthorized() { } function notImplemented() { - logMe("notImplemented()\n"); - logMe(debugInfo()); + Minz_Log::warning('notImplemented() ' . debugInfo(), API_LOG); header('HTTP/1.1 501 Not Implemented'); header('Content-Type: text/plain; charset=UTF-8'); die('Not Implemented!'); } function serviceUnavailable() { - logMe("serviceUnavailable()\n"); + Minz_Log::warning('serviceUnavailable() ' . debugInfo(), API_LOG); header('HTTP/1.1 503 Service Unavailable'); header('Content-Type: text/plain; charset=UTF-8'); die('Service Unavailable!'); } function checkCompatibility() { - logMe("checkCompatibility()\n"); + Minz_Log::warning('checkCompatibility() ' . debugInfo(), API_LOG); header('Content-Type: text/plain; charset=UTF-8'); if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) { die('FAIL 64-bit or GMP extension!'); } if ((!array_key_exists('HTTP_AUTHORIZATION', $_SERVER)) && //Apache mod_rewrite trick should be fine + (!array_key_exists('REDIRECT_HTTP_AUTHORIZATION', $_SERVER)) && //Apache mod_rewrite with FCGI (empty($_SERVER['SERVER_SOFTWARE']) || (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') === false)) && //nginx should be fine (empty($_SERVER['SERVER_SOFTWARE']) || (stripos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') === false)) && //lighttpd should be fine ((!function_exists('getallheaders')) || (stripos(php_sapi_name(), 'cgi') !== false))) { //Main problem is Apache/CGI mode @@ -149,17 +154,16 @@ function authorizationToUser() { $headerAuthX = explode('/', $headerAuth, 2); if (count($headerAuthX) === 2) { $user = $headerAuthX[0]; - if (ctype_alnum($user)) { - $conf = get_user_configuration($user); - if (is_null($conf)) { + if (FreshRSS_user_Controller::checkUsername($user)) { + FreshRSS_Context::$user_conf = get_user_configuration($user); + if (FreshRSS_Context::$user_conf == null) { Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.'); unauthorized(); } - $system_conf = Minz_Configuration::get('system'); - if ($headerAuthX[1] === sha1($system_conf->salt . $user . $conf->apiPasswordHash)) { + if ($headerAuthX[1] === sha1(FreshRSS_Context::$system_conf->salt . $user . FreshRSS_Context::$user_conf->apiPasswordHash)) { return $user; } else { - logMe('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1] . "\n"); + Minz_Log::warning('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1], API_LOG); Minz_Log::warning('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1]); unauthorized(); } @@ -172,22 +176,20 @@ function authorizationToUser() { } function clientLogin($email, $pass) { //http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html - logMe('clientLogin(' . $email . ")\n"); if (ctype_alnum($email)) { if (!function_exists('password_verify')) { include_once(LIB_PATH . '/password_compat.php'); } - $conf = get_user_configuration($email); - if (is_null($conf)) { + FreshRSS_Context::$user_conf = get_user_configuration($email); + if (FreshRSS_Context::$user_conf == null) { Minz_Log::warning('Invalid API user ' . $email . ': configuration cannot be found.'); unauthorized(); } - if ($conf->apiPasswordHash != '' && password_verify($pass, $conf->apiPasswordHash)) { + if (FreshRSS_Context::$user_conf->apiPasswordHash != '' && password_verify($pass, FreshRSS_Context::$user_conf->apiPasswordHash)) { header('Content-Type: text/plain; charset=UTF-8'); - $system_conf = Minz_Configuration::get('system'); - $auth = $email . '/' . sha1($system_conf->salt . $email . $conf->apiPasswordHash); + $auth = $email . '/' . sha1(FreshRSS_Context::$system_conf->salt . $email . FreshRSS_Context::$user_conf->apiPasswordHash); echo 'SID=', $auth, "\n", 'Auth=', $auth, "\n"; exit(); @@ -205,9 +207,8 @@ function token($conf) { //http://blog.martindoms.com/2009/08/15/using-the-google-reader-api-part-1/ //https://github.com/ericmann/gReader-Library/blob/master/greader.class.php $user = Minz_Session::param('currentUser', '_'); - logMe('token('. $user . ")\n"); //TODO: Implement real token that expires - $system_conf = Minz_Configuration::get('system'); - $token = str_pad(sha1($system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z'); //Must have 57 characters + //Minz_Log::debug('token('. $user . ')', API_LOG); //TODO: Implement real token that expires + $token = str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z'); //Must have 57 characters echo $token, "\n"; exit(); } @@ -215,16 +216,23 @@ function token($conf) { function checkToken($conf, $token) { //http://code.google.com/p/google-reader-api/wiki/ActionToken $user = Minz_Session::param('currentUser', '_'); - logMe('checkToken(' . $token . ")\n"); - $system_conf = Minz_Configuration::get('system'); - if ($token === str_pad(sha1($system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z')) { + if ($token === str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z')) { return true; } unauthorized(); } +function userInfo() { //https://github.com/theoldreader/api#user-info + $user = Minz_Session::param('currentUser', '_'); + exit(json_encode(array( + 'userId' => $user, + 'userName' => $user, + 'userProfileId' => $user, + 'userEmail' => FreshRSS_Context::$user_conf->mail_login, + ))); +} + function tagList() { - logMe("tagList()\n"); header('Content-Type: application/json; charset=UTF-8'); $pdo = new MyPDO(); @@ -249,7 +257,6 @@ function tagList() { } function subscriptionList() { - logMe("subscriptionList()\n"); header('Content-Type: application/json; charset=UTF-8'); $pdo = new MyPDO(); @@ -258,6 +265,7 @@ function subscriptionList() { $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $salt = FreshRSS_Context::$system_conf->salt; $subscriptions = array(); foreach ($res as $line) { @@ -274,7 +282,7 @@ function subscriptionList() { //'firstitemmsec' => 0, 'url' => $line['url'], 'htmlUrl' => $line['website'], - //'iconUrl' => '', + 'iconUrl' => Minz_Url::display('/f.php?' . hash('crc32b', $salt . $line['url']), '', true), ); } @@ -282,8 +290,108 @@ function subscriptionList() { exit(); } +function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '') { + //https://github.com/mihaip/google-reader-api/blob/master/wiki/ApiSubscriptionEdit.wiki + switch ($action) { + case 'subscribe': + case 'unsubscribe': + case 'edit': + break; + default: + badRequest(); + } + $addCatId = 0; + $categoryDAO = null; + if ($add != '' || $remove != '') { + $categoryDAO = new FreshRSS_CategoryDAO(); + } + $c_name = ''; + if ($add != '' && strpos($add, 'user/') === 0) { //user/-/label/Example ; user/username/label/Example + if (strpos($add, 'user/-/label/') === 0) { + $c_name = substr($add, 13); + } else { + $user = Minz_Session::param('currentUser', '_'); + $prefix = 'user/' . $user . '/label/'; + if (strpos($add, $prefix) === 0) { + $c_name = substr($add, strlen($prefix)); + } else { + $c_name = ''; + } + } + $cat = $categoryDAO->searchByName($c_name); + $addCatId = $cat == null ? 0 : $cat->id(); + } else if ($remove != '' && strpos($remove, 'user/-/label/')) { + $addCatId = 1; //Default category + } + $feedDAO = FreshRSS_Factory::createFeedDao(); + for ($i = count($streamNames) - 1; $i >= 0; $i--) { + $streamName = $streamNames[$i]; //feed/http://example.net/sample.xml ; feed/338 + if (strpos($streamName, 'feed/') === 0) { + $streamName = substr($streamName, 5); + $feedId = 0; + if (ctype_digit($streamName)) { + if ($action === 'subscribe') { + continue; + } + $feedId = $streamName; + } else { + $feed = $feedDAO->searchByUrl($streamName); + $feedId = $feed == null ? -1 : $feed->id(); + } + $title = isset($titles[$i]) ? $titles[$i] : ''; + switch ($action) { + case 'subscribe': + if ($feedId <= 0) { + $http_auth = ''; //TODO + try { + $feed = FreshRSS_feed_Controller::addFeed($streamName, $title, $addCatId, $c_name, $http_auth); + continue; + } catch (Exception $e) { + Minz_Log::error('subscriptionEdit error subscribe: ' . $e->getMessage(), API_LOG); + } + } + badRequest(); + break; + case 'unsubscribe': + if (!($feedId > 0 && FreshRSS_feed_Controller::deleteFeed($feedId))) { + badRequest(); + } + break; + case 'edit': + if ($feedId > 0) { + if ($addCatId > 0 || $c_name != '') { + FreshRSS_feed_Controller::moveFeed($feedId, $addCatId, $c_name); + } + if ($title != '') { + FreshRSS_feed_Controller::renameFeed($feedId, $title); + } + } else { + badRequest(); + } + break; + } + } + } + exit('OK'); +} + +function quickadd($url) { + try { + $feed = FreshRSS_feed_Controller::addFeed($url); + exit(json_encode(array( + 'numResults' => 1, + 'streamId' => $feed->id(), + ))); + } catch (Exception $e) { + Minz_Log::error('quickadd error: ' . $e->getMessage(), API_LOG); + die(json_encode(array( + 'numResults' => 0, + 'error' => $e->getMessage(), + ))); + } +} + function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count - logMe("unreadCount()\n"); header('Content-Type: application/json; charset=UTF-8'); $totalUnreads = 0; @@ -330,7 +438,6 @@ function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-googl function streamContents($path, $include_target, $start_time, $count, $order, $exclude_target, $continuation) { //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - logMe("streamContents($path, $include_target, $start_time, $count, $order, $exclude_target, $continuation)\n"); header('Content-Type: application/json; charset=UTF-8'); $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -361,6 +468,9 @@ function streamContents($path, $include_target, $start_time, $count, $order, $ex case 'user/-/state/com.google/read': $state = FreshRSS_Entry::STATE_NOT_READ; break; + case 'user/-/state/com.google/unread': + $state = FreshRSS_Entry::STATE_READ; + break; default: $state = FreshRSS_Entry::STATE_ALL; break; @@ -371,7 +481,7 @@ function streamContents($path, $include_target, $start_time, $count, $order, $ex } $entryDAO = FreshRSS_Factory::createEntryDao(); - $entries = $entryDAO->listWhere($type, $include_target, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, '', $start_time); + $entries = $entryDAO->listWhere($type, $include_target, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, new FreshRSS_Search(''), $start_time); $items = array(); foreach ($entries as $entry) { @@ -386,12 +496,12 @@ function streamContents($path, $include_target, $start_time, $count, $order, $ex $item = array( 'id' => /*'tag:google.com,2005:reader/item/' .*/ dec2hex($entry->id()), //64-bit hexa http://code.google.com/p/google-reader-api/wiki/ItemId 'crawlTimeMsec' => substr($entry->id(), 0, -3), - 'timestampUsec' => $entry->id(), //EasyRSS + 'timestampUsec' => '' . $entry->id(), //EasyRSS 'published' => $entry->date(true), 'title' => $entry->title(), 'summary' => array('content' => $entry->content()), 'alternate' => array( - array('href' => $entry->link()), + array('href' => htmlspecialchars_decode($entry->link(), ENT_QUOTES)), ), 'categories' => array( 'user/-/state/com.google/reading-list', @@ -436,8 +546,6 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude //http://code.google.com/p/google-reader-api/wiki/ApiStreamItemsIds //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - logMe("streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target)\n"); - $type = 'A'; $id = ''; if ($streamId === 'user/-/state/com.google/reading-list') { @@ -449,7 +557,7 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude $id = basename($streamId); } elseif (strpos($streamId, 'user/-/label/') === 0) { $type = 'c'; - $c_name = basename($streamId); + $c_name = substr($streamId, 13); $categoryDAO = new FreshRSS_CategoryDAO(); $cat = $categoryDAO->searchByName($c_name); $id = $cat == null ? -1 : $cat->id(); @@ -465,8 +573,11 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude } $entryDAO = FreshRSS_Factory::createEntryDao(); - $ids = $entryDAO->listIdsWhere($type, $id, $state, $order === 'o' ? 'ASC' : 'DESC', $count, '', '', $start_time); + $ids = $entryDAO->listIdsWhere($type, $id, $state, $order === 'o' ? 'ASC' : 'DESC', $count, '', new FreshRSS_Search(''), $start_time); + if (empty($ids)) { //For News+ bug https://github.com/noinnion/newsplus/issues/84#issuecomment-57834632 + $ids[] = 0; + } $itemRefs = array(); foreach ($ids as $id) { $itemRefs[] = array( @@ -481,8 +592,6 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude } function editTag($e_ids, $a, $r) { - logMe("editTag()\n"); - foreach ($e_ids as $i => $e_id) { $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' } @@ -512,18 +621,48 @@ function editTag($e_ids, $a, $r) { break; } - echo 'OK'; - exit(); + exit('OK'); +} + +function renameTag($s, $dest) { + if ($s != '' && strpos($s, 'user/-/label/') === 0 && + $dest != '' && strpos($dest, 'user/-/label/') === 0) { + $s = substr($s, 13); + $categoryDAO = new FreshRSS_CategoryDAO(); + $cat = $categoryDAO->searchByName($s); + if ($cat != null) { + $dest = substr($dest, 13); + $categoryDAO->updateCategory($cat->id(), array('name' => $dest)); + exit('OK'); + } + } + badRequest(); +} + +function disableTag($s) { + if ($s != '' && strpos($s, 'user/-/label/') === 0) { + $s = substr($s, 13); + $categoryDAO = new FreshRSS_CategoryDAO(); + $cat = $categoryDAO->searchByName($s); + if ($cat != null) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feedDAO->changeCategory($cat->id(), 0); + if ($cat->id() > 1) { + $categoryDAO->deleteCategory($cat->id()); + } + exit('OK'); + } + } + badRequest(); } function markAllAsRead($streamId, $olderThanId) { - logMe("markAllAsRead($streamId, $olderThanId)\n"); $entryDAO = FreshRSS_Factory::createEntryDao(); if (strpos($streamId, 'feed/') === 0) { $f_id = basename($streamId); $entryDAO->markReadFeed($f_id, $olderThanId); } elseif (strpos($streamId, 'user/-/label/') === 0) { - $c_name = basename($streamId); + $c_name = substr($streamId, 13); $categoryDAO = new FreshRSS_CategoryDAO(); $cat = $categoryDAO->searchByName($c_name); $entryDAO->markReadCat($cat === null ? -1 : $cat->id(), $olderThanId); @@ -531,56 +670,63 @@ function markAllAsRead($streamId, $olderThanId) { $entryDAO->markReadEntries($olderThanId, false, -1); } - echo 'OK'; - exit(); + exit('OK'); } -logMe('----------------------------------------------------------------'."\n"); -//logMe(debugInfo()); +//Minz_Log::debug('----------------------------------------------------------------', API_LOG); +//Minz_Log::debug(debugInfo(), API_LOG); $pathInfo = empty($_SERVER['PATH_INFO']) ? '/Error' : urldecode($_SERVER['PATH_INFO']); $pathInfos = explode('/', $pathInfo); Minz_Configuration::register('system', - DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); -$system_conf = Minz_Configuration::get('system'); -if (!$system_conf->api_enabled) { + DATA_PATH . '/config.php', + FRESHRSS_PATH . '/config.default.php'); +FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); +if (!FreshRSS_Context::$system_conf->api_enabled) { serviceUnavailable(); } Minz_Session::init('FreshRSS'); $user = authorizationToUser(); -$conf = null; +FreshRSS_Context::$user_conf = null; if ($user !== '') { - $conf = get_user_configuration($user); + FreshRSS_Context::$user_conf = get_user_configuration($user); } -logMe('User => ' . $user . "\n"); - Minz_Session::_param('currentUser', $user); if (count($pathInfos) < 3) { badRequest(); -} -elseif ($pathInfos[1] === 'accounts') { +} elseif ($pathInfos[1] === 'accounts') { if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) { clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']); } -} -elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { +} elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { if ($user == '') { unauthorized(); } $timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching. switch ($pathInfos[4]) { case 'stream': - $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; //xt=[exclude target] : Used to exclude certain items from the feed. For example, using xt=user/-/state/com.google/read will exclude items that the current user has marked as read, or xt=feed/[feedurl] will exclude items from a particular feed (obviously not useful in this request, but xt appears in other listing requests). + /* xt=[exclude target] : Used to exclude certain items from the feed. + * For example, using xt=user/-/state/com.google/read will exclude items + * that the current user has marked as read, or xt=feed/[feedurl] will + * exclude items from a particular feed (obviously not useful in this + * request, but xt appears in other listing requests). */ + $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; $count = isset($_GET['n']) ? intval($_GET['n']) : 20; //n=[integer] : The maximum number of results to return. $order = isset($_GET['r']) ? $_GET['r'] : 'd'; //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order. - $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; //ot=[unix timestamp] : The time from which you want to retrieve items. Only items that have been crawled by Google Reader after this time will be returned. - $continuation = isset($_GET['c']) ? $_GET['c'] : ''; //Continuation token. If a StreamContents response does not represent all items in a timestamp range, it will have a continuation attribute. The same request can be re-issued with the value of that attribute put in this parameter to get more items + /* ot=[unix timestamp] : The time from which you want to retrieve + * items. Only items that have been crawled by Google Reader after + * this time will be returned. */ + $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; + /* Continuation token. If a StreamContents response does not represent + * all items in a timestamp range, it will have a continuation attribute. + * The same request can be re-issued with the value of that attribute put + * in this parameter to get more items */ + $continuation = isset($_GET['c']) ? $_GET['c'] : ''; if (isset($pathInfos[5]) && $pathInfos[5] === 'contents' && isset($pathInfos[6])) { if (isset($pathInfos[7])) { if ($pathInfos[6] === 'feed') { @@ -605,7 +751,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo } } elseif ($pathInfos[5] === 'items') { if ($pathInfos[6] === 'ids' && isset($_GET['s'])) { - $streamId = $_GET['s']; //StreamId for which to fetch the item IDs. The parameter may be repeated to fetch the item IDs from multiple streams at once (more efficient from a backend perspective than multiple requests). + /* StreamId for which to fetch the item IDs. The parameter may + * be repeated to fetch the item IDs from multiple streams at once + * (more efficient from a backend perspective than multiple requests). */ + $streamId = $_GET['s']; streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target); } } @@ -614,14 +763,37 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo if (isset($pathInfos[5]) && $pathInfos[5] === 'list') { $output = isset($_GET['output']) ? $_GET['output'] : ''; if ($output !== 'json') notImplemented(); - tagList($_GET['output']); + tagList($output); } break; case 'subscription': - if (isset($pathInfos[5]) && $pathInfos[5] === 'list') { - $output = isset($_GET['output']) ? $_GET['output'] : ''; - if ($output !== 'json') notImplemented(); - subscriptionList($_GET['output']); + if (isset($pathInfos[5])) { + switch ($pathInfos[5]) { + case 'list': + $output = isset($_GET['output']) ? $_GET['output'] : ''; + if ($output !== 'json') notImplemented(); + subscriptionList($_GET['output']); + break; + case 'edit': + if (isset($_POST['s']) && isset($_POST['ac'])) { + //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once + $streamNames = multiplePosts('s'); + /* Title to use for the subscription. For the `subscribe` action, + * if not specified then the feed's current title will be used. Can + * be used with the `edit` action to rename a subscription */ + $titles = multiplePosts('t'); + $action = $_POST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit` + $add = isset($_POST['a']) ? $_POST['a'] : ''; //StreamId to add the subscription to (generally a user label) + $remove = isset($_POST['r']) ? $_POST['r'] : ''; //StreamId to remove the subscription from (generally a user label) + subscriptionEdit($streamNames, $titles, $action, $add, $remove); + } + break; + case 'quickadd': //https://github.com/theoldreader/api + if (isset($_GET['quickadd'])) { + quickadd($_GET['quickadd']); + } + break; + } } break; case 'unread-count': @@ -632,15 +804,30 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo break; case 'edit-tag': //http://blog.martindoms.com/2010/01/20/using-the-google-reader-api-part-3/ $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken($conf, $token); + checkToken(FreshRSS_Context::$user_conf, $token); $a = isset($_POST['a']) ? $_POST['a'] : ''; //Add: user/-/state/com.google/read user/-/state/com.google/starred $r = isset($_POST['r']) ? $_POST['r'] : ''; //Remove: user/-/state/com.google/read user/-/state/com.google/starred $e_ids = multiplePosts('i'); //item IDs editTag($e_ids, $a, $r); break; + case 'rename-tag': //https://github.com/theoldreader/api + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + checkToken(FreshRSS_Context::$user_conf, $token); + $s = isset($_POST['s']) ? $_POST['s'] : ''; //user/-/label/Folder + $dest = isset($_POST['dest']) ? $_POST['dest'] : ''; //user/-/label/NewFolder + renameTag($s, $dest); + break; + case 'disable-tag': //https://github.com/theoldreader/api + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + checkToken(FreshRSS_Context::$user_conf, $token); + $s_s = multiplePosts('s'); + foreach ($s_s as $s) { + disableTag($s); //user/-/label/Folder + } + break; case 'mark-all-as-read': $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken($conf, $token); + checkToken(FreshRSS_Context::$user_conf, $token); $streamId = $_POST['s']; //StreamId $ts = isset($_POST['ts']) ? $_POST['ts'] : '0'; //Older than timestamp in nanoseconds if (!ctype_digit($ts)) { @@ -649,7 +836,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo markAllAsRead($streamId, $ts); break; case 'token': - token($conf); + token(FreshRSS_Context::$user_conf); + break; + case 'user-info': + userInfo(); break; } } elseif ($pathInfos[1] === 'check' && $pathInfos[2] === 'compatibility') { diff --git a/p/api/index.html b/p/api/index.php index 8da0bcb58..429b25225 100644 --- a/p/api/index.html +++ b/p/api/index.php @@ -11,9 +11,19 @@ <h1>FreshRSS API</h1> <h2>Google Reader compatible API</h2> +<dl> +<dt>Your API address:</dt> +<dd><?php +require(__DIR__ . '/../../constants.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader +Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); +echo Minz_Url::display('/api/greader.php', 'html', true); +?></dd> +</dl> <ul> -<li><a href="greader.php/check%2Fcompatibility" rel="nofollow">Check full server configuration (with <code>%2F</code> support)</a></li> -<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server configuration (without <code>%2F</code> support)</a></li> +<li><a href="greader.php/check%2Fcompatibility" rel="nofollow">Check full server configuration</a></li> +<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server +configuration (without <code>%2F</code> support)</a></li> </ul> </body> diff --git a/p/api/pshb.php b/p/api/pshb.php new file mode 100644 index 000000000..57a7bb0dd --- /dev/null +++ b/p/api/pshb.php @@ -0,0 +1,160 @@ +<?php +require(__DIR__ . '/../../constants.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader + +const MAX_PAYLOAD = 3145728; + +header('Content-Type: text/plain; charset=UTF-8'); +header('X-Content-Type-Options: nosniff'); + +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, MAX_PAYLOAD); + +Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); +$system_conf = Minz_Configuration::get('system'); +$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) + +//Minz_Log::debug(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true), PSHB_LOG); + +$key = isset($_GET['k']) ? substr($_GET['k'], 0, 128) : ''; +if (!ctype_xdigit($key)) { + header('HTTP/1.1 422 Unprocessable Entity'); + die('Invalid feed key format!'); +} +chdir(PSHB_PATH); +$canonical64 = @file_get_contents('keys/' . $key . '.txt'); +if ($canonical64 === false) { + if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') { + Minz_Log::warning('Warning: Accept unknown unsubscribe', PSHB_LOG); + header('Connection: close'); + exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); + } + header('HTTP/1.1 404 Not Found'); + Minz_Log::warning('Warning: Feed key not found!: ' . $key, PSHB_LOG); + die('Feed key not found!'); +} +$canonical64 = trim($canonical64); +if (!preg_match('/^[A-Za-z0-9_-]+$/D', $canonical64)) { + header('HTTP/1.1 500 Internal Server Error'); + Minz_Log::error('Error: Invalid key reference!: ' . $canonical64, PSHB_LOG); + die('Invalid key reference!'); +} +$hubFile = @file_get_contents('feeds/' . $canonical64 . '/!hub.json'); +if ($hubFile === false) { + header('HTTP/1.1 404 Not Found'); + unlink('keys/' . $key . '.txt'); + Minz_Log::error('Error: Feed info not found!: ' . $canonical64, PSHB_LOG); + die('Feed info not found!'); +} +$hubJson = json_decode($hubFile, true); +if (!$hubJson || empty($hubJson['key']) || $hubJson['key'] !== $key) { + header('HTTP/1.1 500 Internal Server Error'); + Minz_Log::error('Error: Invalid key cross-check!: ' . $key, PSHB_LOG); + die('Invalid key cross-check!'); +} +chdir('feeds/' . $canonical64); +$users = glob('*.txt', GLOB_NOSORT); +if (empty($users)) { + header('HTTP/1.1 410 Gone'); + $url = base64url_decode($canonical64); + Minz_Log::warning('Warning: Nobody subscribes to this feed anymore!: ' . $url, PSHB_LOG); + unlink('../../keys/' . $key . '.txt'); + Minz_Configuration::register('system', + DATA_PATH . '/config.php', + FRESHRSS_PATH . '/config.default.php'); + FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); + $feed = new FreshRSS_Feed($url); + $feed->pubSubHubbubSubscribe(false); + unlink('!hub.json'); + chdir('..'); + recursive_unlink($canonical64); + die('Nobody subscribes to this feed anymore!'); +} + +if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { + $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : intval($_REQUEST['hub_lease_seconds']); + if ($leaseSeconds > 60) { + $hubJson['lease_end'] = time() + $leaseSeconds; + } else { + unset($hubJson['lease_end']); + } + $hubJson['lease_start'] = time(); + if (!isset($hubJson['error'])) { + $hubJson['error'] = true; //Do not assume that PubSubHubbub works until the first successul push + } + file_put_contents('./!hub.json', json_encode($hubJson)); + header('Connection: close'); + exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); +} + +if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') { + if (empty($hubJson['lease_end']) || $hubJson['lease_end'] < time()) { + header('Connection: close'); + exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); + } else { + header('HTTP/1.1 422 Unprocessable Entity'); + die('We did not ask to unsubscribe!'); + } +} + +if ($ORIGINAL_INPUT == '') { + header('HTTP/1.1 422 Unprocessable Entity'); + die('Missing XML payload!'); +} + +$simplePie = customSimplePie(); +$simplePie->set_raw_data($ORIGINAL_INPUT); +$simplePie->init(); +unset($ORIGINAL_INPUT); + +$links = $simplePie->get_links('self'); +$self = isset($links[0]) ? $links[0] : null; + +if ($self !== base64url_decode($canonical64)) { + //header('HTTP/1.1 422 Unprocessable Entity'); + Minz_Log::warning('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64), PSHB_LOG); + //die('Self URL does not match registered canonical URL!'); + $self = base64url_decode($canonical64); +} + +$nb = 0; +foreach ($users as $userFilename) { + $username = basename($userFilename, '.txt'); + if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) { + Minz_Log::warning('Warning: Removing broken user link: ' . $username . ' for ' . $self, PSHB_LOG); + unlink($userFilename); + continue; + } + + try { + Minz_Session::_param('currentUser', $username); + Minz_Configuration::register('user', + join_path(USERS_PATH, $username, 'config.php'), + join_path(FRESHRSS_PATH, 'config-user.default.php')); + new Minz_ModelPdo($username); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init + FreshRSS_Context::init(); + list($updated_feeds, $feed, $nb_new_articles) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie); + if ($updated_feeds > 0 || $feed != false) { + $nb++; + } else { + Minz_Log::warning('Warning: User ' . $username . ' does not subscribe anymore to ' . $self, PSHB_LOG); + unlink($userFilename); + } + } catch (Exception $e) { + Minz_Log::error('Error: ' . $e->getMessage() . ' for user ' . $username . ' and feed ' . $self, PSHB_LOG); + } +} + +$simplePie->__destruct(); +unset($simplePie); + +if ($nb === 0) { + header('HTTP/1.1 410 Gone'); + Minz_Log::warning('Warning: Nobody subscribes to this feed anymore after all!: ' . $self, PSHB_LOG); + die('Nobody subscribes to this feed anymore after all!'); +} elseif (!empty($hubJson['error'])) { + $hubJson['error'] = false; + file_put_contents('./!hub.json', json_encode($hubJson)); +} + +Minz_Log::notice('PubSubHubbub ' . $self . ' done: ' . $nb, PSHB_LOG); +exit('Done: ' . $nb . "\n"); @@ -5,7 +5,7 @@ if (!isset($_GET['f']) || die(); } -require('../constants.php'); +require(__DIR__ . '/../constants.php'); /** * Check if a file can be served by ext.php. A valid file is under a @@ -1,62 +1,20 @@ <?php - -require('../constants.php'); - -include(LIB_PATH . '/Favicon/Favicon.php'); -include(LIB_PATH . '/Favicon/DataAccess.php'); +require(__DIR__ . '/../constants.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader +require(LIB_PATH . '/favicons.php'); require(LIB_PATH . '/http-conditional.php'); - -$favicons_dir = DATA_PATH . '/favicons/'; -$default_favicon = PUBLIC_PATH . '/themes/icons/default_favicon.ico'; - - -/* Télécharge le favicon d'un site et le place sur le serveur */ -function download_favicon($website, $dest) { - global $favicons_dir, $default_favicon; - - $favicon_getter = new \Favicon\Favicon(); - $favicon_getter->setCacheDir($favicons_dir); - $favicon_url = $favicon_getter->get($website); - - if ($favicon_url === false) { - return @copy($default_favicon, $dest); - } - - $c = curl_init($favicon_url); - curl_setopt($c, CURLOPT_HEADER, false); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt($c, CURLOPT_BINARYTRANSFER, true); - $img_raw = curl_exec($c); - $status_code = curl_getinfo($c, CURLINFO_HTTP_CODE); - curl_close($c); - - if ($status_code === 200) { - $file = fopen($dest, 'w'); - if ($file !== false) { - fwrite($file, $img_raw); - fclose($file); - return true; - } - } - - return false; -} - - -function show_default_favicon() { +function show_default_favicon($cacheSeconds = 3600) { global $default_favicon; - header('Content-Type: image/x-icon'); header('Content-Disposition: inline; filename="default_favicon.ico"'); $default_mtime = @filemtime($default_favicon); - if (!httpConditional($default_mtime, 2592000, 2)) { + if (!httpConditional($default_mtime, $cacheSeconds, 2)) { readfile($default_favicon); } } - $id = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '0'; if (!ctype_xdigit($id)) { $id = '0'; @@ -68,25 +26,29 @@ $ico = $favicons_dir . $id . '.ico'; $ico_mtime = @filemtime($ico); $txt_mtime = @filemtime($txt); +header('Content-Type: image/x-icon'); -if ($ico_mtime == false || $txt_mtime > $ico_mtime) { +if ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (rand(15, 20) * 86400))) { if ($txt_mtime == false) { - show_default_favicon(); - return; + show_default_favicon(1800); + exit(); } // no ico file or we should download a new one. $url = file_get_contents($txt); if (!download_favicon($url, $ico)) { - // Download failed, show the default favicon - show_default_favicon(); - return; + // Download failed + if ($ico_mtime == false) { + show_default_favicon(86400); + exit(); + } else { + touch($ico); + } } } -header('Content-Type: image/x-icon'); header('Content-Disposition: inline; filename="' . $id . '.ico"'); -if (!httpConditional($ico_mtime, 2592000, 2)) { +if (!httpConditional($ico_mtime, rand(14, 21) * 86400, 2)) { readfile($ico); } diff --git a/p/i/index.php b/p/i/index.php index d3fc0b37c..a1212b570 100755 --- a/p/i/index.php +++ b/p/i/index.php @@ -18,7 +18,7 @@ # # ***** END LICENSE BLOCK ***** -require('../../constants.php'); +require(__DIR__ . '/../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader if (file_exists(DATA_PATH . '/do-install.txt')) { diff --git a/p/index.html b/p/index.html index 260f437bd..3f4284eb5 100644 --- a/p/index.html +++ b/p/index.html @@ -5,27 +5,11 @@ <meta name="viewport" content="initial-scale=1.0" /> <meta http-equiv="Refresh" content="0; url=i/" /> <title>FreshRSS</title> +<link rel="stylesheet" href="themes/p.css" /> <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> +<meta name="robots" content="noindex" /> </head> <body> diff --git a/p/scripts/category.js b/p/scripts/category.js index c33e68528..caa4fa22f 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -1,30 +1,37 @@ "use strict"; +/* globals i18n */ +/* jshint globalstrict: true */ var loading = false, dnd_successful = false; function dragend_process(t) { - t.style.display = 'none'; + t.setAttribute('draggable', 'false'); if (loading) { window.setTimeout(function() { dragend_process(t); }, 50); + return; } if (!dnd_successful) { - t.style.display = 'block'; - t.style.opacity = 1.0; + t.style.display = ''; + t.style.opacity = ''; + t.setAttribute('draggable', 'true'); } else { var parent = $(t.parentNode); $(t).remove(); if (parent.children().length <= 0) { - parent.append('<li class="item disabled" dropzone="move">' + i18n['category_empty'] + '</li>'); + parent.append('<li class="item disabled" dropzone="move">' + i18n.category_empty + '</li>'); } } } +var dragFeedId = '', + dragHtml = ''; + function init_draggable() { if (!(window.$ && window.i18n)) { if (window.console) { @@ -34,16 +41,16 @@ function init_draggable() { return; } - $.event.props.push('dataTransfer'); - var draggable = '[draggable="true"]', dropzone = '[dropzone="move"]'; $('.drop-section').on('dragstart', draggable, function(e) { - e.dataTransfer.effectAllowed = 'move'; - e.dataTransfer.setData('text/html', e.target.outerHTML); - e.dataTransfer.setData('text', e.target.getAttribute('data-feed-id')); - e.target.style.opacity = 0.3; + var drag = $(e.target).closest('[draggable]')[0]; + e.originalEvent.dataTransfer.effectAllowed = 'move'; + dragHtml = drag.outerHTML; + dragFeedId = drag.getAttribute('data-feed-id'); + e.originalEvent.dataTransfer.setData('text', dragFeedId); + drag.style.opacity = 0.3; dnd_successful = false; }); @@ -74,32 +81,32 @@ function init_draggable() { $(this).removeClass('drag-hover'); }); $('.drop-section').on('dragover', dropzone, function(e) { - e.dataTransfer.dropEffect = "move"; + e.originalEvent.dataTransfer.dropEffect = "move"; e.preventDefault(); return false; }); $('.drop-section').on('drop', dropzone, function(e) { - var feed_id = e.dataTransfer.getData('text'), - cat_id = e.target.parentNode.getAttribute('data-cat-id'); - loading = true; $.ajax({ type: 'POST', url: './?c=feed&a=move', - data : { - f_id: feed_id, - c_id: cat_id + data: { + f_id: dragFeedId, + c_id: e.target.parentNode.getAttribute('data-cat-id'), + _csrf: context.csrf, } - }).success(function() { - $(e.target).after(e.dataTransfer.getData('text/html')); + }).done(function() { + $(e.target).after(dragHtml); if ($(e.target).hasClass('disabled')) { $(e.target).remove(); } dnd_successful = true; - }).complete(function() { + }).always(function() { loading = false; + dragFeedId = ''; + dragHtml = ''; }); $(this).removeClass('drag-hover'); diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 7d7ba22b5..c5aaa48b1 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -1,4 +1,7 @@ "use strict"; +/* globals init_load_more, init_posts, init_stream */ +/* jshint globalstrict: true */ + var panel_loading = false; function load_panel(link) { @@ -23,12 +26,16 @@ function load_panel(link) { // Sans ça, si l'on scroll en lisant une catégorie par exemple, // en en ouvrant une autre ensuite, on se retrouve au même point de scroll $("#panel").scrollTop(0); + $(window).scrollTop(0); $('#panel').on('click', '#nav_menu_read_all button, #bigMarkAsRead', function () { console.log($(this).attr("formaction")); $.ajax({ type: "POST", url: $(this).attr("formaction"), + data: { + _csrf: context.csrf, + }, async: false }); window.location.reload(false); diff --git a/p/scripts/install.js b/p/scripts/install.js new file mode 100644 index 000000000..b7975fd6e --- /dev/null +++ b/p/scripts/install.js @@ -0,0 +1,73 @@ +"use strict"; +/* jshint globalstrict: true */ + +function show_password() { + var button = this; + var passwordField = document.getElementById(button.getAttribute('data-toggle')); + passwordField.setAttribute('type', 'text'); + button.className += ' active'; + return false; +} +function hide_password() { + var button = this; + var passwordField = document.getElementById(button.getAttribute('data-toggle')); + passwordField.setAttribute('type', 'password'); + button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , ''); + return false; +} +var toggles = document.getElementsByClassName('toggle-password'); +for (var i = 0 ; i < toggles.length ; i++) { + toggles[i].addEventListener('mousedown', show_password); + toggles[i].addEventListener('mouseup', hide_password); +} + +function auth_type_change() { + var auth_type = document.getElementById('auth_type'); + if (auth_type) { + var auth_value = auth_type.value, + password_input = document.getElementById('passwordPlain'); + + if (auth_value === 'form') { + password_input.required = true; + } else { + password_input.required = false; + } + } +} +var auth_type = document.getElementById('auth_type'); +if (auth_type) { + auth_type_change(); + auth_type.addEventListener('change', auth_type_change); +} + +function mySqlShowHide() { + var mysql = document.getElementById('mysql'); + if (mysql) { + if (document.getElementById('type').value === 'sqlite') { + document.getElementById('host').value = ''; + document.getElementById('user').value = ''; + document.getElementById('pass').value = ''; + document.getElementById('base').value = ''; + document.getElementById('prefix').value = ''; + mysql.style.display = 'none'; + } else { + mysql.style.display = 'block'; + } + } +} +var bd_type = document.getElementById('type'); +if (bd_type) { + mySqlShowHide(); + bd_type.addEventListener('change', mySqlShowHide); +} + +function ask_confirmation(e) { + var str_confirmation = this.getAttribute('data-str-confirm'); + if (!confirm(str_confirmation)) { + e.preventDefault(); + } +} +var confirms = document.getElementsByClassName('confirm'); +for (var i = 0 ; i < confirms.length ; i++) { + confirms[i].addEventListener('click', ask_confirmation); +} diff --git a/p/scripts/jquery.min.js b/p/scripts/jquery.min.js index 25714ed29..4c5be4c0f 100644 --- a/p/scripts/jquery.min.js +++ b/p/scripts/jquery.min.js @@ -1,4 +1,4 @@ -/*! jQuery v2.1.3 | (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={},l=a.document,m="2.1.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,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=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.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},n.extend=n.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||n.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&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!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=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.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?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.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),n.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||n.guid++,f):void 0},now:Date.now,support:k}),n.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=n.type(a);return"function"===c||n.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,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=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)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(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 pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(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 p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.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},B=b?function(a,b){if(a===b)return l=!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===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.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=gb.selectors={cacheLength:50,createPseudo:ib,match:X,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(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===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]||gb.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]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(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(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.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.replace(Q," ")+" ").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(),s=!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&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&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]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)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&&(s&&((l[u]||(l[u]={}))[a]=[w,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()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(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),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?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===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.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 Z.test(a.nodeName)},input:function(a){return Y.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:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(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]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[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?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;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=[w,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[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(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 ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(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 wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(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?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.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)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.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 n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.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&&n(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}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.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?n(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&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(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(n.unique(n.merge(this.get(),n(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}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.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){n.each(b,function(b,c){var d=n.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&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.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},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.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?n.extend(a,d):d}},e={};return d.pipe=d.then,n.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&&n.isFunction(a.promise)?e:0,g=1===f?a:n.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]&&n.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;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(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};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.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,n.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(n.isEmptyObject(f))n.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,n.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{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.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!n.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)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.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)}}),n.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--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.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=n.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)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.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:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.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"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,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),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,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])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],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||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.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]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.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=((n.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?n(e,this).index(i)>=0:n.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||l,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[n.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 n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),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&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.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(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.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))}}}),n.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 n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.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,n(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(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.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 n.nodeName(a,"table")&&n.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++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.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&&n.nodeName(a,b)?n.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)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.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,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.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;n.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===n.inArray(e,d))&&(i=n.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=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.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?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.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&&(n.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 n.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&&(n.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,n.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,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.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(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<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(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,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||n.contains(a.ownerDocument,a)||(g=n.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=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.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+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.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"===n.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&&(k.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)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.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}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!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=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.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(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.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||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.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"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.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)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.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)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.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||(n.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?n.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=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.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)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.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]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.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,n.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=n.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,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(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=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.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=n.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:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.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 n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.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)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.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)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.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=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.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=n.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)&&n.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=n.timers,g=d?d.length:0;for(c.finish=!0,n.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})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.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=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.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?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.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 n.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=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.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?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.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;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.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||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.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}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(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=n.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(n.isFunction(a))return this.each(function(b){n(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?n.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(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(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;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.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)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},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||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.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){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.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=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.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)&&n.error("Invalid XML: "+a),b};var ec=/#.*$/,fc=/([?&])_=[^&]*/,gc=/^(.*?):[ \t]*([^\r\n]*)$/gm,hc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ic=/^(?:GET|HEAD)$/,jc=/^\/\//,kc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lc={},mc={},nc="*/".concat("*"),oc=a.location.href,pc=kc.exec(oc.toLowerCase())||[];function qc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.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 rc(a,b,c,d){var e={},f=a===mc;function g(h){var i;return e[h]=!0,n.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 sc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tc(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 uc(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}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:oc,type:"GET",isLocal:hc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nc,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":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sc(sc(a,n.ajaxSettings),b):sc(n.ajaxSettings,a)},ajaxPrefilter:qc(lc),ajaxTransport:qc(mc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.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=gc.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(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||oc)+"").replace(ec,"").replace(jc,pc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pc[1]&&h[2]===pc[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pc[3]||("http:"===pc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rc(lc,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ic.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=fc.test(d)?d.replace(fc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.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]?", "+nc+"; 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=rc(mc,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=tc(k,v,f)),u=uc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.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?o.resolveWith(l,[r,x,v]):o.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]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(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(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vc=/%20/g,wc=/\[\]$/,xc=/\r?\n/g,yc=/^(?:submit|button|image|reset|file)$/i,zc=/^(?:input|select|textarea|keygen)/i;function Ac(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wc.test(a)?d(a,e):Ac(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ac(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ac(c,a[c],b,e);return d.join("&").replace(vc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zc.test(this.nodeName)&&!yc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xc,"\r\n")}}):{name:b.name,value:c.replace(xc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bc=0,Cc={},Dc={0:200,1223:204},Ec=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cc)Cc[a]()}),k.cors=!!Ec&&"withCredentials"in Ec,k.ajax=Ec=!!Ec,n.ajaxTransport(function(a){var b;return k.cors||Ec&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bc;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 Cc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Dc[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=Cc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<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)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fc=[],Gc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.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,Fc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hc)return Hc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ic=a.document.documentElement;function Jc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.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),n.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)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.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,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jc(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"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ic;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ic})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jc(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)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.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 n.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?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kc=a.jQuery,Lc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lc),b&&a.jQuery===n&&(a.jQuery=Kc),n},typeof b===U&&(a.jQuery=a.$=n),n}); +/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ +!function(a,b){"use strict";"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){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.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||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},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?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;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;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;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-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),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(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),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-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){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 ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(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 qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(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){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.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},B=b?function(a,b){if(a===b)return l=!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===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,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(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(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(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.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.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},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(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(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),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?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===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!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:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?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]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[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?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(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 va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(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(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R), +a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;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},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.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=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.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 V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.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=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aa=new RegExp("^(?:([+-])=|)("+_+")([a-z%]*)$","i"),ba=["Top","Right","Bottom","Left"],ca=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},da=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};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ca(d)&&(e[f]=ga(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={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,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var oa=/<|&#?\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ja.exec(f)||["",""])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),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),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==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,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(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=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/<script|<style|<link/i,Aa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ba=/^true\/(.*)/,Ca=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,""),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,"script"),g.length>0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.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 Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(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&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",qa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.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 Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:"absolute",visibility:"hidden",display:"block"},Ra={letterSpacing:"0",fontWeight:"400"},Sa=["Webkit","Moz","ms"],Ta=d.createElement("div").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ba[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ba[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ba[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ba[f]+"Width",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!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=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.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=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),"normal"===e&&b in Ra&&(e=Ra[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=aa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,"marginLeft"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=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):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function fb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ca(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],_a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ha([a],!0),j=a.style.display||j,k=r.css(a,"display"),ha([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ha([a],!0),m.done(function(){p||ha([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=eb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function gb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.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 hb(a,b,c){var d,e,f=0,g=hb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Za||cb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Za||cb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.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;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(gb(k,j.opts.specialEasing);f<g;f++)if(d=hb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,eb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.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)}r.Animation=r.extend(hb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return ea(c.elem,a,aa.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],hb.tweeners[c]=hb.tweeners[c]||[],hb.tweeners[c].unshift(b)},prefilters:[fb],prefilter:function(a,b){b?hb.prefilters.unshift(a):hb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:"number"!=typeof e.duration&&(e.duration in r.fx.speeds?e.duration=r.fx.speeds[e.duration]:e.duration=r.fx.speeds._default),null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ca).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=hb(this,r.extend({},a),f);(e||V.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=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.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||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.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;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(db(b,!0),a,d,e)}}),r.each({slideDown:db("show"),slideUp:db("hide"),slideToggle:db("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Za=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Za=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){$a||($a=a.requestAnimationFrame?a.requestAnimationFrame(bb):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame($a):a.clearInterval($a),$a=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var ib,jb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)), +void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.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){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.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 Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.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 Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(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}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(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}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(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 r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=mb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.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),r.isFunction(b)&&(b=b.call(a,c,r.extend({},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)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({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)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r}); diff --git a/p/scripts/jquery.sticky-kit.min.js b/p/scripts/jquery.sticky-kit.min.js new file mode 100644 index 000000000..e2a3c6de9 --- /dev/null +++ b/p/scripts/jquery.sticky-kit.min.js @@ -0,0 +1,9 @@ +/* + Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net +*/ +(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); +if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("<div />"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, +u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,c=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h), +h.detach()),b={position:"",width:"",top:""},a.css(b).removeClass(t).trigger("sticky_kit:unstick")),B&&(b=f.height(),u+q>b&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), +a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", +y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n<K;n++)d=this[n],J(b(d));return this}}).call(this); diff --git a/p/scripts/main.js b/p/scripts/main.js index 1be75bb12..ce8070008 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1,4 +1,7 @@ "use strict"; +/* globals $, jQuery, context, i18n, shortcut, shortcuts, url */ +/* jshint strict:global */ + var $stream = null, isCollapsed = true, shares = 0, @@ -49,9 +52,7 @@ function numberFormat(nStr) { function incLabel(p, inc, spaceAfter) { var i = str2int(p) + inc; - return i > 0 - ? ((spaceAfter ? '' : ' ') + '(' + numberFormat(i) + ')' + (spaceAfter ? ' ' : '')) - : ''; + return i > 0 ? ((spaceAfter ? '' : ' ') + '(' + numberFormat(i) + ')' + (spaceAfter ? ' ' : '')) : ''; } function incUnreadsFeed(article, feed_id, nb) { @@ -113,51 +114,53 @@ function incUnreadsFeed(article, feed_id, nb) { return isCurrentView; } -var pending_feeds = []; +var pending_entries = {}; function mark_read(active, only_not_read) { - if (active.length === 0 || - (only_not_read === true && !active.hasClass("not_read"))) { - return false; - } - - var url = active.find("a.read").attr("href"); - if (url === undefined) { + if ((active.length === 0) || (!active.attr('id')) || + context.anonymous || + (only_not_read && !active.hasClass("not_read"))) { return false; } - var feed_url = active.find(".website>a").attr("href"), - feed_id = feed_url.substr(feed_url.lastIndexOf('f_')), - index_pending = pending_feeds.indexOf(feed_id); - - if (index_pending !== -1) { + if (pending_entries[active.attr('id')]) { return false; } + pending_entries[active.attr('id')] = true; - pending_feeds.push(feed_id); + var url = '.?c=entry&a=read&id=' + active.attr('id').replace(/^flux_/, '') + + (active.hasClass('not_read') ? '' : '&is_read=0'); $.ajax({ type: 'POST', url: url, - data : { ajax: true } + data: { + ajax: true, + _csrf: context.csrf, + }, }).done(function (data) { var $r = active.find("a.read").attr("href", data.url), inc = 0; if (active.hasClass("not_read")) { active.removeClass("not_read"); inc--; - } else if (only_not_read !== true || active.hasClass("not_read")) { + } else { active.addClass("not_read"); + active.addClass("keep_unread"); inc++; } $r.find('.icon').replaceWith(data.icon); - incUnreadsFeed(active, feed_id, inc); + var feed_url = active.find(".website>a").attr("href"); + if (feed_url) { + var feed_id = feed_url.substr(feed_url.lastIndexOf('f_')); + incUnreadsFeed(active, feed_id, inc); + } faviconNbUnread(); - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }).fail(function (data) { openNotification(i18n.notif_request_failed, 'bad'); - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }); } @@ -171,20 +174,18 @@ function mark_favorite(active) { return false; } - var feed_url = active.find(".website>a").attr("href"), - feed_id = feed_url.substr(feed_url.lastIndexOf('f_')), - index_pending = pending_feeds.indexOf(feed_id); - - if (index_pending !== -1) { + if (pending_entries[active.attr('id')]) { return false; } - - pending_feeds.push(feed_id); + pending_entries[active.attr('id')] = true; $.ajax({ type: 'POST', url: url, - data : { ajax: true } + data: { + ajax: true, + _csrf: context.csrf, + }, }).done(function (data) { var $b = active.find("a.bookmark").attr("href", data.url), inc = 0; @@ -212,10 +213,10 @@ function mark_favorite(active) { } } - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }).fail(function (data) { openNotification(i18n.notif_request_failed, 'bad'); - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }); } @@ -224,8 +225,9 @@ function toggleContent(new_active, old_active) { return; } - if (context['does_lazyload']) { + if (context.does_lazyload) { new_active.find('img[data-original], iframe[data-original]').each(function () { + this.onload = function () { $(document.body).trigger("sticky_kit:recalc"); }; this.setAttribute('src', this.getAttribute('data-original')); this.removeAttribute('data-original'); }); @@ -237,58 +239,60 @@ function toggleContent(new_active, old_active) { } old_active.removeClass("active current"); new_active.addClass("current"); - if (context['auto_remove_article'] && !old_active.hasClass('not_read')) { - var p = old_active.prev(); - var n = old_active.next(); - if (p.hasClass('day') && n.hasClass('day')) { - p.remove(); - } - old_active.remove(); + if (context.auto_remove_article && !old_active.hasClass('not_read')) { + auto_remove(old_active); } } else { new_active.toggleClass('active'); } - var box_to_move = "html,body", - relative_move = false; - if (context['current_view'] == 'global') { - box_to_move = "#panel"; - relative_move = true; - } + var relative_move = context.current_view === 'global', + box_to_move = $(relative_move ? "#panel" : "html,body"); - if (context['sticky_post']) { + if (context.sticky_post) { var prev_article = new_active.prevAll('.flux'), - new_pos = new_active.position().top, - old_scroll = $(box_to_move).scrollTop(); + new_pos = new_active.offset().top, + old_scroll = box_to_move.scrollTop(); - if (prev_article.length > 0 && new_pos - prev_article.position().top <= 150) { - new_pos = prev_article.position().top; + if (prev_article.length > 0 && new_pos - prev_article.offset().top <= 150) { + new_pos = prev_article.offset().top; + if (relative_move) { + new_pos -= box_to_move.offset().top; + } } - if (context['hide_posts']) { + if (context.hide_posts) { if (relative_move) { new_pos += old_scroll; } - if (old_active[0] !== new_active[0]) { - new_active.children(".flux_content").first().each(function () { - $(box_to_move).scrollTop(new_pos).scrollTop(); - }); - } + new_active.children(".flux_content").first().each(function () { + box_to_move.scrollTop(new_pos).scrollTop(); + }); } else { if (relative_move) { new_pos += old_scroll; } - $(box_to_move).scrollTop(new_pos).scrollTop(); + box_to_move.scrollTop(new_pos).scrollTop(); } } - if (context['auto_mark_article'] && new_active.hasClass('active')) { + if (context.auto_mark_article && new_active.hasClass('active')) { mark_read(new_active, true); } } +function auto_remove(element) { + var p = element.prev(); + var n = element.next(); + if (p.hasClass('day') && n.hasClass('day')) { + p.remove(); + } + element.remove(); + $('#stream > .flux:not(.not_read):not(.active)').remove(); +} + function prev_entry() { var old_active = $(".flux.current"), new_active = old_active.length === 0 ? $(".flux:last") : old_active.prevAll(".flux:first"); @@ -380,13 +384,8 @@ function last_category() { } function collapse_entry() { - isCollapsed = !isCollapsed; - var flux_current = $(".flux.current"); - flux_current.toggleClass("active"); - if (isCollapsed && context['auto_mark_article']) { - mark_read(flux_current, true); - } + toggleContent(flux_current, flux_current); } function user_filter(key) { @@ -446,49 +445,43 @@ function auto_share(key) { } } -function inMarkViewport(flux, box_to_follow, relative_follow) { - var top = flux.position().top; - if (relative_follow) { - top += box_to_follow.scrollTop(); - } - var height = flux.height(), - begin = top + 3 * height / 4, - bot = Math.min(begin + 75, top + height), - windowTop = box_to_follow.scrollTop(), - windowBot = windowTop + box_to_follow.height() / 2; - - return (windowBot >= begin && bot >= windowBot); +function scrollAsRead(box_to_follow) { + var minTop = 40 + (context.current_view === 'global' ? box_to_follow.offset().top : box_to_follow.scrollTop()); + $('.not_read:not(.keep_unread):visible').each(function () { + var $this = $(this); + if ($this.offset().top + $this.height() < minTop) { + mark_read($this, true); + } + }); } function init_posts() { - var box_to_follow = $(window), - relative_follow = false; - if (context['current_view'] == 'global') { - box_to_follow = $("#panel"); - relative_follow = true; - } + var box_to_follow = context.current_view === 'global' ? $("#panel") : $(window); - if (context['auto_mark_scroll']) { + if (context.auto_mark_scroll) { + var lastScroll = 0, //Throttle + timerId = 0; box_to_follow.scroll(function () { - $('.not_read:visible').each(function () { - if ($(this).children(".flux_content").is(':visible') && inMarkViewport($(this), box_to_follow, relative_follow)) { - mark_read($(this), true); - } - }); + window.clearTimeout(timerId); + if (lastScroll + 500 < Date.now()) { + lastScroll = Date.now(); + scrollAsRead(box_to_follow); + } else { + timerId = window.setTimeout(function() { + scrollAsRead(box_to_follow); + }, 500); + } }); } - if (context['auto_load_more']) { + if (context.auto_load_more) { box_to_follow.scroll(function () { var load_more = $("#load_more"); if (!load_more.is(':visible')) { return; } var boxBot = box_to_follow.scrollTop() + box_to_follow.height(), - load_more_top = load_more.position().top; - if (relative_follow) { - load_more_top += box_to_follow.scrollTop(); - } + load_more_top = load_more.offset().top; if (boxBot >= load_more_top) { load_more_posts(); } @@ -497,8 +490,29 @@ function init_posts() { } } +function inject_script(name) { + var script = document.createElement('script'); + script.async = 'async'; + script.defer = 'defer'; + script.src = '../scripts/' + name; + document.head.appendChild(script); +} + +function init_sticky_column() { + if (!window.$ || !window.$.fn.stick_in_parent) { + if (window.console) { + console.log('FreshRSS waiting for Sticky-kit…'); + } + window.setTimeout(init_sticky_column, 200); + return; + } + if ($('.toggle_aside').css('display') === 'none') { + $('#aside_feed .tree').stick_in_parent({parent:'#aside_feed'}); + } +} + function init_column_categories() { - if (context['current_view'] !== 'normal') { + if (context.current_view !== 'normal') { return; } @@ -512,7 +526,7 @@ function init_column_categories() { this.alt = '▽'; } }); - $(this).parent().next(".tree-folder-items").slideToggle(); + $(this).parent().next(".tree-folder-items").slideToggle(300 , function() { $(document.body).trigger("sticky_kit:recalc"); }); return false; }); $('#aside_feed').on('click', '.tree-folder-items .item .dropdown-toggle', function () { @@ -521,8 +535,19 @@ function init_column_categories() { 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); + $('.tree-folder-items .dropdown-close a').click(function(){ + $('.tree').removeClass('treepadding'); + $(document.body).trigger("sticky_kit:recalc"); + }); } }); + + $('.tree-folder-items .dropdown-toggle').click(function(){ + $('.tree').addClass('treepadding'); + $(document.body).trigger("sticky_kit:recalc"); + }); + + init_sticky_column(); } function init_shortcuts() { @@ -530,59 +555,64 @@ function init_shortcuts() { if (window.console) { console.log('FreshRSS waiting for sortcut.js…'); } - window.setTimeout(init_shortcuts, 50); + window.setTimeout(init_shortcuts, 200); return; } - // Touches de manipulation + // Manipulation shortcuts shortcut.add(shortcuts.mark_read, function () { - // on marque comme lu ou non lu + // Toggle the read state var active = $(".flux.current"); mark_read(active, false); }, { 'disable_in_input': true }); shortcut.add("shift+" + shortcuts.mark_read, function () { - // on marque tout comme lu + // Mark everything as read $(".nav_menu .read_all").click(); }, { 'disable_in_input': true }); shortcut.add(shortcuts.mark_favorite, function () { - // on marque comme favori ou non favori + // Toggle the favorite state var active = $(".flux.current"); mark_favorite(active); }, { 'disable_in_input': true }); shortcut.add(shortcuts.collapse_entry, function () { + // Toggle the collapse state collapse_entry(); }, { 'disable_in_input': true }); shortcut.add(shortcuts.auto_share, function () { + // Display the share options auto_share(); }, { 'disable_in_input': true }); shortcut.add(shortcuts.user_filter, function () { + // Display the user filters user_filter(); }, { 'disable_in_input': true }); - for(var i = 1; i < 10; i++){ - shortcut.add(i.toString(), function (e) { - if ($('#dropdown-query').siblings('.dropdown-menu').is(':visible')) { - user_filter(String.fromCharCode(e.keyCode)); - } else { - auto_share(String.fromCharCode(e.keyCode)); - } - }, { + + function addShortcut(evt) { + if ($('#dropdown-query').siblings('.dropdown-menu').is(':visible')) { + user_filter(String.fromCharCode(evt.keyCode)); + } else { + auto_share(String.fromCharCode(evt.keyCode)); + } + } + for(var i = 1; i < 10; i++) { + shortcut.add(i.toString(), addShortcut, { 'disable_in_input': true }); } - // Touches de navigation pour les articles + // Entry navigation shortcuts shortcut.add(shortcuts.prev_entry, prev_entry, { 'disable_in_input': true }); @@ -609,7 +639,7 @@ function init_shortcuts() { }, { 'disable_in_input': true }); - // Touches de navigation pour les flux + // Feed navigation shortcuts shortcut.add("shift+" + shortcuts.prev_entry, prev_feed, { 'disable_in_input': true }); @@ -622,7 +652,7 @@ function init_shortcuts() { shortcut.add("shift+" + shortcuts.last_entry, last_feed, { 'disable_in_input': true }); - // Touches de navigation pour les categories + // Category navigation shortcuts shortcut.add("alt+" + shortcuts.prev_entry, prev_category, { 'disable_in_input': true }); @@ -637,9 +667,9 @@ function init_shortcuts() { }); shortcut.add(shortcuts.go_website, function () { - var url_website = $('.flux.current > .flux_header > .title > a').attr("href"); + var url_website = $('.flux.current a.go_website').attr("href"); - if (context['auto_mark_site']) { + if (context.auto_mark_site) { $(".flux.current").each(function () { mark_read($(this), true); }); @@ -663,7 +693,7 @@ function init_shortcuts() { }); shortcut.add(shortcuts.help, function () { - redirect(url['help'], true); + redirect(url.help, true); }, { 'disable_in_input': true }); @@ -681,11 +711,15 @@ function init_stream(divStream) { if ($(e.target).closest('.content, .item.website, .item.link').length > 0) { return; } + if (!context.sides_close_article && $(e.target).is('div.flux_content')) { + // setting for not-closing after clicking outside article area + return; + } var old_active = $(".flux.current"), new_active = $(this).parent(); - isCollapsed = true; + isCollapsed = true; if (e.target.tagName.toUpperCase() === 'A') { //Leave real links alone - if (context['auto_mark_article']) { + if (context.auto_mark_article) { mark_read(new_active, true); } return true; @@ -695,13 +729,8 @@ function init_stream(divStream) { divStream.on('click', '.flux a.read', function () { var active = $(this).parents(".flux"); - if (context['auto_remove_article'] && active.hasClass('not_read')) { - var p = active.prev(); - var n = active.next(); - if (p.hasClass('day') && n.hasClass('day')) { - p.remove(); - } - active.remove(); + if (context.auto_remove_article && active.hasClass('not_read')) { + auto_remove(active); } mark_read(active, false); return false; @@ -726,9 +755,9 @@ function init_stream(divStream) { if (e.which == 2) { // If middle click, we want same behaviour as CTRL+click. - var e = jQuery.Event("click"); - e.ctrlKey = true; - $(this).trigger(e); + var ev = jQuery.Event("click"); + ev.ctrlKey = true; + $(this).trigger(ev); } else if(e.which == 1) { // Normal click, just toggle article. $(this).parent().click(); @@ -736,10 +765,10 @@ function init_stream(divStream) { }); divStream.on('click', '.flux .content a', function () { - $(this).attr('target', '_blank'); + $(this).attr('target', '_blank').attr('rel', 'noreferrer'); }); - if (context['auto_mark_site']) { + if (context.auto_mark_site) { // catch mouseup instead of click so we can have the correct behaviour // with middle button click (scroll button). divStream.on('mouseup', '.flux .link > a', function (e) { @@ -765,7 +794,7 @@ function init_nav_entries() { $nav_entries.find('.up').click(function () { var active_item = $(".flux.current"), windowTop = $(window).scrollTop(), - item_top = active_item.position().top; + item_top = active_item.offset().top; if (windowTop > item_top) { $("html,body").scrollTop(item_top); @@ -776,6 +805,34 @@ function init_nav_entries() { }); } +// <actualize> +var feed_processed = 0; + +function updateFeed(feeds, feeds_count) { + var feed = feeds.pop(); + if (!feed) { + return; + } + $.ajax({ + type: 'POST', + url: feed.url, + data: { + _csrf: context.csrf, + noCommit: feeds.length > 0 ? 1 : 0, + }, + }).always(function (data) { + feed_processed++; + $("#actualizeProgress .progress").html(feed_processed + " / " + feeds_count); + $("#actualizeProgress .title").html(feed.title); + + if (feed_processed === feeds_count) { + window.location.reload(); + } else { + updateFeed(feeds, feeds_count); + } + }); +} + function init_actualize() { var auto = false; @@ -783,28 +840,47 @@ function init_actualize() { if (ajax_loading) { return false; } - ajax_loading = true; - $.getScript('./?c=javascript&a=actualize').done(function () { - if (auto && feed_count < 1) { + $.getJSON('./?c=javascript&a=actualize').done(function (data) { + if (auto && data.feeds.length < 1) { auto = false; ajax_loading = false; return false; } - - updateFeeds(); + if (data.feeds.length === 0) { + openNotification(data.feedback_no_refresh, "good"); + $.ajax({ //Empty request to force refresh server database cache + type: 'POST', + url: './?c=feed&a=actualize&id=-1', + data: { + _csrf: context.csrf, + noCommit: 0, + }, + }).always(function (data) { + ajax_loading = false; + }); + return; + } + //Progress bar + var feeds_count = data.feeds.length; + $('body').after('<div id="actualizeProgress" class="notification good">' + data.feedback_actualize + + '<br /><span class="title">/</span><br /><span class="progress">0 / ' + feeds_count + + '</span></div>'); + for (var i = 10; i > 0; i--) { + updateFeed(data.feeds, feeds_count); + } }); return false; }); - if (context['auto_actualize_feeds']) { + if (context.auto_actualize_feeds) { auto = true; $("#actualize").click(); } } - +// </actualize> // <notification> var notification = null, @@ -867,23 +943,25 @@ function notifs_html5_ask_permission() { function notifs_html5_show(nb) { if (notifs_html5_permission !== "granted") { - return + return; } - var notification = new window.Notification(i18n['notif_title_articles'], { + var notification = new window.Notification(i18n.notif_title_articles, { icon: "../themes/icons/favicon-256.png", - body: i18n['notif_body_articles'].replace("\d", nb), + body: i18n.notif_body_articles.replace('%d', nb), tag: "freshRssNewArticles" }); notification.onclick = function() { window.location.reload(); - } + window.focus(); + notification.close(); + }; - if (context['html5_notif_timeout'] !== 0){ + if (context.html5_notif_timeout !== 0) { setTimeout(function() { - notification.close(); - }, context['html5_notif_timeout'] * 1000); + notification.close(); + }, context.html5_notif_timeout * 1000); } } @@ -899,7 +977,7 @@ function init_notifs_html5() { function refreshUnreads() { $.getJSON('./?c=javascript&a=nbUnreadsPerFeed').done(function (data) { var isAll = $('.category.all.active').length > 0, - new_articles = false; + new_articles = false; $.each(data, function(feed_id, nbUnreads) { feed_id = 'f_' + feed_id; @@ -908,9 +986,9 @@ function refreshUnreads() { if ((incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads) || isAll) && //Update of current view? (nbUnreads - feed_unreads > 0)) { - $('#new-article').show(); + $('#new-article').attr('aria-hidden', 'false').show(); new_articles = true; - }; + } }); var nb_unreads = str2int($('.category.all .title').attr('data-unread')); @@ -937,13 +1015,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)); - if (context['display_order'] === 'ASC') { - $('#nav_menu_read_all > .read_all').attr( + if (context.display_order === 'ASC') { + $('#nav_menu_read_all .read_all').attr( 'formaction', $('#bigMarkAsRead').attr('formaction') ); } else { $('#bigMarkAsRead').attr( - 'formaction', $('#nav_menu_read_all > .read_all').attr('formaction') + 'formaction', $('#nav_menu_read_all .read_all').attr('formaction') ); } @@ -957,7 +1035,9 @@ function load_more_posts() { init_load_more(box_load_more); $('#load_more').removeClass('loading'); + $('#bigMarkAsRead').removeAttr('disabled'); load_more = false; + $(document.body).trigger('sticky_kit:recalc'); }); } @@ -965,14 +1045,13 @@ function focus_search() { $('#search').focus(); } +var freshrssLoadMoreEvent = document.createEvent('Event'); +freshrssLoadMoreEvent.initEvent('freshrss:load-more', true, true); + function init_load_more(box) { box_load_more = box; - if (!context['does_lazyload']) { - $('img[postpone], audio[postpone], iframe[postpone], video[postpone]').each(function () { - this.removeAttribute('postpone'); - }); - } + document.body.dispatchEvent(freshrssLoadMoreEvent); var $next_link = $("#load_more"); if (!$next_link.length) { @@ -1007,6 +1086,7 @@ function poormanSalt() { //If crypto.getRandomValues is not available } function init_crypto_form() { + /* globals dcodeIO */ var $crypto_form = $('#crypto-form'); if ($crypto_form.length === 0) { return; @@ -1030,7 +1110,7 @@ function init_crypto_form() { dataType: 'json', async: false }).done(function (data) { - if (data.salt1 == '' || data.nonce == '') { + if (!data.salt1 || !data.nonce) { openNotification('Invalid user!', 'bad'); } else { try { @@ -1038,7 +1118,7 @@ function init_crypto_form() { s = dcodeIO.bcrypt.hashSync($('#passwordPlain').val(), data.salt1), c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? dcodeIO.bcrypt.genSaltSync(4) : poormanSalt()); $('#challenge').val(c); - if (s == '' || c == '') { + if (!s || !c) { openNotification('Crypto error!', 'bad'); } else { success = true; @@ -1063,22 +1143,23 @@ function init_confirm_action() { $('body').on('click', '.confirm', function () { var str_confirmation = $(this).attr('data-str-confirm'); if (!str_confirmation) { - str_confirmation = i18n['confirmation_default']; + str_confirmation = i18n.confirmation_default; } return confirm(str_confirmation); }); + $('button.confirm').removeAttr('disabled'); } function init_print_action() { $('.item.share > a[href="#"]').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 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); @@ -1091,16 +1172,26 @@ function init_print_action() { }); } +function init_post_action() { + $('.item.share > a[href="POST"]').click(function (event) { + event.preventDefault(); + var form = $(this).next('form'); + $.post(form.data('url'), form.serialize()); + }); +} + function init_share_observers() { shares = $('.group-share').length; $('.share.add').on('click', function(e) { var opt = $(this).siblings('select').find(':selected'); var row = $(this).parents('form').data(opt.data('form')); - row = row.replace('##label##', opt.html(), 'g'); - row = row.replace('##type##', opt.val(), 'g'); - row = row.replace('##help##', opt.data('help'), 'g'); - row = row.replace('##key##', shares, 'g'); + row = row.replace(/##label##/g, opt.html().trim()); + row = row.replace(/##type##/g, opt.val()); + row = row.replace(/##help##/g, opt.data('help')); + row = row.replace(/##key##/g, shares); + row = row.replace(/##method##/g, opt.data('method')); + row = row.replace(/##field##/g, opt.data('field')); $(this).parents('.form-group').before(row); shares++; @@ -1131,10 +1222,10 @@ function init_feed_observers() { $('select[id="category"]').on('change', function() { var detail = $('#new_category_name').parent(); if ($(this).val() === 'nc') { - detail.show(); + detail.attr('aria-hidden', 'false').show(); detail.find('input').focus(); } else { - detail.hide(); + detail.attr('aria-hidden', 'true').hide(); } }); } @@ -1195,7 +1286,7 @@ function faviconNbUnread(n) { function init_slider_observers() { var slider = $('#slider'), - closer = $('#close-slider'); + closer = $('#close-slider'); if (slider.length < 1) { return; } @@ -1211,7 +1302,7 @@ function init_slider_observers() { $.ajax({ type: 'GET', url: url_slide, - data : { ajax: true } + data: { ajax: true } }).done(function (data) { slider.html(data); closer.addClass('active'); @@ -1229,30 +1320,99 @@ function init_slider_observers() { }); } -function init_all() { - if (!(window.$ && window.context)) { +function init_configuration_alert() { + $(window).on('submit', function(e) { + window.hasSubmit = true; + }); + $(window).on('beforeunload', function(e) { + if (window.hasSubmit) { + return; + } + var fields = $("[data-leave-validation]"); + for (var i = 0; i < fields.length; i++) { + if ($(fields[i]).attr('type') === 'checkbox' || $(fields[i]).attr('type') === 'radio') { + // The use of != is done on purpose to check boolean against integer + if ($(fields[i]).is(':checked') != $(fields[i]).attr('data-leave-validation')) { + return false; + } + } else { + if ($(fields[i]).attr('data-leave-validation') !== $(fields[i]).val()) { + return false; + } + } + } + return; + }); +} + +function init_subscription() { + $('body').on('click', '.bookmarkClick', function (e) { + return false; + }); +} + +function parseJsonVars() { + var jsonVars = document.getElementById('jsonVars'), + json = JSON.parse(jsonVars.innerHTML); + jsonVars.outerHTML = ''; + window.context = json.context; + window.shortcuts = json.shortcuts; + window.url = json.url; + window.i18n = json.i18n; + window.icons = json.icons; +} + +function init_normal() { + $stream = $('#stream'); + if ($stream.length < 1) { if (window.console) { - console.log('FreshRSS waiting for JS…'); + console.log('FreshRSS waiting for content…'); } - window.setTimeout(init_all, 50); + window.setTimeout(init_normal, 100); + return; + } + init_column_categories(); + init_stream($stream); + init_shortcuts(); + init_actualize(); + faviconNbUnread(); +} + +function init_beforeDOM() { + if (!window.$) { + if (window.console) { + console.log('FreshRSS waiting for jQuery…'); + } + window.setTimeout(init_beforeDOM, 100); + return; + } + if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) { + inject_script('jquery.sticky-kit.min.js'); + init_normal(); + } +} + +function init_afterDOM() { + if (!window.$) { + if (window.console) { + console.log('FreshRSS waiting again for jQuery…'); + } + window.setTimeout(init_afterDOM, 100); return; } init_notifications(); - init_confirm_action(); $stream = $('#stream'); if ($stream.length > 0) { - init_actualize(); - init_column_categories(); + init_confirm_action(); init_load_more($stream); init_posts(); - init_stream($stream); init_nav_entries(); - init_shortcuts(); - faviconNbUnread(); init_print_action(); + init_post_action(); init_notifs_html5(); window.setInterval(refreshUnreads, 120000); } else { + init_subscription(); init_crypto_form(); init_share_observers(); init_remove_observers(); @@ -1260,6 +1420,7 @@ function init_all() { init_password_observers(); init_stats_observers(); init_slider_observers(); + init_configuration_alert(); } if (window.console) { @@ -1267,16 +1428,16 @@ function init_all() { } } +parseJsonVars(); +init_beforeDOM(); //Can be called before DOM is fully loaded + if (document.readyState && document.readyState !== 'loading') { - if (window.console) { - console.log('FreshRSS immediate init…'); - } - init_all(); + init_afterDOM(); } else if (document.addEventListener) { document.addEventListener('DOMContentLoaded', function () { if (window.console) { console.log('FreshRSS waiting for DOMContentLoaded…'); } - init_all(); + init_afterDOM(); }, false); } diff --git a/p/scripts/persona.js b/p/scripts/persona.js deleted file mode 100644 index 36aeeaf56..000000000 --- a/p/scripts/persona.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -function init_persona() { - if (!(navigator.id && window.$)) { - if (window.console) { - console.log('FreshRSS (Persona) waiting for JS…'); - } - window.setTimeout(init_persona, 100); - return; - } - - $('a.signin').click(function() { - navigator.id.request(); - return false; - }); - - $('a.signout').click(function() { - navigator.id.logout(); - return false; - }); - - navigator.id.watch({ - loggedInUser: context['current_user_mail'], - - onlogin: function(assertion) { - // A user has logged in! Here you need to: - // 1. Send the assertion to your backend for verification and to create a session. - // 2. Update your UI. - $.ajax ({ - type: 'POST', - url: url['login'], - data: {assertion: assertion}, - success: function(res, status, xhr) { - if (res.status === 'failure') { - openNotification(res.reason, 'bad'); - } else if (res.status === 'okay') { - location.href = url['index']; - } - }, - error: function(res, status, xhr) { - // alert(res); - } - }); - }, - onlogout: function() { - // A user has logged out! Here you need to: - // Tear down the user's session by redirecting the user or making a call to your backend. - // Also, make sure loggedInUser will get set to null on the next page load. - // (That's a literal JavaScript null. Not false, 0, or undefined. null.) - $.ajax ({ - type: 'POST', - url: url['logout'], - success: function(res, status, xhr) { - location.href = url['index']; - }, - error: function(res, status, xhr) { - // alert(res); - } - }); - } - }); -} - -if (document.readyState && document.readyState !== 'loading') { - if (window.console) { - console.log('FreshRSS (Persona) immediate init…'); - } - init_persona(); -} else if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', function () { - if (window.console) { - console.log('FreshRSS (Persona) waiting for DOMContentLoaded…'); - } - init_persona(); - }, false); -} diff --git a/p/scripts/repartition.js b/p/scripts/repartition.js new file mode 100644 index 000000000..be70456fa --- /dev/null +++ b/p/scripts/repartition.js @@ -0,0 +1,72 @@ +"use strict"; +/* globals Flotr, numberFormat */ +/* jshint globalstrict: true */ + +function initStats() { + if (!window.Flotr) { + if (window.console) { + console.log('FreshRSS waiting for Flotr…'); + } + window.setTimeout(initStats, 50); + return; + } + var jsonRepartition = document.getElementById('jsonRepartition'), + stats = JSON.parse(jsonRepartition.innerHTML); + jsonRepartition.outerHTML = ''; + // Entry per hour + Flotr.draw(document.getElementById('statsEntryPerHour'), + [{ + data: stats.repartitionHour, + bars: {horizontal: false, show: true} + }], + { + grid: {verticalLines: false}, + xaxis: {noTicks: 23, + tickFormatter: function(x1) { + return 1 + parseInt(x1); + }, + min: -0.9, + max: 23.9, + tickDecimals: 0}, + yaxis: {min: 0}, + mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} + }); + // Entry per day of week + Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'), + [{ + data: stats.repartitionDayOfWeek, + bars: {horizontal: false, show: true} + }], + { + grid: {verticalLines: false}, + xaxis: {noTicks: 6, + tickFormatter: function(x2) { + return stats.days[parseInt(x2)]; + }, + min: -0.9, + max: 6.9, + tickDecimals: 0}, + yaxis: {min: 0}, + mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} + }); + // Entry per month + Flotr.draw(document.getElementById('statsEntryPerMonth'), + [{ + data: stats.repartitionMonth, + bars: {horizontal: false, show: true} + }], + { + grid: {verticalLines: false}, + xaxis: {noTicks: 12, + tickFormatter: function(x3) { + return stats.months[parseInt(x3) - 1]; + }, + min: 0.1, + max: 12.9, + tickDecimals: 0}, + yaxis: {min: 0}, + mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} + }); + +} +initStats(); diff --git a/p/scripts/stats.js b/p/scripts/stats.js new file mode 100644 index 000000000..9cd14721c --- /dev/null +++ b/p/scripts/stats.js @@ -0,0 +1,59 @@ +"use strict"; +/* globals Flotr, numberFormat */ +/* jshint globalstrict: true */ + +function initStats() { + if (!window.Flotr) { + if (window.console) { + console.log('FreshRSS waiting for Flotr…'); + } + window.setTimeout(initStats, 50); + return; + } + var jsonStats = document.getElementById('jsonStats'), + stats = JSON.parse(jsonStats.innerHTML); + jsonStats.outerHTML = ''; + // Entry per day + var avg = []; + for (var i = -31; i <= 0; i++) { + avg.push([i, stats.average]); + } + Flotr.draw(document.getElementById('statsEntryPerDay'), + [{ + data: stats.dataCount, + bars: {horizontal: false, show: true} + },{ + data: avg, + lines: {show: true}, + label: stats.average, + }], + { + grid: {verticalLines: false}, + xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25}, + 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'), + stats.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'), + stats.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(); diff --git a/p/themes/.htaccess b/p/themes/.htaccess new file mode 100644 index 000000000..bde718537 --- /dev/null +++ b/p/themes/.htaccess @@ -0,0 +1,21 @@ +<IfModule mod_mime.c> + AddType application/font-woff .woff + + AddCharset UTF-8 .css + AddCharset UTF-8 .svg +</IfModule> + +<IfModule mod_expires.c> + ExpiresActive on + ExpiresByType application/font-woff "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 text/css "access plus 1 month" +</IfModule> + +<IfModule mod_headers.c> + <FilesMatch "\.svg$"> + Header set Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline'" + </FilesMatch> +</IfModule> diff --git a/p/themes/BlueLagoon/BlueLagoon.css b/p/themes/BlueLagoon/BlueLagoon.css index ffb80ddb2..186258752 100644 --- a/p/themes/BlueLagoon/BlueLagoon.css +++ b/p/themes/BlueLagoon/BlueLagoon.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #fafafa; font-size: 92%; } @@ -349,7 +343,7 @@ a.btn { text-align: left; background: #222; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -368,23 +362,20 @@ a.btn { .dropdown-header { display:none; } -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; - color: #ccc; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; color: #ccc; + font-size: 0.8rem; } .dropdown-menu > .item:hover { background: linear-gradient(180deg, #0090FF 0%, #0062BE 100%) #E4992C; background: -webkit-linear-gradient(top, #0090FF 0%, #0062BE 100%); color: #fff; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -626,7 +617,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; right: 3px; padding: 1px 5px; @@ -646,7 +637,7 @@ a.btn { .feed.item.error > a { color: #BD362F; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -753,7 +744,7 @@ a.btn { border: 1px solid #CCC; box-shadow: 0px 1px #FFF; } -#panel > .nav_menu > #nav_menu_read_all > .dropdown > .btn.dropdown-toggle{ +#panel > .nav_menu > #nav_menu_read_all .dropdown > .btn.dropdown-toggle { border-radius: 0 4px 4px 0; border:none; border-left: solid 1px #ccc; @@ -988,7 +979,7 @@ opacity: 1; color: #222; font-weight: bold; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -1018,7 +1009,7 @@ opacity: 1; .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -1054,7 +1045,7 @@ opacity: 1; /*=== LOGS */ /*=========*/ -.logs { +.loglist { border: 1px solid #aaa; border-radius: 5px; overflow: hidden; diff --git a/p/themes/BlueLagoon/template.css b/p/themes/BlueLagoon/template.css index bf421e322..4bc0fb735 100644 --- a/p/themes/BlueLagoon/template.css +++ b/p/themes/BlueLagoon/template.css @@ -2,7 +2,7 @@ /*=== GENERAL */ /*============*/ -html, body { +html, body { margin: 0; padding: 0; font-size: 92%; @@ -79,6 +79,7 @@ textarea { input, select, textarea { display: inline-block; max-width: 100%; + font-size: 0.8rem; } input[type="radio"], input[type="checkbox"] { @@ -92,7 +93,7 @@ input.extend:focus { /*=== COMPONENTS */ /*===============*/ /*=== Forms */ -.form-group:after { +.form-group::after { content: ""; display: block; clear: both; @@ -184,7 +185,7 @@ a.btn { .dropdown-menu > .item > span { display: block; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { content: '✓'; } .dropdown-menu .input { @@ -315,7 +316,7 @@ a.btn { white-space: nowrap; text-overflow: ellipsis; } -.category .btn:not([data-unread="0"]):after { +.category .btn:not([data-unread="0"])::after { content: attr(data-unread); } @@ -334,7 +335,7 @@ a.btn { text-overflow: ellipsis; vertical-align: middle; } -.categories .feeds .feed:not([data-unread="0"]):before { +.categories .feeds .feed:not([data-unread="0"])::before { content: "(" attr(data-unread) ") "; } .categories .feeds .dropdown-menu { @@ -688,7 +689,7 @@ a.btn { .flux_content .content a { color: #000; } - .flux_content .content a:after { + .flux_content .content a::after { content: " [" attr(href) "] "; font-style: italic; } diff --git a/p/themes/Dark/dark.css b/p/themes/Dark/dark.css index cd2f85ebf..348b00009 100644 --- a/p/themes/Dark/dark.css +++ b/p/themes/Dark/dark.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #1c1c1c; color: #888; } @@ -312,7 +306,7 @@ a.btn { border: 1px solid #888; border-radius: 5px; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -334,20 +328,18 @@ a.btn { text-align: left; color: #888; } -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; + font-size: 0.8rem; } .dropdown-menu > .item:hover { background: #26303F; color: #888; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -551,7 +543,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; right: 0; margin: 10px 0; @@ -584,7 +576,7 @@ a.btn { .feed.item.error.active > a { color: #fff; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -810,7 +802,7 @@ a.btn { /*=== "Load more" part */ #bigMarkAsRead { text-align: center; - text-decoration: none; + text-decoration: none; } #bigMarkAsRead:hover { background: #111; @@ -858,7 +850,7 @@ a.btn { color: #fff; font-weight: bold; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -894,7 +886,7 @@ a.btn { .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -928,7 +920,7 @@ a.btn { /*=== LOGS */ /*=========*/ -.logs { +.loglist { overflow: hidden; border: 1px solid #333; } diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index 42b73bae2..62c4808a4 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #fafafa; } @@ -102,7 +96,7 @@ form th { border: 1px solid transparent; border-radius: 3px; } -.form-group:after { +.form-group::after { content: ""; display: block; clear: both; @@ -312,7 +306,7 @@ a.btn { border: 1px solid #95a5a6; border-radius: 3px; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -334,20 +328,18 @@ a.btn { text-align: left; color: #34495e; } -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; + font-size: 0.8rem; } .dropdown-menu > .item:hover { background: #2980b9; color: #fff; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -557,7 +549,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; right: 0; margin: 10px 0; @@ -588,7 +580,7 @@ a.btn { .feed.item.error.active > a { color: #fff; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -864,7 +856,7 @@ a.btn { font-weight: bold; color: #fff; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -887,7 +879,7 @@ a.btn { .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -921,7 +913,7 @@ a.btn { /*=== LOGS */ /*=========*/ -.logs { +.loglist { overflow: hidden; border: 1px solid #aaa; } diff --git a/p/themes/Origine-compact/loader.gif b/p/themes/Origine-compact/loader.gif Binary files differnew file mode 100644 index 000000000..5ff26f0e3 --- /dev/null +++ b/p/themes/Origine-compact/loader.gif diff --git a/p/themes/Origine-compact/metadata.json b/p/themes/Origine-compact/metadata.json new file mode 100644 index 000000000..eba82defd --- /dev/null +++ b/p/themes/Origine-compact/metadata.json @@ -0,0 +1,7 @@ +{ + "name": "Origine-compact", + "author": "Kevin Papst", + "description": "A theme that tries to use the screen size more efficiently, based on Origine", + "version": 0.1, + "files": ["_template.css", "origine-compact.css"] +} diff --git a/p/themes/Origine-compact/origine-compact.css b/p/themes/Origine-compact/origine-compact.css new file mode 100644 index 000000000..8447e2486 --- /dev/null +++ b/p/themes/Origine-compact/origine-compact.css @@ -0,0 +1,1087 @@ +@charset "UTF-8"; + +/*=== FONTS */ +@font-face { + font-family: "OpenSans"; + src: url("../fonts/openSans.woff") format("woff"); +} + +/*=== GENERAL */ +/*============*/ +html, body { + height: 100%; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; + background: #fafafa; +} + +/*=== Links */ +a, button.as-link { + color: #0062be; + outline: none; +} + +/*=== Forms */ +legend { + margin: 20px 0 5px; + padding: 5px 0; + border-bottom: 1px solid #ddd; + font-size: 1.4em; +} +label { + min-height: 25px; + padding: 5px 0; + cursor: pointer; +} +textarea { + width: 360px; + height: 100px; +} +input, select, textarea { + min-height: 25px; + padding: 3px 5px 2px 5px; + background: #fdfdfd; + border: 1px solid #bbb; + border-radius: 3px; + color: #666; + line-height: 25px; + vertical-align: middle; + box-shadow: 0 2px 2px #eee inset; +} +option { + padding: 0 .5em; +} +input:focus, select:focus, textarea:focus { + color: #0062be; + border-color: #33bbff; + box-shadow: 0 2px 2px #ddddff inset; +} +input:invalid, select:invalid { + border-color: #f00; + box-shadow: 0 0 2px 2px #fdd inset; +} +input:disabled, select:disabled { + background: #eee; +} +input.extend { + transition: width 200ms linear; + -moz-transition: width 200ms linear; + -webkit-transition: width 200ms linear; + -o-transition: width 200ms linear; + -ms-transition: width 200ms linear; +} + +/*=== Tables */ +table { + border-collapse: collapse; +} + +tr, th, td { + padding: 0.5em; + border: 1px solid #ddd; +} +th { + background: #f6f6f6; +} +form td, +form th { + font-weight: normal; + text-align: center; +} + +/*=== COMPONENTS */ +/*===============*/ +/*=== Forms */ +.form-group.form-actions { + padding: 5px 0; + background: #f4f4f4; + border-top: 1px solid #ddd; +} +.form-group.form-actions .btn { + margin: 0 10px; +} +.form-group .group-name { + padding: 10px 0; + text-align: right; +} +.form-group .group-controls { + min-height: 25px; + padding: 8px 0; +} +.form-group table { + margin: 10px 0 0 220px; +} + +/*=== Buttons */ +.stick { + vertical-align: middle; + font-size: 0; +} +.stick input, +.stick .btn { + border-radius: 0; +} +.stick .btn:first-child, +.stick input:first-child { + border-radius: 3px 0 0 3px; +} +.stick .btn-important:first-child { + border-right: 1px solid #06f; +} +.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 input + .btn { + border-top: 1px solid #bbb; +} +.stick .btn + .dropdown > .btn { + border-left: none; + border-radius: 0 3px 3px 0; +} + +.btn { + display: inline-block; + min-height: 32px; + min-width: 15px; + margin: 0; + padding: 5px 10px; + background: #fff; + background: linear-gradient(to bottom, #fff 0%, #eee 100%); + background: -moz-linear-gradient(top, #fff 0%, #eee 100%); + background: -webkit-linear-gradient(top, #fff 0%, #eee 100%); + background: -o-linear-gradient(top, #fff 0%, #eee 100%); + background: -ms-linear-gradient(top, #fff 0%, #eee 100%); + border-radius: 3px; + border: 1px solid #ddd; + border-bottom: 1px solid #aaa; + border-right: 1px solid #aaa; + color: #666; + text-shadow: 0px -1px 0 #ddd; + font-size: 0.9rem; + vertical-align: middle; + cursor: pointer; + overflow: hidden; +} +a.btn { + min-height: 20px; + line-height: 20px; +} +.btn:hover { + background: #f0f0f0; + background: linear-gradient(to bottom, #f8f8f8, #f0f0f0); + background: -moz-linear-gradient(top, #f8f8f8 0%, #f0f0f0 100%); + background: -webkit-linear-gradient(top, #f8f8f8 0%, #f0f0f0 100%); + background: -o-linear-gradient(top, #f8f8f8 0%, #f0f0f0 100%); + background: -ms-linear-gradient(top, #f8f8f8 0%, #f0f0f0 100%); + text-decoration: none; +} +.btn.active, +.btn:active, +.dropdown-target:target ~ .btn.dropdown-toggle { + box-shadow: 0px 2px 4px #e0e0e0 inset, 0px 1px 2px #fafafa; + background: #eee; +} + +.btn-important { + background: #0084CC; + background: linear-gradient(to bottom, #0084CC, #0045CC); + background: -moz-linear-gradient(top, #0084CC 0%, #0045CC 100%); + background: -webkit-linear-gradient(top, #0084CC 0%, #0045CC 100%); + background: -o-linear-gradient(top, #0084CC 0%, #0045CC 100%); + background: -ms-linear-gradient(top, #0084CC 0%, #0045CC 100%); + color: #fff; + border: 1px solid #0062B7; + text-shadow: 0px -1px 0 #aaa; + font-weight: normal; +} +.btn-important:hover { + background: linear-gradient(to bottom, #0066CC, #0045CC); + background: -moz-linear-gradient(top, #0066CC 0%, #0045CC 100%); + background: -webkit-linear-gradient(top, #0066CC 0%, #0045CC 100%); + background: -o-linear-gradient(top, #0066CC 0%, #0045CC 100%); + background: -ms-linear-gradient(top, #0066CC 0%, #0045CC 100%); +} +.btn-important:active { + background: #0044CB; + box-shadow: none; +} + +.btn-attention { + background: #E95B57; + background: linear-gradient(to bottom, #E95B57, #BD362F); + background: -moz-linear-gradient(top, #E95B57 0%, #BD362F 100%); + background: -webkit-linear-gradient(top, #E95B57 0%, #BD362F 100%); + background: -o-linear-gradient(top, #E95B57 0%, #BD362F 100%); + background: -ms-linear-gradient(top, #E95B57 0%, #BD362F 100%); + color: #fff; + border: 1px solid #C44742; + text-shadow: 0px -1px 0px #666; +} +.btn-attention:hover { + background: linear-gradient(to bottom, #D14641, #BD362F); + background: -moz-linear-gradient(top, #D14641 0%, #BD362F 100%); + background: -webkit-linear-gradient(top, #D14641 0%, #BD362F 100%); + background: -o-linear-gradient(top, #D14641 0%, #BD362F 100%); + background: -ms-linear-gradient(top, #D14641 0%, #BD362F 100%); +} +.btn-attention:active { + background: #BD362F; + box-shadow: none; +} + +/*=== Navigation */ +.nav-list .nav-header, +.nav-list .item { + height: 2.5em; + line-height: 2.5em; + font-size: 0.9rem; +} +.nav-list .item:hover { + background: #fafafa; +} +.nav-list .item:hover a { + color: #003388; +} +.nav-list .item.active { + background: #0062BE; + color: #fff; +} +.nav-list .item.active a { + color: #fff; +} +.nav-list .disable { + color: #aaa; + background: #fafafa; + text-align: center; +} +.nav-list .item > a { + padding: 0 10px; +} +.nav-list a:hover { + text-decoration: none; +} +.nav-list .item.empty a { + color: #f39c12; +} +.nav-list .item.active.empty a { + color: #fff; + background: #f39c12; +} +.nav-list .item.error a { + color: #BD362F; +} +.nav-list .item.active.error a { + color: #fff; + background: #BD362F; +} + +.nav-list .nav-header { + padding: 0 10px; + color: #888; + background: #f4f4f4; + border-bottom: 1px solid #ddd; + font-weight: bold; + text-shadow: 0 0 1px #ddd; +} + +.nav-list .nav-form { + padding: 3px; + text-align: center; +} + +.nav-head { + margin: 0; + background: #fff; + background: linear-gradient(to bottom, #fff, #f0f0f0); + background: -moz-linear-gradient(top, #fff 0%, #f0f0f0 100%); + background: -webkit-linear-gradient(top, #fff 0%, #f0f0f0 100%); + background: -o-linear-gradient(top, #fff 0%, #f0f0f0 100%); + background: -ms-linear-gradient(top, #fff 0%, #f0f0f0 100%); + border-bottom: 1px solid #ddd; + text-align: right; +} +.nav-head .item { + padding: 5px 10px; + font-size: 0.9rem; + line-height: 1.5rem; +} + +/*=== Horizontal-list */ +.horizontal-list { + margin: 0; + padding: 0; + font-size: 0.9rem; +} +.horizontal-list .item { + vertical-align: middle; + line-height: 30px; +} + +/*=== Dropdown */ +.dropdown-menu { + margin: 5px 0 0; + padding: 5px 0; + border: 1px solid #ddd; + border-radius: 5px; + box-shadow: 3px 3px 3px #ddd; + font-size: 0.8rem; + text-align: left; +} +.dropdown-menu::after { + content: ""; + position: absolute; + top: -6px; + right: 13px; + width: 10px; + height: 10px; + background: #fff; + border-top: 1px solid #ddd; + border-left: 1px solid #ddd; + z-index: -10; + transform: rotate(45deg); + -moz-transform: rotate(45deg); + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); +} +.dropdown-header { + padding: 0 5px 5px; + color: #888; + font-weight: bold; + text-align: left; +} +.dropdown-menu > .item > a, +.dropdown-menu > .item > span, +.dropdown-menu > .item > .as-link { + padding: 0 22px; + line-height: 2.5em; + font-size: 0.8rem; +} +.dropdown-menu > .item:hover { + background: #0062BE; + color: #fff; +} +.dropdown-menu > .item[aria-checked="true"] > a::before { + font-weight: bold; + margin: 0 0 0 -14px; +} +.dropdown-menu > .item:hover > a { + color: #fff; + text-decoration: none; +} +.dropdown-menu .input select, +.dropdown-menu .input input { + margin: 0 auto 5px; + padding: 2px 5px; + border-radius: 3px; +} + +.separator { + margin: 5px 0; + border-bottom: 1px solid #ddd; +} + +/*=== Alerts */ +.alert { + margin: 15px auto; + padding: 10px 15px; + background: #f4f4f4; + border: 1px solid #ccc; + border-right: 1px solid #aaa; + border-bottom: 1px solid #aaa; + border-radius: 5px; + color: #aaa; + text-shadow: 0 0 1px #eee; + font-size: 0.9em; +} +.alert-head { + font-size: 1.15em; +} +.alert > a { + color: inherit; + text-decoration: underline; +} +.alert-warn { + background: #ffe; + border: 1px solid #eeb; + color: #c95; +} +.alert-success { + background: #dfd; + border: 1px solid #cec; + color: #484; +} +.alert-error { + background: #fdd; + border: 1px solid #ecc; + color: #844; +} + +/*=== Pagination */ +.pagination { + background: #fafafa; + text-align: center; + color: #333; + font-size: 0.8em; +} +.content .pagination { + margin: 0; + padding: 0; +} +.pagination .item.pager-current { + font-weight: bold; + font-size: 1.5em; +} +.pagination .item a { + display: block; + color: #333; + font-style: italic; + line-height: 3em; + text-decoration: none; +} +.pagination .item a:hover { + background: #ddd; +} +.pagination:first-child .item { + border-bottom: 1px solid #aaa; +} +.pagination:last-child .item { + border-top: 1px solid #aaa; +} + +.pagination .loading, +.pagination a:hover.loading { + background: url("loader.gif") center center no-repeat #fff; + font-size: 0; +} + +/*=== Boxes */ +.box { + background: #fff; + border-radius: 5px; + box-shadow: 0 0 3px #bbb; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: #f6f6f6; + border-bottom: 1px solid #ddd; + border-radius: 5px 5px 0 0; +} +.box .box-content { + min-height: 2.5em; + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + +/*=== Tree */ +.tree { + margin: 10px 0; +} +.tree-folder-title { + position: relative; + padding: 0 5px; + background: #fff; + line-height: 2rem; + font-size: 0.9rem; +} +.tree-folder-title .title { + background: inherit; + color: #444; +} +.tree-folder-title .title:hover { + text-decoration: none; +} +.tree-folder.active .tree-folder-title { + background: #f0f0f0; + font-weight: bold; +} +.tree-folder.active .tree-folder-title .title { + color: #0062BE; +} +.tree-folder-items { + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; + background: #f6f6f6; +} +.tree-folder-items > .item { + padding: 0 10px; + line-height: 2.2rem; + font-size: 0.8rem; +} +.tree-folder-items > .item.active { + background: #0062be; +} +.tree-folder-items > .item > a { + text-decoration: none; +} +.tree-folder-items > .item.active > a { + color: #fff; +} + +/*=== STRUCTURE */ +/*===============*/ +/*=== Header */ +.header { + height: 40px; + background: #f4f4f4; +} +.header > .item { + padding: 0px; + border-bottom: 1px solid #aaa; + vertical-align: middle; + text-align: center; +} +.header > .item.title{ + width: 230px; +} +.header > .item.title h1 { + margin: 0; + font-size: 1em; +} +.header > .item.title h1 a { + text-decoration: none; +} +.header .item.configure .btn, +.header .item.search .btn { + min-height: 18px; + padding: 4px 10px; + line-height: 18px; +} +.header > .item.title .logo { + height: 25px; + width: 25px; +} + +.header > .item.search input { + width: 230px; + padding: 1px 5px 0px 5px; +} +.header .item.search input:focus { + width: 350px; +} + +/*=== Body */ +#global { + height: calc(100% - 85px); +} +.aside { + border-right: 1px solid #aaa; + background: #fff; +} +.aside.aside_feed { + padding: 10px 0; + text-align: center; + background: #fff; +} +.aside.aside_feed .tree { + margin: 10px 0 50px; +} + +/*=== Aside main page (categories) */ +.aside_feed .category .title:not([data-unread="0"])::after { + position: absolute; + right: 0; + margin: 10px 0; + padding: 0 10px; + font-size: 0.8rem; + line-height: 0.9rem; + background: inherit; +} + +/*=== Aside main page (feeds) */ +.feed.item.empty.active { + background: #e67e22; +} +.feed.item.error.active { + background: #bd362f; +} +.feed.item.empty, +.feed.item.empty > a { + color: #e67e22; +} +.feed.item.error, +.feed.item.error > a { + color: #bd362f; +} +.feed.item.empty.active, +.feed.item.error.active, +.feed.item.empty.active > a, +.feed.item.error.active > a { + color: #fff; +} +.aside_feed .tree-folder-items .dropdown-menu::after { + left: 2px; +} +.aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, +.aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { + background-color: #fff; + border-radius: 3px; +} + +/*=== Configuration pages */ +.post { + padding: 10px 50px; + font-size: 0.9em; +} +.post form { + margin: 10px 0; +} +.post.content { + max-width: 550px; +} + +/*=== Prompt (centered) */ +.prompt { + text-align: center; +} +.prompt label { + text-align: left; +} +.prompt form { + margin: 10px auto 20px auto; + width: 200px; +} +.prompt input { + margin: 5px auto; + width: 100%; +} +.prompt p { + margin: 20px 0; +} + +/*=== New article notification */ +#new-article { + background: #0084CC; + text-align: center; + font-size: 0.9em; +} +#new-article:hover { + background: #0066CC; +} +#new-article > a { + line-height: 3em; + color: #fff; + font-weight: bold; +} +#new-article > a:hover { + text-decoration: none; +} + +/*=== Day indication */ +.day { + font-size: 0.9rem; + padding: 0 10px; + font-weight: bold; + line-height: 2em; + background: #fff; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} +#new-article + .day { + border-top: none; +} +.day .name { + padding: 0 10px 0 0; + color: #aab; + font-size: 1em; + opacity: 0.6; + font-style: italic; + text-align: right; +} + +/*=== Index menu */ +.nav_menu { + background: #fafafa; + border-bottom: 1px solid #aaa; + text-align: center; + padding: 5px 0; +} + +/*=== Feed articles */ +.flux { + border-left: 2px solid #aaa; + background: #fafafa; +} +.flux:hover { + background: #fff; +} +.flux.current { + border-left: 2px solid #0062BE; +} +.flux.not_read { + border-left: 2px solid #FF5300; + background: #FFF3ED; +} +.flux.not_read:not(.current):hover .item.title { + background: #FFF3ED; +} +.flux.favorite { + border-left: 2px solid #FFC300; + background: #FFF6DA; +} +.flux.favorite:not(.current):hover .item.title { + background: #FFF6DA; +} +.flux.current { + background: #fff; +} + + +.flux_header { + border-top: 1px solid #ddd; + font-size: 0.8rem; + cursor: pointer; +} +.flux_header .title { + font-size: 0.8rem; +} +.flux .website .favicon { + padding: 5px; +} +.flux .date { + color: #666; + font-size: 0.7rem; +} + +.flux .bottom { + font-size: 0.8rem; + text-align: center; +} + +/*=== Content of feed articles */ +.content { + padding: 10px 10px; +} +#stream.normal .content > h1.title { + display:none; +} +.content > h1.title > a { + color: #000; +} + +.content hr { + margin: 30px 10px; + height: 1px; + background: #ddd; + border: 0; + box-shadow: 0 2px 5px #ccc; +} + +.content pre { + margin: 10px auto; + padding: 10px 20px; + overflow: auto; + background: #222; + color: #fff; + font-size: 0.9rem; + border-radius: 3px; +} +.content code { + padding: 2px 5px; + color: #dd1144; + background: #fafafa; + border: 1px solid #eee; + border-radius: 3px; +} +.content pre code { + background: transparent; + color: #fff; + border: none; +} + +.content blockquote { + display: block; + margin: 0; + padding: 5px 20px; + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + background: #fafafa; + color: #333; +} +.content blockquote p { + margin: 0; +} + +/*=== Notification and actualize notification */ +.notification { + padding: 0 0 0 5px; + text-align: center; + border: 1px solid #eeb; + border-radius: 3px; + box-shadow: 0 0 5px #ddd; + font-weight: bold; + font-size: 0.9em; + line-height: 3em; + z-index: 10; + vertical-align: middle; +} +.notification.good { + background: #ffe; + border: 1px solid #eeb; + color: #c95; +} +.notification.bad { + background: #fdd; + border: 1px solid #ecc; + color: #844; +} +.notification a.close { + padding: 0 15px; + line-height: 3em; +} +.notification.good a.close:hover { + background: #eeb; +} +.notification.bad a.close:hover { + background: #ecc; +} + +.notification#actualizeProgress { + line-height: 2em; +} + +/*=== "Load more" part */ +#bigMarkAsRead { + text-align: center; + text-decoration: none; + color: #666; + background: #fafafa; + font-size: 1.2em; +} +#bigMarkAsRead:hover { + color: #0062be; + background: #fff; + box-shadow: 0 -5px 10px #eee inset; +} +#bigMarkAsRead .bigTick { + font-size: 3em; +} +#bigMarkAsRead:hover .bigTick { + text-shadow: 0 0 5px #0062be; +} + +/*=== Navigation menu (for articles) */ +#nav_entries { + margin: 0; + background: #fff; + border-top: 1px solid #ddd; + text-align: center; + line-height: 2.2em; + table-layout: fixed; +} + +/*=== READER VIEW */ +/*================*/ +#stream.reader .flux { + padding: 0 0 50px; + border: none; + background: #f0f0f0; + color: #333; +} +#stream.reader .flux .author { + margin: 0 0 10px; + font-size: 90%; + color: #666; +} + +/*=== GLOBAL VIEW */ +/*================*/ +.box.category .box-title .title { + font-weight: normal; + text-decoration: none; + text-align: left; +} +.box.category:not([data-unread="0"]) .box-title { + background: #0084CC; +} +.box.category:not([data-unread="0"]) .box-title:active { + background: #3498db; +} +.box.category:not([data-unread="0"]) .box-title .title { + color: #fff; + font-weight: bold; +} +.box.category .title:not([data-unread="0"])::after { + position: absolute; + top: 5px; right: 10px; + border: 0; + background: none; + color: #fff; + font-weight: bold; + box-shadow: none; + text-shadow: none; +} +.box.category .item.feed { + padding: 2px 10px; + font-size: 0.8rem; +} + +/*=== DIVERS */ +/*===========*/ +.aside.aside_feed .nav-form input, +.aside.aside_feed .nav-form select { + width: 140px; +} +.aside.aside_feed .nav-form .dropdown .dropdown-menu { + right: -20px; +} +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { + right: 33px; +} + +/*=== STATISTICS */ +/*===============*/ +.stat { + margin: 10px 0 20px; +} + +.stat th, +.stat td, +.stat tr { + border: none; +} +.stat > table td, +.stat > table th { + border-bottom: 1px solid #ddd; +} + +.stat > .horizontal-list { + margin: 0 0 5px; +} +.stat > .horizontal-list .item { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.stat > .horizontal-list .item:first-child { + width: 270px; +} + +/*=== LOGS */ +/*=========*/ +.loglist { + border: 1px solid #aaa; + border-radius: 5px; + overflow: hidden; +} +.log { + padding: 5px 10px; + background: #fafafa; + color: #333; + font-size: 0.8rem; +} +.log+.log { + border-top: 1px solid #aaa; +} +.log .date { + display: block; + font-weight: bold; +} +.log.error { + background: #fdd; + color: #844; +} +.log.warning { + background: #ffe; + color: #c95; +} +.log.notice { + background: #f4f4f4; + color: #aaa; +} +.log.debug { + background: #333; + color: #eee; +} + +/*=== MOBILE */ +/*===========*/ +@media(max-width: 840px) { + .aside { + box-shadow: 3px 0 3px #aaa; + transition: width 200ms linear; + -moz-transition: width 200ms linear; + -webkit-transition: width 200ms linear; + -o-transition: width 200ms linear; + -ms-transition: width 200ms linear; + } + .aside .toggle_aside, + #panel .close { + display: block; + width: 100%; + height: 50px; + line-height: 50px; + text-align: center; + background: #f6f6f6; + border-bottom: 1px solid #ddd; + } + + .aside.aside_feed { + padding: 0; + } + + .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; + } + + .day .name { + font-size: 1.1rem; + text-shadow: none; + } + + .pagination { + margin: 0 0 3.5em; + } + + .notification a.close { + display: block; + left: 0; + background: transparent; + } + .notification a.close:hover { + opacity: 0.5; + } + .notification a.close .icon { + display: none; + } +} diff --git a/p/themes/Origine-compact/thumbs/original.png b/p/themes/Origine-compact/thumbs/original.png Binary files differnew file mode 100644 index 000000000..b5f18fd43 --- /dev/null +++ b/p/themes/Origine-compact/thumbs/original.png diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index 18df4468a..4a697e811 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #fafafa; } @@ -336,7 +330,7 @@ a.btn { font-size: 0.8rem; text-align: left; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -358,22 +352,18 @@ a.btn { font-weight: bold; text-align: left; } -.dropdown-menu > .item { -} -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; + font-size: 0.8rem; } .dropdown-menu > .item:hover { background: #0062BE; color: #fff; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -591,7 +581,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .category .title:not([data-unread="0"]):after { +.aside_feed .category .title:not([data-unread="0"])::after { position: absolute; right: 0; margin: 10px 0; @@ -622,7 +612,7 @@ a.btn { .feed.item.error.active > a { color: #fff; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -853,7 +843,7 @@ a.btn { /*=== "Load more" part */ #bigMarkAsRead { text-align: center; - text-decoration: none; + text-decoration: none; text-shadow: 0 -1px 0 #aaa; color: #666; background: #fafafa; @@ -908,7 +898,7 @@ a.btn { color: #fff; font-weight: bold; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -932,7 +922,7 @@ a.btn { .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -966,7 +956,7 @@ a.btn { /*=== LOGS */ /*=========*/ -.logs { +.loglist { border: 1px solid #aaa; border-radius: 5px; overflow: hidden; diff --git a/p/themes/Pafat/pafat.css b/p/themes/Pafat/pafat.css index 61e5c8f63..1b6ebca29 100644 --- a/p/themes/Pafat/pafat.css +++ b/p/themes/Pafat/pafat.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #fafafa; color : #666; } @@ -48,9 +42,6 @@ input, select, textarea { vertical-align: middle; } -select{ - height:29px; -} option { padding: 0 .5em; } @@ -149,8 +140,8 @@ form th { .stick .dropdown + .dropdown > .btn { border-left: none; -} - +} + .stick .btn + .dropdown > .btn { border-left: none; border-radius: 0 3px 3px 0; @@ -319,7 +310,7 @@ a.btn { font-size: 0.8rem; text-align: left; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -341,20 +332,13 @@ a.btn { font-weight: bold; text-align: left; } -.dropdown-menu > .item { -} - -.dropdown-menu > .item > a { - padding: 0 22px; - line-height: 2.5em; - color: #666; - font-size: 0.8rem; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; + color: #666; font-size: 0.8rem; } @@ -362,7 +346,7 @@ a.btn { background: #eee; color: #666; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -553,7 +537,7 @@ a.btn { text-decoration: none; color : #C5C6CA; } - + .header > .item.search input { width: 230px; height : 29px; @@ -590,7 +574,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; top: 0.25rem; right: 3px; padding: 0px 5px; @@ -633,7 +617,7 @@ a.btn { .feed.item.error.active > a { color: #fff; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -864,7 +848,7 @@ a.btn { /*=== "Load more" part */ #bigMarkAsRead { text-align: center; - text-decoration: none; + text-decoration: none; color: #666; background: #fafafa; } @@ -918,7 +902,7 @@ a.btn { font-weight: bold; color: #fff; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -943,7 +927,7 @@ a.btn { .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -977,7 +961,7 @@ a.btn { /*=== LOGS */ /*=========*/ -.logs { +.loglist { border: 1px solid #aaa; border-radius: 5px; overflow: hidden; @@ -1079,4 +1063,4 @@ a.btn { .notification a.close .icon { display: none; } -}
\ No newline at end of file +} diff --git a/p/themes/Screwdriver/screwdriver.css b/p/themes/Screwdriver/screwdriver.css index a43d1801c..969695f13 100644 --- a/p/themes/Screwdriver/screwdriver.css +++ b/p/themes/Screwdriver/screwdriver.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; background: #fafafa; font-size: 92%; } @@ -349,7 +343,7 @@ a.btn { text-align: left; background: #222; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -368,24 +362,19 @@ a.btn { .dropdown-header { display:none; } -.dropdown-menu > .item { -} -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; - color: #ccc; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; color: #ccc; + font-size: 0.8rem; } .dropdown-menu > .item:hover { background: #171717; color: #fff; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -621,7 +610,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; right: 3px; padding: 1px 5px; @@ -641,7 +630,7 @@ a.btn { .feed.item.error > a { color: #BD362F; } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -748,7 +737,7 @@ a.btn { border: 1px solid #CCC; box-shadow: 0px 1px #FFF; } -#panel > .nav_menu > #nav_menu_read_all > .dropdown > .btn.dropdown-toggle{ +#panel > .nav_menu > #nav_menu_read_all .dropdown > .btn.dropdown-toggle { border-radius: 0 4px 4px 0; border:none; border-left: solid 1px #ccc; @@ -986,7 +975,7 @@ opacity: 1; color: #222; font-weight: bold; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -1016,7 +1005,7 @@ opacity: 1; .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -1052,7 +1041,7 @@ opacity: 1; /*=== LOGS */ /*=========*/ -.logs { +.loglist { border: 1px solid #aaa; border-radius: 5px; overflow: hidden; diff --git a/p/themes/base-theme/README.md b/p/themes/base-theme/README.md index 9f7d635ca..632d11d05 100644 --- a/p/themes/base-theme/README.md +++ b/p/themes/base-theme/README.md @@ -1,7 +1,7 @@ FreshRSS-base-theme =================== -A base theme for [FreshRSS](http://freshrss.org) +A base theme for [FreshRSS](https://freshrss.org) 1. Custom ```base.css``` file with colors, backgrounds and borders 2. Change information in ```metadata.json``` file (at least, give a name!) diff --git a/p/themes/base-theme/base.css b/p/themes/base-theme/base.css index f874d554c..e265cd7ff 100644 --- a/p/themes/base-theme/base.css +++ b/p/themes/base-theme/base.css @@ -1,16 +1,10 @@ @charset "UTF-8"; -/*=== FONTS */ -@font-face { - font-family: "OpenSans"; - src: url("../fonts/openSans.woff") format("woff"); -} - /*=== GENERAL */ /*============*/ html, body { height: 100%; - font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; } /*=== Links */ @@ -231,7 +225,7 @@ a.btn { font-size: 0.8rem; text-align: left; } -.dropdown-menu:after { +.dropdown-menu::after { content: ""; position: absolute; top: -6px; @@ -251,18 +245,15 @@ a.btn { } .dropdown-menu > .item { } -.dropdown-menu > .item > a { - padding: 0 25px; - line-height: 2.5em; -} +.dropdown-menu > .item > a, .dropdown-menu > .item > span, .dropdown-menu > .item > .as-link { padding: 0 22px; - line-height: 2em; + line-height: 2.5em; } .dropdown-menu > .item:hover { } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { font-weight: bold; margin: 0 0 0 -14px; } @@ -431,7 +422,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .tree-folder-title > .title:not([data-unread="0"])::after { position: absolute; right: 0; margin: 10px 0; @@ -456,7 +447,7 @@ a.btn { .feed.item.empty.active > a, .feed.item.error.active > a { } -.aside_feed .tree-folder-items .dropdown-menu:after { +.aside_feed .tree-folder-items .dropdown-menu::after { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, @@ -675,7 +666,7 @@ a.btn { .box.category:not([data-unread="0"]) .box-title .title { font-weight: bold; } -.box.category .title:not([data-unread="0"]):after { +.box.category .title:not([data-unread="0"])::after { position: absolute; top: 5px; right: 10px; border: 0; @@ -698,7 +689,7 @@ a.btn { .aside.aside_feed .nav-form .dropdown .dropdown-menu { right: -20px; } -.aside.aside_feed .nav-form .dropdown .dropdown-menu:after { +.aside.aside_feed .nav-form .dropdown .dropdown-menu::after { right: 33px; } @@ -731,7 +722,7 @@ a.btn { /*=== LOGS */ /*=========*/ -.logs { +.loglist { overflow: hidden; } .log { diff --git a/p/themes/base-theme/loader.gif b/p/themes/base-theme/loader.gif Binary files differnew file mode 100644 index 000000000..5ff26f0e3 --- /dev/null +++ b/p/themes/base-theme/loader.gif diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index a299a5ddf..e5e1bca05 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -2,9 +2,19 @@ /*=== GENERAL */ /*============*/ +@font-face { + font-family: 'OpenSans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans'), local('OpenSans'), + url('../fonts/OpenSans.woff2') format('woff2'), + url('../fonts/OpenSans.woff') format('woff'); +} + html, body { margin: 0; padding: 0; + font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", sans-serif; font-size: 100%; } @@ -44,6 +54,12 @@ p { margin: 1em 0 0.5em; font-size: 1em; } +sup { + line-height: 25px; + position: relative; + top: -0.8em; + vertical-align: baseline; +} /*=== Images */ img { @@ -82,6 +98,7 @@ input.extend:focus { input, select, textarea { display: inline-block; max-width: 100%; + font-size: 0.8rem; } input[type="radio"], input[type="checkbox"] { @@ -110,8 +127,13 @@ td.numeric { /*=== COMPONENTS */ /*===============*/ + +[aria-hidden="true"] { + display: none; +} + /*=== Forms */ -.form-group:after { +.form-group::after { content: ""; display: block; clear: both; @@ -206,7 +228,7 @@ a.btn { display: block; min-width: 200px; } -.dropdown-menu > .item[aria-checked="true"] > a:before { +.dropdown-menu > .item[aria-checked="true"] > a::before { content: '✓'; } .dropdown-menu .input { @@ -334,10 +356,15 @@ a.btn { /*=== Tree */ .tree { margin: 0; - padding: 0; + padding: 0 0 2em 0; list-style: none; text-align: left; } + +.treepadding { + padding: 0 0 15em 0; +} + .tree-folder-items { padding: 0; list-style: none; @@ -620,6 +647,9 @@ br + br + br { .stat > table { width: 100%; } +.statGraph { + height: 300px; +} /*=== GLOBAL VIEW */ /*================*/ @@ -773,10 +803,14 @@ input:checked + .slide-container .properties { /*=== DIVERS */ /*===========*/ -.category .title:not([data-unread="0"]):after { +.category .title:not([data-unread="0"])::after { content: attr(data-unread); } -.feed .item-title:not([data-unread="0"]):before { +.category .title.error::before { + content: "⚠ "; + color: #bd362f; +} +.feed .item-title:not([data-unread="0"])::before { content: "(" attr(data-unread) ") "; } .feed .item-title:not([data-unread="0"]) { @@ -795,6 +829,10 @@ input:checked + .slide-container .properties { display: none; } +.enclosure > [download] { + font-size: xx-large; + margin-left: .8em; +} /*=== MOBILE */ /*===========*/ @@ -807,6 +845,15 @@ input:checked + .slide-container .properties { .no-mobile { display: none; } + .dropdown .dropdown-menu { + border-radius: 0; + bottom: 0; + position: fixed; + width: 100%; + } + .dropdown-menu::after { + display: none; + } .aside .toggle_aside, .nav-login { display: block; @@ -889,7 +936,7 @@ input:checked + .slide-container .properties { .flux_content .content a { color: #000; } - .flux_content .content a:after { + .flux_content .content a::after { content: " [" attr(href) "] "; font-style: italic; } diff --git a/p/themes/fonts/OpenSans.woff b/p/themes/fonts/OpenSans.woff Binary files differnew file mode 100644 index 000000000..9a96e3baf --- /dev/null +++ b/p/themes/fonts/OpenSans.woff diff --git a/p/themes/fonts/OpenSans.woff2 b/p/themes/fonts/OpenSans.woff2 Binary files differnew file mode 100644 index 000000000..0964c7c46 --- /dev/null +++ b/p/themes/fonts/OpenSans.woff2 diff --git a/p/themes/fonts/openSans.woff b/p/themes/fonts/openSans.woff Binary files differdeleted file mode 100644 index 55b25f867..000000000 --- a/p/themes/fonts/openSans.woff +++ /dev/null diff --git a/p/themes/index.html b/p/themes/index.html new file mode 100644 index 000000000..85faaa37e --- /dev/null +++ b/p/themes/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/p/themes/p.css b/p/themes/p.css new file mode 100644 index 000000000..171b2078b --- /dev/null +++ b/p/themes/p.css @@ -0,0 +1,17 @@ +@charset "UTF-8"; + +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; +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 000000000..5743466ec --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ruleset name="FreshRSS Ruleset"> + <description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/</description> + <!-- to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 --> + <!--<arg name="tab-width" value="10"/>--> + <exclude-pattern>./static</exclude-pattern> + <exclude-pattern>./vendor</exclude-pattern> + <exclude-pattern>./lib/SimplePie/</exclude-pattern> + <exclude-pattern>./lib/http-conditional.php</exclude-pattern> + <exclude-pattern>./lib/JSON.php</exclude-pattern> + <exclude-pattern>./lib/lib_phpQuery.php</exclude-pattern> + <exclude-pattern>./lib/password_compat.php</exclude-pattern> + <!-- Duplicate class names are not allowed --> + <rule ref="Generic.Classes.DuplicateClassName"/> + <!-- Statements must not be empty --> + <rule ref="Generic.CodeAnalysis.EmptyStatement"/> + <!-- Unconditional if-statements are not allowed --> + <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> + <!-- Do not use final statements inside final classes --> + <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/> + <!-- Do not override methods to call their parent --> + <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> + <!-- One line should not have more than 80 characters --> + <!-- One line must never exceed 120 characters --> + <rule ref="Generic.Files.LineLength"> + <!-- For language strings maximum line lengths make little sense. --> + <exclude-pattern>./app/i18n/</exclude-pattern> + <!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it --> + <exclude-pattern>./app/install.php</exclude-pattern> + <!-- @todo remove test exclusion --> + <exclude-pattern>./tests/app/</exclude-pattern> + <!-- @todo remove SQL exclusion --> + <exclude-pattern>./app/SQL/install.sql.mysql.php</exclude-pattern> + <exclude-pattern>./app/SQL/install.sql.pgsql.php</exclude-pattern> + <properties> + <property name="lineLimit" value="80"/> + <property name="absoluteLineLimit" value="180"/> + </properties> + </rule> + <!-- When calling a function: --> + <!-- Do not add a space before the opening parenthesis --> + <!-- Do not add a space after the opening parenthesis --> + <!-- Do not add a space before the closing parenthesis --> + <!-- Do not add a space before a comma --> + <!-- Add a space after a comma --> + <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/> + <rule ref="Generic.PHP.DisallowShortOpenTag" /> + <rule ref="Generic.PHP.DeprecatedFunctions" /> + <!-- Use UPPERCARE for constants --> + <rule ref="Generic.NamingConventions.UpperCaseConstantName"/> + <!-- Use lowercase for 'true', 'false' and 'null' --> + <rule ref="Generic.PHP.LowerCaseConstant"/> + <!-- Use a single string instead of concatenating --> + <rule ref="Generic.Strings.UnnecessaryStringConcat"> + <properties> + <!-- Allow string concatenating across multiple lines --> + <property name="allowMultiline" value="true"/> + </properties> + </rule> + <!-- Use tabs for indentation --> + <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> + <!-- Parameters with default values must appear last in functions --> + <rule ref="PEAR.Functions.ValidDefaultValue"/> + <!-- Use 'elseif' instead of 'else if' --> + <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/> + <!-- Do not add spaces after opening or before closing bracket --> + <rule ref="PSR2.ControlStructures.ControlStructureSpacing"/> + <!-- Add a new line at the end of a file --> + <rule ref="PSR2.Files.EndFileNewline"/> + <!-- Use Unix newlines --> + <rule ref="Generic.Files.LineEndings"> + <properties> + <property name="eolChar" value="\n" /> + </properties> + </rule> + <!-- Add space after closing parenthesis --> + <!-- Add body into new line --> + <!-- Close body in new line --> + <rule ref="Squiz.ControlStructures.ControlSignature"> + <!-- No space after keyword (before opening parenthesis) --> + <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> + </rule> + <!-- When declaring a function: --> + <!-- Do not add a space before a comma --> + <!-- Add a space after a comma --> + <!-- Add a space before and after an equal sign --> + <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> + <properties> + <property name="equalsSpacing" value="1"/> + </properties> + </rule> + <!-- Do not add spaces when casting --> + <rule ref="Squiz.WhiteSpace.CastSpacing"/> + <!-- Operators must have a space around them --> + <rule ref="Squiz.WhiteSpace.OperatorSpacing"/> + <!-- Do not add a whitespace before a semicolon --> + <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/> + <!-- Do not add whitespace at start or end of a file or end of a line --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/> +</ruleset> diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..3dd9602be --- /dev/null +++ b/tests/README.md @@ -0,0 +1,7 @@ +# FreshRSS tests + +```sh +cd ./tests/ +wget https://phar.phpunit.de/phpunit.phar +php phpunit.phar --bootstrap bootstrap.php +``` diff --git a/tests/app/Models/CategoryTest.php b/tests/app/Models/CategoryTest.php index da439b785..a1edb17b6 100644 --- a/tests/app/Models/CategoryTest.php +++ b/tests/app/Models/CategoryTest.php @@ -1,6 +1,6 @@ <?php -class FreshRSS_CategoryTest extends \PHPUnit_Framework_TestCase { +class FreshRSS_CategoryTest extends PHPUnit\Framework\TestCase { public function test__construct_whenNoParameters_createsObjectWithDefaultValues() { $category = new FreshRSS_Category(); @@ -20,12 +20,12 @@ class FreshRSS_CategoryTest extends \PHPUnit_Framework_TestCase { public function provideValidNames() { return array( - array('', ''), - array('this string does not need trimming', 'this string does not need trimming'), - array(' this string needs trimming on left', 'this string needs trimming on left'), - array('this string needs trimming on right ', 'this string needs trimming on right'), - array(' this string needs trimming on both ends ', 'this string needs trimming on both ends'), - array(str_repeat('This string needs to be shortened because its length is way too long. ', 4), str_repeat('This string needs to be shortened because its length is way too long. ', 3) . 'This string needs to be shortened because its'), + array('', ''), + array('this string does not need trimming', 'this string does not need trimming'), + array(' this string needs trimming on left', 'this string needs trimming on left'), + array('this string needs trimming on right ', 'this string needs trimming on right'), + array(' this string needs trimming on both ends ', 'this string needs trimming on both ends'), + array(str_repeat('This string needs to be shortened because its length is way too long. ', 4), str_repeat('This string needs to be shortened because its length is way too long. ', 3) . 'This string needs to be shortened because its'), ); } diff --git a/tests/app/Models/ContextTest.php b/tests/app/Models/ContextTest.php deleted file mode 100644 index c5da6f667..000000000 --- a/tests/app/Models/ContextTest.php +++ /dev/null @@ -1,241 +0,0 @@ -<?php - -require_once(LIB_PATH . '/lib_date.php'); - -class ContextTest extends \PHPUnit_Framework_TestCase { - - private $context; - - public function setUp() { - $this->context = new FreshRSS_Context(); - } - - public function testParseSearch_whenEmpty_returnsEmptyArray() { - $this->assertCount(0, $this->context->parseSearch()); - } - - /** - * @dataProvider provideMultipleKeywordSearch - * @param string $search - * @param string $expected_values - */ - public function testParseSearch_whenMultipleKeywords_returnArrayWithMultipleValues($search, $expected_values) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_values, $parsed_search); - } - - /** - * @return array - */ - public function provideMultipleKeywordSearch() { - return array( - array( - 'intitle:word1 author:word2', - array( - 'intitle' => 'word1', - 'author' => 'word2', - ), - ), - array( - 'author:word2 intitle:word1', - array( - 'intitle' => 'word1', - 'author' => 'word2', - ), - ), - array( - 'author:word1 inurl:word2', - array( - 'author' => 'word1', - 'inurl' => 'word2', - ), - ), - array( - 'inurl:word2 author:word1', - array( - 'author' => 'word1', - 'inurl' => 'word2', - ), - ), - array( - 'date:2008-01-01/2008-02-01 pubdate:2007-01-01/2007-02-01', - array( - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - ), - ), - array( - 'pubdate:2007-01-01/2007-02-01 date:2008-01-01/2008-02-01', - array( - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - ), - ), - array( - 'inurl:word1 author:word2 intitle:word3 pubdate:2007-01-01/2007-02-01 date:2008-01-01/2008-02-01 hello world', - array( - 'inurl' => 'word1', - 'author' => 'word2', - 'intitle' => 'word3', - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - 'search' => 'hello world', - ), - ), - ); - } - - /** - * @dataProvider provideIntitleSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenIntitleKeyword_returnArrayWithIntitleValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['intitle']); - } - - /** - * @return array - */ - public function provideIntitleSearch() { - return array( - array('intitle:word1', 'word1'), - array('intitle:word1 word2', 'word1'), - array('intitle:"word1 word2"', 'word1 word2'), - array("intitle:'word1 word2'", 'word1 word2'), - array('word1 intitle:word2', 'word2'), - array('word1 intitle:word2 word3', 'word2'), - array('word1 intitle:"word2 word3"', 'word2 word3'), - array("word1 intitle:'word2 word3'", 'word2 word3'), - array('intitle:word1 intitle:word2', 'word1'), - array('intitle: word1 word2', ''), - array('intitle:123', '123'), - array('intitle:"word1 word2" word3"', 'word1 word2'), - array("intitle:'word1 word2' word3'", 'word1 word2'), - array('intitle:"word1 word2\' word3"', "word1 word2' word3"), - array("intitle:'word1 word2\" word3'", 'word1 word2" word3'), - ); - } - - /** - * @dataProvider provideAuthorSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenAuthorKeyword_returnArrayWithAuthorValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['author']); - } - - /** - * @return array - */ - public function provideAuthorSearch() { - return array( - array('author:word1', 'word1'), - array('author:word1 word2', 'word1'), - array('author:"word1 word2"', 'word1 word2'), - array("author:'word1 word2'", 'word1 word2'), - array('word1 author:word2', 'word2'), - array('word1 author:word2 word3', 'word2'), - array('word1 author:"word2 word3"', 'word2 word3'), - array("word1 author:'word2 word3'", 'word2 word3'), - array('author:word1 author:word2', 'word1'), - array('author: word1 word2', ''), - array('author:123', '123'), - array('author:"word1 word2" word3"', 'word1 word2'), - array("author:'word1 word2' word3'", 'word1 word2'), - array('author:"word1 word2\' word3"', "word1 word2' word3"), - array("author:'word1 word2\" word3'", 'word1 word2" word3'), - ); - } - - /** - * @dataProvider provideInurlSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenInurlKeyword_returnArrayWithInurlValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['inurl']); - } - - /** - * @return array - */ - public function provideInurlSearch() { - return array( - array('inurl:word1', 'word1'), - array('inurl: word1', ''), - array('inurl:123', '123'), - array('inurl:word1 word2', 'word1'), - array('inurl:"word1 word2"', '"word1'), - ); - } - - /** - * @dataProvider provideDateSearch - * @param string $search - * @param string $expected_min_value - * @param string $expected_max_value - */ - public function testParseSearch_whenDateKeyword_returnArrayWithDateValues($search, $expected_min_value, $expected_max_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_min_value, $parsed_search['min_date']); - $this->assertEquals($expected_max_value, $parsed_search['max_date']); - } - - /** - * @return array - */ - public function provideDateSearch() { - return array( - array('date:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'), - array('date:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'), - array('date:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'), - array('date:2007-03-01/2008-05-11', '1172725200', '1210564799'), - array('date:2007-03-01/', '1172725200', ''), - array('date:/2008-05-11', '', '1210564799'), - ); - } - - /** - * @dataProvider providePubdateSearch - * @param string $search - * @param string $expected_min_value - * @param string $expected_max_value - */ - public function testParseSearch_whenPubdateKeyword_returnArrayWithPubdateValues($search, $expected_min_value, $expected_max_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_min_value, $parsed_search['min_pubdate']); - $this->assertEquals($expected_max_value, $parsed_search['max_pubdate']); - } - - /** - * @return array - */ - public function providePubdateSearch() { - return array( - array('pubdate:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'), - array('pubdate:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'), - array('pubdate:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'), - array('pubdate:2007-03-01/2008-05-11', '1172725200', '1210564799'), - array('pubdate:2007-03-01/', '1172725200', ''), - array('pubdate:/2008-05-11', '', '1210564799'), - ); - } - -} diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php new file mode 100644 index 000000000..5c0469a48 --- /dev/null +++ b/tests/app/Models/SearchTest.php @@ -0,0 +1,294 @@ +<?php + +require_once(LIB_PATH . '/lib_date.php'); + +class SearchTest extends PHPUnit\Framework\TestCase { + + /** + * @dataProvider provideEmptyInput + * @param string|null $input + */ + public function test__construct_whenInputIsEmpty_getsOnlyNullValues($input) { + $search = new FreshRSS_Search($input); + $this->assertEquals('', $search->getRawInput()); + $this->assertNull($search->getIntitle()); + $this->assertNull($search->getMinDate()); + $this->assertNull($search->getMaxDate()); + $this->assertNull($search->getMinPubdate()); + $this->assertNull($search->getMaxPubdate()); + $this->assertNull($search->getAuthor()); + $this->assertNull($search->getTags()); + $this->assertNull($search->getSearch()); + } + + /** + * Return an array of values for the search object. + * Here is the description of the values + * @return array + */ + public function provideEmptyInput() { + return array( + array(''), + array(null), + ); + } + + /** + * @dataProvider provideIntitleSearch + * @param string $input + * @param string $intitle_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsIntitle_setsIntitlePropery($input, $intitle_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($intitle_value, $search->getIntitle()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideIntitleSearch() { + return array( + array('intitle:word1', array('word1'), null), + array('intitle:word1 word2', array('word1'), array('word2')), + array('intitle:"word1 word2"', array('word1 word2'), null), + array("intitle:'word1 word2'", array('word1 word2'), null), + array('word1 intitle:word2', array('word2'), array('word1')), + array('word1 intitle:word2 word3', array('word2'), array('word1', 'word3')), + array('word1 intitle:"word2 word3"', array('word2 word3'), array('word1')), + array("word1 intitle:'word2 word3'", array('word2 word3'), array('word1')), + array('intitle:word1 intitle:word2', array('word1', 'word2'), null), + array('intitle: word1 word2', array(), array('word1', 'word2')), + array('intitle:123', array('123'), null), + array('intitle:"word1 word2" word3"', array('word1 word2'), array('word3"')), + array("intitle:'word1 word2' word3'", array('word1 word2'), array("word3'")), + array('intitle:"word1 word2\' word3"', array("word1 word2' word3"), null), + array("intitle:'word1 word2\" word3'", array('word1 word2" word3'), null), + array("intitle:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')), + ); + } + + /** + * @dataProvider provideAuthorSearch + * @param string $input + * @param string $author_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsAuthor_setsAuthorValue($input, $author_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($author_value, $search->getAuthor()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideAuthorSearch() { + return array( + array('author:word1', array('word1'), null), + array('author:word1 word2', array('word1'), array('word2')), + array('author:"word1 word2"', array('word1 word2'), null), + array("author:'word1 word2'", array('word1 word2'), null), + array('word1 author:word2', array('word2'), array('word1')), + array('word1 author:word2 word3', array('word2'), array('word1', 'word3')), + array('word1 author:"word2 word3"', array('word2 word3'), array('word1')), + array("word1 author:'word2 word3'", array('word2 word3'), array('word1')), + array('author:word1 author:word2', array('word1', 'word2'), null), + array('author: word1 word2', array(), array('word1', 'word2')), + array('author:123', array('123'), null), + array('author:"word1 word2" word3"', array('word1 word2'), array('word3"')), + array("author:'word1 word2' word3'", array('word1 word2'), array("word3'")), + array('author:"word1 word2\' word3"', array("word1 word2' word3"), null), + array("author:'word1 word2\" word3'", array('word1 word2" word3'), null), + array("author:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')), + ); + } + + /** + * @dataProvider provideInurlSearch + * @param string $input + * @param string $inurl_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsInurl_setsInurlValue($input, $inurl_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($inurl_value, $search->getInurl()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideInurlSearch() { + return array( + array('inurl:word1', array('word1'), null), + array('inurl: word1', array(), array('word1')), + array('inurl:123', array('123'), null), + array('inurl:word1 word2', array('word1'), array('word2')), + array('inurl:"word1 word2"', array('"word1'), array('word2"')), + array('inurl:word1 word2 inurl:word3', array('word1', 'word3'), array('word2')), + array("inurl:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')), + ); + } + + /** + * @dataProvider provideDateSearch + * @param string $input + * @param string $min_date_value + * @param string $max_date_value + */ + public function test__construct_whenInputContainsDate_setsDateValues($input, $min_date_value, $max_date_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($min_date_value, $search->getMinDate()); + $this->assertEquals($max_date_value, $search->getMaxDate()); + } + + /** + * @return array + */ + public function provideDateSearch() { + return array( + array('date:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'), + array('date:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'), + array('date:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'), + array('date:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1), + array('date:2007-03-01/', strtotime('2007-03-01'), ''), + array('date:/2008-05-11', '', strtotime('2008-05-12') - 1), + ); + } + + /** + * @dataProvider providePubdateSearch + * @param string $input + * @param string $min_pubdate_value + * @param string $max_pubdate_value + */ + public function test__construct_whenInputContainsPubdate_setsPubdateValues($input, $min_pubdate_value, $max_pubdate_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($min_pubdate_value, $search->getMinPubdate()); + $this->assertEquals($max_pubdate_value, $search->getMaxPubdate()); + } + + /** + * @return array + */ + public function providePubdateSearch() { + return array( + array('pubdate:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'), + array('pubdate:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'), + array('pubdate:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'), + array('pubdate:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1), + array('pubdate:2007-03-01/', strtotime('2007-03-01'), ''), + array('pubdate:/2008-05-11', '', strtotime('2008-05-12') - 1), + ); + } + + /** + * @dataProvider provideTagsSearch + * @param string $input + * @param string $tags_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsTags_setsTagsValue($input, $tags_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($tags_value, $search->getTags()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideTagsSearch() { + return array( + array('#word1', array('word1'), null), + array('# word1', array(), array('#', 'word1')), + array('#123', array('123'), null), + array('#word1 word2', array('word1'), array('word2')), + array('#"word1 word2"', array('"word1'), array('word2"')), + array('#word1 #word2', array('word1', 'word2'), null), + array("#word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')), + ); + } + + /** + * @dataProvider provideMultipleSearch + * @param string $input + * @param string $author_value + * @param string $min_date_value + * @param string $max_date_value + * @param string $intitle_value + * @param string $inurl_value + * @param string $min_pubdate_value + * @param string $max_pubdate_value + * @param array $tags_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsMultipleKeywords_setsValues($input, $author_value, $min_date_value, $max_date_value, $intitle_value, $inurl_value, $min_pubdate_value, $max_pubdate_value, $tags_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($author_value, $search->getAuthor()); + $this->assertEquals($min_date_value, $search->getMinDate()); + $this->assertEquals($max_date_value, $search->getMaxDate()); + $this->assertEquals($intitle_value, $search->getIntitle()); + $this->assertEquals($inurl_value, $search->getInurl()); + $this->assertEquals($min_pubdate_value, $search->getMinPubdate()); + $this->assertEquals($max_pubdate_value, $search->getMaxPubdate()); + $this->assertEquals($tags_value, $search->getTags()); + $this->assertEquals($search_value, $search->getSearch()); + $this->assertEquals($input, $search->getRawInput()); + } + + public function provideMultipleSearch() { + return array( + array( + 'author:word1 date:2007-03-01/2008-05-11 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 #word5', + array('word1'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word2'), + array('word3'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word4', 'word5'), + null, + ), + array( + 'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 date:2007-03-01/2008-05-11', + array('word1'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word2'), + array('word3'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word4', 'word5'), + array('word6'), + ), + array( + 'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 word7 date:2007-03-01/2008-05-11', + array('word1'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word2'), + array('word3'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word4', 'word5'), + array('word6', 'word7'), + ), + array( + 'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 "word7 word8" date:2007-03-01/2008-05-11', + array('word1'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word2'), + array('word3'), + strtotime('2007-03-01'), + strtotime('2008-05-12') - 1, + array('word4', 'word5'), + array('word7 word8', 'word6'), + ), + ); + } + +} diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php new file mode 100644 index 000000000..1959fd492 --- /dev/null +++ b/tests/app/Models/UserQueryTest.php @@ -0,0 +1,229 @@ +<?php + +/** + * Description of UserQueryTest + */ +class UserQueryTest extends PHPUnit\Framework\TestCase { + + public function test__construct_whenAllQuery_storesAllParameters() { + $query = array('get' => 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals('all', $user_query->getGetName()); + $this->assertEquals('all', $user_query->getGetType()); + } + + public function test__construct_whenFavoriteQuery_storesFavoriteParameters() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals('favorite', $user_query->getGetName()); + $this->assertEquals('favorite', $user_query->getGetType()); + } + + /** + * @expectedException Exceptions/FreshRSS_DAO_Exception + * @expectedExceptionMessage Category DAO is not loaded in UserQuery + */ + public function test__construct_whenCategoryQueryAndNoDao_throwsException() { + $this->markTestIncomplete('There is a problem with the exception autoloading. We need to make a better autoloading process'); + $query = array('get' => 'c_1'); + new FreshRSS_UserQuery($query); + } + + public function test__construct_whenCategoryQuery_storesCategoryParameters() { + $category_name = 'some category name'; + $cat = $this->getMock('FreshRSS_Category'); + $cat->expects($this->atLeastOnce()) + ->method('name') + ->withAnyParameters() + ->willReturn($category_name); + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($cat); + $query = array('get' => 'c_1'); + $user_query = new FreshRSS_UserQuery($query, null, $cat_dao); + $this->assertEquals($category_name, $user_query->getGetName()); + $this->assertEquals('category', $user_query->getGetType()); + } + + /** + * @expectedException Exceptions/FreshRSS_DAO_Exception + * @expectedExceptionMessage Feed DAO is not loaded in UserQuery + */ + public function test__construct_whenFeedQueryAndNoDao_throwsException() { + $this->markTestIncomplete('There is a problem with the exception autoloading. We need to make a better autoloading process'); + $query = array('get' => 'c_1'); + new FreshRSS_UserQuery($query); + } + + public function test__construct_whenFeedQuery_storesFeedParameters() { + $feed_name = 'some feed name'; + $feed = $this->getMock('FreshRSS_Feed', array(), array('', false)); + $feed->expects($this->atLeastOnce()) + ->method('name') + ->withAnyParameters() + ->willReturn($feed_name); + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($feed); + $query = array('get' => 'f_1'); + $user_query = new FreshRSS_UserQuery($query, $feed_dao, null); + $this->assertEquals($feed_name, $user_query->getGetName()); + $this->assertEquals('feed', $user_query->getGetType()); + } + + public function test__construct_whenUnknownQuery_doesStoreParameters() { + $query = array('get' => 'q'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertNull($user_query->getGetName()); + $this->assertNull($user_query->getGetType()); + } + + public function test__construct_whenName_storesName() { + $name = 'some name'; + $query = array('name' => $name); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($name, $user_query->getName()); + } + + public function test__construct_whenOrder_storesOrder() { + $order = 'some order'; + $query = array('order' => $order); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($order, $user_query->getOrder()); + } + + public function test__construct_whenState_storesState() { + $state = 'some state'; + $query = array('state' => $state); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($state, $user_query->getState()); + } + + public function test__construct_whenUrl_storesUrl() { + $url = 'some url'; + $query = array('url' => $url); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($url, $user_query->getUrl()); + } + + public function testToArray_whenNoData_returnsEmptyArray() { + $user_query = new FreshRSS_UserQuery(array()); + $this->assertInternalType('array', $user_query->toArray()); + $this->assertCount(0, $user_query->toArray()); + } + + public function testToArray_whenData_returnsArray() { + $query = array( + 'get' => 's', + 'name' => 'some name', + 'order' => 'some order', + 'search' => 'some search', + 'state' => 'some state', + 'url' => 'some url', + ); + $user_query = new FreshRSS_UserQuery($query); + $this->assertInternalType('array', $user_query->toArray()); + $this->assertCount(6, $user_query->toArray()); + $this->assertEquals($query, $user_query->toArray()); + } + + public function testHasSearch_whenSearch_returnsTrue() { + $query = array( + 'search' => 'some search', + ); + $user_query = new FreshRSS_UserQuery($query); + $this->assertTrue($user_query->hasSearch()); + } + + public function testHasSearch_whenNoSearch_returnsFalse() { + $user_query = new FreshRSS_UserQuery(array()); + $this->assertFalse($user_query->hasSearch()); + } + + public function testHasParameters_whenAllQuery_returnsFalse() { + $query = array('get' => 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->hasParameters()); + } + + public function testHasParameters_whenNoParameter_returnsFalse() { + $query = array(); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->hasParameters()); + } + + public function testHasParameters_whenParameter_returnTrue() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertTrue($user_query->hasParameters()); + } + + public function testIsDeprecated_whenCategoryExists_returnFalse() { + $cat = $this->getMock('FreshRSS_Category'); + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($cat); + $query = array('get' => 'c_1'); + $user_query = new FreshRSS_UserQuery($query, null, $cat_dao); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenCategoryDoesNotExist_returnTrue() { + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn(null); + $query = array('get' => 'c_1'); + $user_query = new FreshRSS_UserQuery($query, null, $cat_dao); + $this->assertTrue($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFeedExists_returnFalse() { + $feed = $this->getMock('FreshRSS_Feed', array(), array('', false)); + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($feed); + $query = array('get' => 'f_1'); + $user_query = new FreshRSS_UserQuery($query, $feed_dao, null); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFeedDoesNotExist_returnTrue() { + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn(null); + $query = array('get' => 'f_1'); + $user_query = new FreshRSS_UserQuery($query, $feed_dao, null); + $this->assertTrue($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenAllQuery_returnFalse() { + $query = array('get' => 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFavoriteQuery_returnFalse() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenUnknownQuery_returnFalse() { + $query = array('get' => 'q'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 24340b15c..5c42f12f7 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,5 +3,5 @@ error_reporting(E_ALL); ini_set('display_errors', 1); -require('../constants.php'); -require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
\ No newline at end of file +require(__DIR__ . '/../constants.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader |
