Commit Graph

659 Commits

Author SHA1 Message Date
Alexandre Alapetite
467ca9d0de Specific HTML load for lib_phpQuery.php (#4243)
And reverts a less appropriate workaround for the same thing in https://github.com/FreshRSS/FreshRSS/pull/4220
Avoids XML errors when believing that a document might be XML/XHTML.
2022-03-01 16:03:44 +01:00
Alexandre Alapetite
1fe66ad020 Implement Web scraping "HTML + XPath" (#4220)
* More PHP type hints for Fever
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201
Related to https://github.com/FreshRSS/FreshRSS/issues/4200

* Detail

* Draft

* Progress

* More draft

* Fix thumbnail PHP type hint
https://github.com/FreshRSS/FreshRSS/issues/4215

* More types

* A bit more

* Refactor FreshRSS_Entry::fromArray

* Progress

* Starts to work

* Categories

* Fonctional

* Layout update

* Fix relative URLs

* Cache system

* Forgotten files

* Remove a debug line

* Automatic form validation of XPath expressions

* data-leave-validation

* Fix reload action

* Simpler examples

* Fix column type for PostgreSQL

* Enforce HTTP encoding

* Readme

* Fix get full content

* target="_blank"

* gitignore

* htmlspecialchars_utf8

* Implement HTML <base>
And fix/revert `xml:base` support in SimplePie e49c578817

* SimplePie upstream PR merged
https://github.com/simplepie/simplepie/pull/723
2022-02-28 20:22:43 +01:00
Alexandre Alapetite
946b0a0876 Hot fix: fix type hint null regression (#4207) 2022-02-07 01:35:29 +01:00
Alexandre Alapetite
354f22b4fa PHPStan update to 1.4.6 (#4203)
https://github.com/phpstan/phpstan/releases
And compose udpdate
2022-02-07 00:56:59 +01:00
Alexandre Alapetite
1c5cf71859 Fix Fever 32 bit ID issue + more PHP type hints (#4201)
* Fix Fever 32 bit ID issue + more PHP type hints
#fix https://github.com/FreshRSS/FreshRSS/issues/4200
Follow up and fix regression from https://github.com/FreshRSS/FreshRSS/pull/4110

* More PHP type hints with PHPStan

* Fix pull problem

* Avoid more nulls
2022-02-06 14:31:36 +01:00
maTh
cb36fe25a7 Improved: Fetch articles with selector but do not delete the class attribute. (Simplepie: new method: rename_attribute) (#4175)
* added to simplepie: rename_attributes

* rename the class attribute

* Update lib/SimplePie/SimplePie/Sanitize.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* added 'id' as attribute to rename to 'data-sanitized-id'

* Update lib_rss.php

* source code in sync with simplepie upstream

* fixed parameters

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-02-05 14:15:32 +01:00
Alexandre Alapetite
88b934da8b Fix root redirection (#4167)
* Fix root redirection
#fix https://github.com/FreshRSS/FreshRSS/issues/4126

* Smarter
2022-02-04 15:41:20 +01:00
Alexandre Alapetite
47e242aa77 Fix ctype_alnum (#4182)
* Fix ctype_alnum
#fix https://github.com/FreshRSS/FreshRSS/issues/4180
Ensure `ctype_alnum()` gets a string

* Changelog
2022-01-30 15:53:17 +01:00
berumuron
bc5271b0eb fix: Ignore non-PHP files in migrations/ folder (#4163)
Some NAS create folders named `@eaDir` in the FreshRSS tree, including
the `migrations/` folder. This broke the migration system which expected
only valid PHP files to be present in this folder. Now, it ignores
non-PHP files.

Reference: https://github.com/FreshRSS/FreshRSS/issues/4044
2022-01-17 13:13:27 +01:00
Alexandre Alapetite
3502e50cb2 Fix PHP 7.4 signature warnings (#4140)
Revert some type hints creating warnings in PHP 7.4 (not in PHP 7.0 nor PHP 8.1)
2022-01-09 19:02:12 +01:00
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