Commit Graph

649 Commits

Author SHA1 Message Date
Alexandre Alapetite
4e2dff4591 Add spell checking with typos (#4138)
* Add spell checking with typos
Implement https://github.com/FreshRSS/FreshRSS/pull/4134#issuecomment-1008027558

* GitHub Actions attempt

* Quiet wget

* Makefile
2022-01-09 18:21:40 +01:00
Thomas Renes
916df412f5 Fix various typos and spelling errors in documentation, comments and code. (#4134) 2022-01-08 16:25:17 +01:00
Luc SANCHEZ
ed19445f74 Optimise Minz_ModelPdo::class (#4119)
* - Fix typo,
- remove unnecessary null in property,
- remove unused property,
- add phpDoc,
- add ext PDO in composer.json,
- use strict comparison,
- indentation

* Translate

* Update lib/Minz/ModelPdo.php

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* The code is more explicite

* Fix phpstan

* Fix phpstan expect one

* Fix phpstan

* Return in back...

* make fix-all

* Fix exception and more types

* Fix more types

* Remove ext- in composer.json

Co-authored-by: Luc SANCHEZ <l.sanchez-ext@ubitransport.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-07 10:05:09 +01:00
Alexandre Alapetite
8e398d24f1 Fix several PHP8.1 warnings (#4123)
* Fix several PHP8.1 warnings
Taking advantage of https://github.com/FreshRSS/FreshRSS/pull/4121

* Couple oh type hints missing

* Compatibility PHP 7

* Fix variadic PHPDocs syntax
2022-01-06 22:39:35 +01:00
Frans de Jonge
d339b6dd45 [CI] PHPCS: check for opening brace on same line (#4122)
* [CI] PHPCS: check for opening brace on same line

* make fix-all

* Minor comments

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-05 00:52:24 +01:00
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
ba0e690235 SimplePie 1.5.8 manual upgrade (#4113)
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4011
Instead of https://github.com/FreshRSS/FreshRSS/pull/4102
* bea5de77af
* 5aab77e105
* 76be63e72e
2022-01-02 18:11:42 +01:00
Alexandre Alapetite
a791388ce4 Avoid func_get_args (#4108)
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
2022-01-01 13:54:36 +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
a2ab9cf83a Minz request avoid custom methods (#4020)
Take advantage of PHP7+ null-coalescing operator `??` to make code more standard, shorter, and faster instead of custom function with no extra functionality.

Allows code to be better tested and fix two PHPstan errors:

```
 ------ -----------------------------------------
  Line   app/Controllers/configureController.php
 ------ -----------------------------------------
  410    Cannot unset offset 'rid' on string.
 ------ -----------------------------------------

 ------ ------------------------------------
  Line   lib/Minz/FrontController.php
 ------ ------------------------------------
  70     Cannot unset offset 'c' on string.
  71     Cannot unset offset 'a' on string.
 ------ ------------------------------------
```

https://github.com/FreshRSS/FreshRSS/issues/4016
2021-12-02 23:25:07 +01:00
Alexandre Alapetite
28cff8a0df Fix some PHP 8.1 warnings (#4012)
* Fix some PHP 8.1 warnings
The proper fix will have to wait till be drop PHP7.
#fix https://github.com/FreshRSS/FreshRSS/issues/4010

* Another PHP8.1 fix
2021-12-01 23:24:39 +01:00
Alexandre Alapetite
b21fe199ed Manual update SimplePie (#4011)
* 417a1661b2
* ebdd0643ee
* 941412027a
* f58a23730f
2021-12-01 23:24:18 +01:00
Brooke
b780ef5276 Update PHPMailer to 6.5.1 (#3977) 2021-11-14 23:25:12 +01:00
Alexandre Alapetite
c5ab4cea4a Fix getNonStandardShortcuts (#3924)
#fix https://github.com/FreshRSS/FreshRSS/issues/3922
Quick fix. The `getNonStandardShortcuts()` could probably be re-written.
2021-10-24 17:23:04 +02:00
Alexandre Alapetite
ff60e24c57 Mailer rename .txt to .txt.php (#3842)
* Mailer rename .txt to .txt.php
2021-09-11 20:40:45 +02:00
Alexis Degrugillier
714b40e2de Add system configuration for extension (#3626)
Before, only the user configuration was supported by extensions. But it was
limiting if one has to create a system extension with configuration.
Now, both user and system configuration are supported.
2021-07-11 15:11:10 +02:00
Alexis Degrugillier
235ff3863d Add a request method to extract arrays (#3629) 2021-05-18 22:54:10 +02:00
Alexandre Alapetite
9e8a17655a Minz provide action name in controller exception (#3624)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/3584
2021-05-16 14:38:19 +02:00
Alexandre Alapetite
97ba6261a8 git update auto change to edge branch (#3589)
* git update auto change to edge branch
For existing installations using automatic git update, checkout *edge* branch if it was still using *master* or *dev*.

* One more prune

* Fix several small issues

* theirs does not work here

* Use migration mechanism

* Better handling of Migration errors

* Test details

* Fix tests

* Do not use new migration system for now
2021-05-15 21:33:43 +02: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
224b20edd1 Merge upstream SimplePie PR details (#3614)
https://github.com/simplepie/simplepie/pull/681
https://github.com/simplepie/simplepie/pull/680
https://github.com/simplepie/simplepie/pull/675
2021-05-08 00:56:54 +02:00
Alexandre Alapetite
1f24a5d50e Show start error (#3590)
* Show start error
#fix https://github.com/FreshRSS/FreshRSS/issues/3581
We were not showing the actual error for several types of exceptions, e.g. database connection error.
Possible regression since https://github.com/FreshRSS/FreshRSS/pull/3407

* Try to make the error message less confusing
2021-04-17 20:55:43 +02:00
Alexandre Alapetite
d0d5f1ce3f Merge SimplePie changes (#3588)
Related to https://github.com/simplepie/simplepie/pull/676
from https://github.com/FreshRSS/FreshRSS/pull/1087
2021-04-17 18:10:47 +02:00
Alexandre Alapetite
a57fa9975a Fix wrong SimplePie type hint (#3578)
`SimplePie_Cache` also exists but is something else.
2021-04-08 23:34:21 +02:00
Alexandre Alapetite
150015079f SimplePie fix old regression during manual merge (#3568)
Bug from https://github.com/FreshRSS/FreshRSS/pull/2136
Related upstream PR https://github.com/simplepie/simplepie/pull/676
2021-03-28 18:33:49 +02:00
berumuron
cc6c529562 tec: Remove data/do-install.txt (#3555)
* Remove file data/do-install.txt

This file was painful during update because we had to remember to delete
it each time. It added a security issue by allowing an attacker to
reinstall FreshRSS during the update process.

The (more powerful) file data/applied_migrations.txt has been introduced
in 8619cf6fa to replace do-install.txt. We had to wait for at least one
release in order to make sure existing instances of FreshRSS created the
migration file. It should be ok now.

* Replace i18n install.not_deleted key

* Update documentation to update FreshRSS
2021-03-26 19:41:33 +01:00
Alexandre Alapetite
eeff1a17b0 Suport standard HTTP 410 Gone (#3561)
When a feed returns an HTTP 410 Gone, mute the corresponding feed, i.e. stop refreshing it.
Example of such feed, Les Décodeurs (Libération) https://rss.liberation.fr/rss/100893/
2021-03-26 19:13:23 +01:00
Alexandre Alapetite
0ff6ba4542 SimplePie fix PHP8 uncatched error (#3547)
#fix https://github.com/FreshRSS/FreshRSS/pull/3546
When `loadHTML()` is given a null or empty string.

```
PHP Fatal error:  Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /var/www/freshrss/lib/SimplePie/SimplePie/Locator.php:83
```
2021-03-23 10:54:14 +01:00
Alexis Degrugillier
4f4ce3c71b Remove shortcut validation (#3548)
Before, only standard shortcuts were supported. When other shortcuts were
configured, they were filtered out.
Now, those shortcuts are stored in the configuration and an alert message
is displayed to alert the user that he is using non-standard shortcuts.

See #3481
2021-03-21 15:42:27 +01:00
Alexandre Alapetite
b7fdfbb894 SimplePie prevent cache pollution (#3502)
* SimplePie prevent cache polution
#fix https://github.com/FreshRSS/FreshRSS/pull/3367#issuecomment-766250249
#fix https://github.com/FreshRSS/FreshRSS/pull/3494#issuecomment-790113663

* Fix bug

* Minor improvement

* Update cache filename in FreshRSS (1/2)

* cacheFilename temp

* New SimplePie get_cache_filename()

* Fix typos

* Update lib/SimplePie/SimplePie.php

Typo

* Include user-agent and timeout

* fix array_merge

* Declaration

* force_feed was lost in a commit
2021-03-09 08:41:47 +01: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
0ce798d40b Add support for extension user files (#3433)
Extension user files can be stored easily in the user folder instead of the static folder.
2021-02-26 18:42:10 +01:00
Brooke
9ea3e7710a Upgrade PHPMailer to 6.3.0 (#3457)
* Upgrade PHPMailer to 6.2.0

* Bump PHPMailer to 6.3.0

Co-authored-by: berumuron <dev@marienfressinaud.fr>
2021-02-24 16:20:40 +01:00
Alexandre Alapetite
75711c3647 Manual update to SimplePie 1.5.6 (#3469)
* Manual update to SimplePie 1.5.6

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/3206 (1.5.5)
Differences
692e8bc19b...155cfcfacd
Related to https://github.com/FreshRSS/FreshRSS/pull/3416 ,
https://github.com/FreshRSS/FreshRSS/pull/3404

* Typo
2021-02-20 23:38:36 +01:00
Kiblyn11
0e6ad01dbf Fix: handle very big feed (#3416)
* fix: handle big xml files which cause out of memory exceptions by working with chunks in cleanMd5 function (because of preg_replace) and parse (because of xml_parse)

* Review

* Fixes in error handling (case of the last call to xml_parse, case of
error during fopen, break in case of XML error...)
* Takes advantage of the chunking for computing the cache hash
* Larger chunks of 1MB

Co-authored-by: e <bokes74743@tjuln.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-02-17 21:50:25 +01:00
Alexis Degrugillier
787e8fa463 Add user maintenance hooks (#3440)
The new hook allows to add maintenance extensions at the user level.

See #3398
2021-02-17 16:34:54 +01:00
Alexis Degrugillier
5bd84038a2 Remove Minz validation (#3439)
It should have been done during #3302.
2021-02-11 18:18:42 +01:00
hesch
13b03b232b refactor: remove referer checks, as they are no longer needed (replaced by csrf tokens) (#3432) 2021-02-11 17:38:39 +01:00
Alexis Degrugillier
54f04e1233 Fix configuration local cache (#3431)
Before, setting values did not refresh the configuration cache. Thus
generating some weird behavior when configuring extensions.
Now, the cache is updated with the most recent values when the
configuration is modified.
2021-02-08 22:47:09 +01:00
Alexandre Alapetite
4a87f34bcf API implement OPML import/export (#3424)
#fix https://github.com/FreshRSS/FreshRSS/issues/3421
2021-02-06 12:43:30 +01:00
Alexandre Alapetite
8edce0e209 Fix heredoc syntax (#3426)
Fix regression from https://github.com/FreshRSS/FreshRSS/pull/3407

Identifier must not be indented

PHP 5.6.36 (cli) (built: Apr 28 2018 21:14:51)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend
Technologies
PHP Parse error:  syntax error, unexpected end of file in
lib/lib_rss.php on line 608
Errors parsing lib/lib_rss.php
2021-02-06 12:37:26 +01:00
Alexandre Alapetite
23c43b1fbf Fix return type for broken feeds (#3423)
Fix a rare error when an invalid feed is forced to be added again.
FreshRSS code (not upstream)
2021-02-06 00:58:51 +01:00
Alexandre Alapetite
d42b4c299c Add requirements check in CLI (#3410)
* Add requirements check in CLI

#fix https://github.com/FreshRSS/FreshRSS/issues/1853

* More checks

#fix https://github.com/FreshRSS/FreshRSS/issues/1853
2021-02-05 22:21:31 +01:00
Martin
934f032c19 Better error message on failure (#3407)
* bump default logout from 30 to 365 days

* * Change cookie duration to constant
* Change cookie duration to three months

* use class

* use 90 days (otherwise login form says 91.3 days)

* change class

* also this works now

* Better error message

* inconsistent dot with the other message

* Better error message

* add errorMessage()

* fix style

* html escape the error title

* also html escape error message

* remove spaces before parentheses

* rework the error message

* Minz-friendly

* Update message

Do not advise running this script as wrong user

* Update lib/lib_rss.php

Co-authored-by: Martin <spleefer90@gmail.com>

Co-authored-by: Martin Rys <martin@rys.pw>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-02-05 21:59:21 +01:00
Alexis Degrugillier
0577bc772b Add a method to retrieve a configuration value (#3422)
This will simplify extension code by removing a lot of logic from
the extension itself when it's not needed. I've tested it on one
of my extension with all the other recent extension modifications
and I could remove half of the code needed before.
2021-02-05 18:29:37 +01:00
Alexis Degrugillier
36f9d44d54 Fix user configuration in extension (#3412)
Before, only one extension could be configured at a time. Thus we
were loosing the configuration for other extensions when saving.
Now, each extension can be saved without overriding data.

See #3397
2021-02-02 12:40:03 +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
45ee7a36d5 PHP8: SimplePie wrong use of isset (#3404)
#fix https://github.com/FreshRSS/FreshRSS/issues/3401 (crash with PHP 8+)

`ceil()` crashes in PHP8+ in case of invalid input such as empty string.
`intval()` fixes the problem with almost identical behaviour than `ceil()` in PHP7- (except for floating point values)

#fix FreshRSS/FreshRSS#3401 (crash with PHP 8+)

Example with feed http://podcast.hr2.de/derTag/podcast.xml

```xml
<enclosure url="https://mp3podcasthr-a.akamaihd.net:443/mp3/podcast/derTag/derTag_20210129_87093232.mp3"
length="" type="audio/mpeg"/>
```

`isset("")` passes and then `ceil("")` crashes due to wrong type in PHP8+:

```
Uncaught TypeError: ceil(): Argument #1 ($num) must be of type
int|float, string given in ./SimplePie/SimplePie/Item.php:2871
```

Upstream patch https://github.com/simplepie/simplepie/pull/670
2021-01-31 13:04:36 +01:00