Commit Graph

51 Commits

Author SHA1 Message Date
Alexandre Alapetite
1335a0e3cf PHPStan level 5 (#4110)
* Fix most PHPDocs errors
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types

* Avoid func_get_args
Use variadic syntax instead https://php.net/manual/functions.arguments#functions.variable-arg-list
And avoid dynamic functions names when possible to more easily identify calls and unused functions.
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103

* PHPStan level 3

* PHPStand level 4

* Update default to PHPStan level 4

* Towards level 5

* Fix level 4 regression

* Towards level 5

* Pass PHPStan level 5

* Towards level 6

* Remove erronenous regression from changelog
https://github.com/FreshRSS/FreshRSS/pull/4116
2022-01-04 13:59:09 +01:00
Alexandre Alapetite
3f6aa42b81 Fix most PHPDocs errors (#4107)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types
2022-01-01 11:26:56 +01:00
Alexandre Alapetite
77e9877316 Add PHPStan (#4021)
* Add PHPStan
#fix https://github.com/FreshRSS/FreshRSS/issues/4016
https://phpstan.org/

```sh
composer run-script phpstan
```

* More fixes

* Fix global variables

* Add .phtml

* Fix merge
https://github.com/FreshRSS/FreshRSS/pull/4090

* Fix more warnings

* Fix view errors and enable in CI

* ReturnTypeWillChange

* Dynamic view type

* Fix Minz static/self bug
2021-12-31 17:00:51 +01:00
Alexandre Alapetite
8fc43d5a56 Fix extensions_enabled (#4090)
#fix https://github.com/FreshRSS/FreshRSS/issues/4088
2021-12-31 13:12:42 +01:00
Alexandre Alapetite
607f7e7254 Fix several comments syntaxes (#3615)
Mainly wrong `@return` types in comments
2021-05-08 10:27:18 +02:00
Alexandre Alapetite
947e918f05 Travis: Enforce phpcs line length + whitespace (#3488)
* Update Travis line length

* Also check whitespace in CSS files

* Fix line length ext.php

* More syntax, string templates

* Fix exclude-pattern

* Test JS files as well
2021-02-28 12:26:24 +01:00
Alexis Degrugillier
8285f1df43 Add comprehensive user configuration in extensions (#3397)
Before, the extension configuration was handled by its author. There
was discrepancies between extensions on how the configuration was
stored.
Now, we could rely on a single way of storing configuration. This won't
invalidate how the extensions are storing their configuration but will
allow authors to focus on what is important.
2021-02-02 00:03:09 +01:00
Alexandre Alapetite
9c6682e7ed Avoid manual initialisations of system or user configuration (#3070)
* Avoid manual intialisations of system or user configuration

More consistent use of Context

* Simplify FreshRSS_Context::initUser

* Remove a few manual get_user_configuration

* A bit of debugging

* Fix context user init

* Fix install

* Fix concurrency

Concurrent requests could lead to bad race condition

* Fix actualize cron

Fix case when system i initialised several times
2021-01-02 21:20:19 +01:00
Alexandre Alapetite
fd33d92d41 Require PHP 5.5+ (#2495)
* Require PHP 5.5+

https://github.com/FreshRSS/FreshRSS/issues/2469#issuecomment-522255093
I think it would be reasonable to require PHP 5.5+ for the core of
FreshRSS after all.

As Frenzie said, WordPress currently requires PHP 5.6.20+, and it is the
most popular PHP application.

We would loose about 20% of the PHP servers according to
https://w3techs.com/technologies/details/pl-php/5/all but I expect this
number to drop fast after the release of CentOS 8 (CentOS accounts for
17% of Linux servers
https://w3techs.com/technologies/details/os-linux/all/all ).

Distributions:
* no impact on Ubuntu, Fedora, Alpine, OpenWRT, FreeBSD, OpenSuze,
Mageia, as all active versions have PHP > 7
* no impact on OpenSuze, Synology, as all active versions have PHP > 5.5
* we drop Debian 8 Jessie (-2020) - we keep supporting Debian 9 Stretch
(2017-06) - current is Debian 10 Buster
* we drop Red Hat 7 (-2024) - we keep supporting RHEL 8 (2019-05)
* we drop CentOS 7 (-2024) - we will support CentOS 8 (to be released
soonish)

When dropping older versions, I can better like when it is for a good
reason, and there is actually one with PHP 5.5, namely generators
(yield) https://php.net/language.generators.overview which I consider
using.

* Version note for JSON.php

* hex2bin

* Update .travis.yml

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
2019-08-20 14:55:43 +02:00
Alexandre Alapetite
945cf832ad HTTP authenfication fixes (#2204)
* Security fixes when HTTP user does not exist in FreshRSS
* Accept HTTP header X-WebAuth-User for delegated HTTP Authentication (e.g. Træfik)
* Document delegated HTTP authentication from https://github.com/FreshRSS/FreshRSS/pull/2202
2019-01-02 21:43:05 +01:00
Alexandre Alapetite
6a56894e94 New extension event + Tumblr GDPR (#1924)
* New extension event + Tumblr GDPR

https://github.com/FreshRSS/FreshRSS/issues/1894
simplepie_before_init event

* Refactor extension enabling + Tumblr GDPR enabled by default

Add possibility for extensions to be enabled by default, and disabled
back by users.

* Minor whitespace
2018-06-09 15:58:18 +02:00
Frans de Jonge
4e174ed9dd [ci] Add Travis (#1619)
* [ci] Add Travis

* Exclude some libs

* Semi-auto whitespace fixes

* line length in SQLite

* Exclude tests from line length

* Feed.php line length

* Feed.php: get rid of unnecessary concat

* Feed.php: line length

* bootstrap.php: no newline at end of file

* Allow concatenating across multiple lines

* Add Travis badge

* do-install line length

* update-or-create-user line length

* cli/create-user line length

* tests/app/Models/SearchTest.php fix indentation

* tests/app/Models/UserQueryTest.php fix indentation

* tests/app/Models/CategoryTest.php fix indentation

* [fix] PHP 5.3 on precise

* cli/do-install no spaces

* cli/list-users line length

* cli/reconfigure line length

* empty catch statements

* api/index line length nonsense

* spaces before semicolon

* app/Models/EntryDAO bunch of indentation

* extra blank lines

* spaces before comma in function call

* testing tabwidth

* increase to 10

* comment out tabwidth line

* try older phpcs version 3.0.0RC4

* line length exception for app/install.php

* proper spaces

* stray spaces in i18n

* Minz/ModelPdo line length

* Minz whitespace

* greader line length

* greader elseif placement

* app/Models/Feed.php spacing in function argument

* ignore php 5.3

* app/Models/ConfigurationSetter.php stray whitespace

* EntryDAOSQLite line length

* I vote for higher max line length =P

* ignore SQL

* remove classname complaint

* line length/more legible SQL

* ignore line length nonsense

* greader line length

* feedController issues

* uppercase TRUE, FALSE, NULL

* revert

* importExportController lowercase null

* Share.php default value not necessary because ! is_array () a few lines down

* CategoryDAO constants should be UPPERCASE

* EntryDAO reduce line length

* contentious autofix

* Allow failures on all versions of PHP except 7.1 because reasons
2017-09-22 12:13:46 +02:00
Marien Fressinaud
6dbe33c51e Don't hide errors in configuration
Fix https://github.com/FreshRSS/FreshRSS/issues/920
2015-07-29 07:59:05 +02:00
Marien Fressinaud
c1a44a8761 Load configuration by recursion
- Remove Minz_Configuration::$data_default
- Default values are loaded first in $data
- $data values are replaced by values from config file

Fix https://github.com/FreshRSS/FreshRSS/issues/923
2015-07-27 14:46:41 +02:00
Alexandre Alapetite
12081f7ba2 Quick fix cron actualization due to problematic FreshRSS constructor/init
https://github.com/FreshRSS/FreshRSS/issues/759
Suggestion: the static objects should be user-independent (or at least
with the possibility to be re-set), while the FreshRSS object and its
attributes should be user-dependent.
2015-01-20 23:29:04 +01:00
Marien Fressinaud
73023bc12b Merge branch 'dev' into 252-extensions
Conflicts:
	app/FreshRSS.php
	app/Models/Configuration.php
	app/views/index/index.phtml
	app/views/index/normal.phtml
	lib/Minz/Configuration.php
	lib/Minz/Translate.php
	lib/lib_rss.php
2015-01-08 14:18:32 +01:00
Marien Fressinaud
fb614ab80c Change way to call configuration setter.
- Add a support($key) method which return if the given key is supported by
  the setter.
- Change handle signature by adding a $data param which must be passed by
  reference.

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-07 17:36:29 +01:00
Marien Fressinaud
7f12058fab Add a method to change the configuration setter
See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-07 16:09:24 +01:00
Marien Fressinaud
91e2d4936d Add support of configuration_setter
A configuration setter must implement only one method: `handle($key, $value)`.
Before setting a value in configuration, the setter will be called with this
method to check its validity.
If a setter has been assigned to a configuration object, it will be called for
each of its data so be careful to always return a value (or null if you want
to delete the key).

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-07 15:57:27 +01:00
Marien Fressinaud
bd199c6170 If a conf param doesn't exist, log and return null
See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-07 10:48:47 +01:00
Marien Fressinaud
17a280230f Change Minz_Configuration::parseFile() in load()
See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-06 21:16:33 +01:00
Marien Fressinaud
51a71ec4b9 New configuration system (not working yet)
- Use only Minz_Configuration
- register() method to load a new configuration file
- get() to get a configuration
- new exceptions related to configuration
- fix a list configuration calls to have FRSS working

Current problems to resolve:

- How to handle configuration param verifications (i.e. check auth_type
  is a value from none, http_auth, persona or form)
- We must use $conf = Minz_Configuration::get('system'); $general_conf = $conf->general;
  to access global system configuration which is quite annoying. How to change that?

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-05 16:54:16 +01:00
Marien Fressinaud
4c888590e6 Improve system/user types for extensions
- system extensions can only be managed by an administrator
- system extensions are loaded for all users (even if not logged)
- user extensions are loaded for logged users only
- system extensions loading is saved in global config.php file

See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-06 16:41:06 +01:00
Marien Fressinaud
86f69ca396 First draft for the new extension feature
- Only system extensions can be loaded for the moment by adding them in the config.php
  file.
- Remove previous system (it will be added properly in the new system in the next step).
2014-12-04 19:33:29 +01:00
Alexandre Alapetite
9f97f7df88 Ne pas rafraîchir les flux des utilisateurs non logués depuis x jours
https://github.com/marienfressinaud/FreshRSS/issues/681
Warning: needs some testing
2014-10-29 00:45:42 +01:00
Alexandre Alapetite
2e5d4d97c9 More limit options in config.php
See e.g. https://github.com/marienfressinaud/FreshRSS/issues/681
https://github.com/marienfressinaud/FreshRSS/issues/680
https://github.com/marienfressinaud/FreshRSS/issues/656
2014-10-28 22:29:55 +01:00
Alexandre Alapetite
c6f35ef51c Global limits for number of feeds and categories
New 'limits' sub-array in config.php with 'max_feeds' and
'max_categories'. If the values are < 0, then it is the default value
(16384).
https://github.com/marienfressinaud/FreshRSS/issues/680
2014-10-27 21:45:30 +01:00
Marien Fressinaud
6009990935 Introduce FreshRSS_Auth::hasAccess('admin')
Replace Minz_Configuration::isAdmin($user). FreshRSS_Auth::hasAccess() could
be extended to others scopes later.

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-07 10:16:38 +02:00
Alexandre Alapetite
d6f4141086 Preparation for SQLite
https://github.com/marienfressinaud/FreshRSS/issues/100
2014-07-03 21:26:30 +02:00
Alexandre Alapetite
c8aa451c76 Minz: remove url_rewriting
As suggested
https://github.com/marienfressinaud/FreshRSS/issues/163#issuecomment-38478669

At the same time, removes a bunch of (almost) dead code such as
Minz_Router (the few remaining lines being moved to Minz_FrontController
to avoid a class)

Contributes to https://github.com/marienfressinaud/FreshRSS/issues/303
2014-03-24 20:55:18 +01:00
Alexandre Alapetite
72ae58d455 Minz: remove Minz_Cache
https://github.com/marienfressinaud/FreshRSS/issues/163#issuecomment-37990319
https://github.com/marienfressinaud/FreshRSS/issues/303
2014-03-22 13:20:49 +01:00
Alexandre Alapetite
b07f9157b1 New unsafe autologin mode
https://github.com/marienfressinaud/FreshRSS/issues/440
2014-03-02 13:35:09 +01:00
Alexandre Alapetite
6dffb8706f Alpha version of Google Reader compatible API
https://github.com/marienfressinaud/FreshRSS/issues/13
Hardcoded passwords, no possibility to add/delete feeds or edit
categories yet.
2014-02-27 22:48:11 +01:00
Marien Fressinaud
4dd673157b Add possibility to anonymous to refresh feeds
Obviously, it's optional! (and deactivate by default)
Need some more tests?
See #351
2014-02-13 21:45:25 +01:00
Marien Fressinaud
a46ee26e35 Fallback config pour 0.7-beta 2014-01-25 23:03:53 +01:00
Marien Fressinaud
84c30445d4 Corrige bug initialisation environnement
L'environnement était toujours à SILENT et plus rien n'était loggué.
2014-01-25 22:50:38 +01:00
Alexandre Alapetite
41033768c3 Mode anonyme pour connexion avec formulaire
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/361
2014-01-18 01:00:17 +01:00
Alexandre Alapetite
d58886a937 Implémentation de l'indentification par mot de passe
Implémentation de
https://github.com/marienfressinaud/FreshRSS/issues/104
2014-01-12 03:10:31 +01:00
Alexandre Alapetite
8beb15460a Sauvegardes avec extension .bak.php pour plus de sécurité
Évite le téléchargement
2014-01-01 05:06:36 +01:00
Alexandre Alapetite
66229a5d71 Minz : bug avec OPcache de PHP 5.5+
Minz ne prenait pas en charge OPcache (cache PHP) http://php.net/opcache
activé par défaut depuis PHP5.5.
Ce fut un peu dur d'isoler ce bug :-/
Il faut penser à appeler opcache_invalidate avant de ré-utiliser un
fichier par include().
Aussi, le mécanisme de lock() n'est plus approprié ni nécessaire.
Pour FreshRSS, évite l'utilisation de ModelArray car il ne restait que
quelques lignes d'utiles, et évite un héritage + appel de classe, ce qui
est toujours ça de gagné.
2014-01-01 04:39:39 +01:00
Alexandre Alapetite
1ac09e7fe4 Multi-utilisateur fonctionnel en HTTP Auth
+ Possibilité d'ajout / suppression d'utilisateur (seulement par
l'administrateur)
+ Divers changements pour le mode multi-utilisateur
https://github.com/marienfressinaud/FreshRSS/issues/126
+ Minz : Renomme "sel_application" en "salt'
2013-12-31 02:59:07 +01:00
Alexandre Alapetite
bd5d7a7bcb Cache HTTP compatible multi-utilisateur
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
2013-12-30 15:00:41 +01:00
Alexandre Alapetite
92efd68a3a Début de mode multi-utilisateur avec http_auth
+ Légère optimisation de Minz_View.
+ Encore plus de tests de bibliothèques dans install.php
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126 et
https://github.com/marienfressinaud/FreshRSS/issues/303
2013-12-30 01:03:32 +01:00
Alexandre Alapetite
220341b406 Implémente sélecteur de méthode d’authentification
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
2013-12-29 02:12:46 +01:00
Alexandre Alapetite
96bdbafcea Refactorisation FreshRSS_Configuration
Implémente https://github.com/marienfressinaud/FreshRSS/issues/260
(évite les comparaisons de chaînes au profit des vrais booléens et
entiers)
Grosse simplification et réduction du code relatif à la configuration.
Supprime ConfigurationDAO.
Permet de simplifier considérablement configureController.
Évite de multiples copies des mêmes données en mémoire.
Évite de garder plusieurs versions de la configuration en mémoire
(auparavant : dans un tableau au niveau de ModelArray + au niveau de
FreshRSS_Configuration + en Session + des copies temporaires comme
ConfigurationDAO).
Ne stocke plus 'conf' en Session (n'était presque pas utilisé).
Évite de recharger plusieurs fois Translate inutilement.
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/303
2013-12-28 23:09:39 +01:00
Alexandre Alapetite
856d2c125b Suite nettoyage des types et chaînes
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/260
2013-12-28 18:07:16 +01:00
Alexandre Alapetite
9ac1496d63 Bouge anon_access dans config.php
L'accès anonyme n'est pas au niveau utilisateur mais au niveau global.
Bouge FreshRSS_Configuration::conf->anonAccess() qui était stocké dans
*_user.php vers Minz_Configuration::allowAnonymous() stocké dans
config.php
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
+ autres optimisations
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/260
2013-12-28 13:54:52 +01:00
Alexandre Alapetite
3273fee15e Un peu de configuration utilisateur
Continue https://github.com/marienfressinaud/FreshRSS/issues/126
2013-12-28 00:04:34 +01:00
Alexandre Alapetite
574d37bddc Favicons compatibles multi-utilisateurs
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
2013-12-26 19:58:17 +01:00
Alexandre Alapetite
415d7a5a71 config.php plutôt que application.ini
Implémente https://github.com/marienfressinaud/FreshRSS/issues/272
2013-12-22 16:08:24 +01:00