Commit Graph

218 Commits

Author SHA1 Message Date
Alexandre Alapetite
946b0a0876 Hot fix: fix type hint null regression (#4207) 2022-02-07 01:35:29 +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
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
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
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
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
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
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
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
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
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
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
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
Eris
180ca4d168 Curlopt fixes (#3381)
* sort results in find() method

* Update lib/lib_phpQuery.php

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Update lib/lib_phpQuery.php

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Fix fetching articles

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-01-17 18:32:24 +01:00
Eris
ee175dd616 CURLOPT parameters per feed (#3367)
* Working curlopt_params

* Examples

* curl_params for fetching the article

* cleanup

* clarification

* Remove debugging

* Options corrected

* Removed Debugging

* i18n not needed (right now)

* Translations and UI rework

* Checks in update.phtml

* Unset Proxy&Cookies

* remove clutter

* minor fuckup

* i18n added properly

* resolve Errors

* linting errors

* linting errors, again

* Review

* Minor revert

* Minor i18n: de

Co-authored-by: maru <maru@nyx.im>
Co-authored-by: Aeris <a3x@eris.cc>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-01-16 22:32:18 +01:00
Alexis Degrugillier
29fe125b4a Add constant for PHP requirements (#3369)
* Add constant for PHP requirements

This new constant is used for PHP version check.
This way, we won't forget to modify some part of the code base.

* Remove PHP version checks

Some checks were obsolete because they were checking unsupported
PHP versions.
2021-01-14 23:28:45 +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
c246e5d74b Revert "Extract autoloading process (#3283)"
This reverts commit 46cb89adf8.
2020-12-28 19:47:39 +01:00
Alexandre Alapetite
f7d69ad1de SimplePie Strip comments (#3288)
#fix https://github.com/FreshRSS/FreshRSS/issues/3282 (workaround an nginx configuration bug)

We do not need to keep HTML comments in RSS content.
2020-12-28 13:09:14 +01:00
Alexis Degrugillier
46cb89adf8 Extract autoloading process (#3283)
* Extract autoloading process

The process sits in its own file now to ease future improvements.

* Change the autoload process

Before, the autoload process was too restricted. It was really dependant on our
code tree. It was hard to add more classes to be loaded automatically. On top
of that, it did not support autoloading classes following the PSR-4 recommendation.

Now, the autoload process is more open. It supports partially the PSR-4 recommendation,
there is no specific code to load Minz classes or PHPMailer classes. This is the
starting point to reorganize the codebase to introduce long waiting changes as seen
in #789. It would be a nice to later rework the tree, rename classes, and add namespace
in a fashion that follows the PSR-4. Then specific FRSS workarounds in the autoload
could be dropped.
2020-12-26 12:47:39 +01:00
Alexandre Alapetite
f33e261163 Fix sanitize feed description (#3222)
* Fix sanitize feed description

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

* Simplification
2020-10-11 13:32:23 +02:00
Alexandre Alapetite
be5f9f2dce When ssl_verify is false, decrease SSL security (#3171)
When ssl_verify option is set to false for a feed, allow lower security such as SHA-1 signatures.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900984
https://stackoverflow.com/questions/58342699/php-curl-curl-error-35-error1414d172ssl-routinestls12-check-peer-sigalgwr
Fix error of type `cURL error 35: error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature`
Example of feeds:
https://www.version2.dk/it-nyheder/rss
https://ing.dk/rss/nyheder
2020-09-03 10:35:23 +02:00
Alexandre Alapetite
c523f5a4e7 Relaxed to allow underscore _ in URL hostnames (#3133)
* Relaxed to allow underscore _ in URL hostnames

#fix https://github.com/FreshRSS/FreshRSS/issues/3132
https://bugs.php.net/bug.php?id=64948

* Minor fix in favicons redirect

* Minor fix in relative HREF for favicons
2020-07-31 16:33:45 +02:00
Alexis Degrugillier
35eed83b64 Add a way to disable shortcuts (#3114)
When the user do not want to use a shortcut, he can let the shortcut value
empty. This will save an empty configuration thus disabling the shortcut.
The load default action allows to use default shortcut only for disabled
shortcuts.

See #3110
2020-07-14 11:02:30 +02:00
Alexandre Alapetite
2aff347b2e Fix wrong getHeader refactoring (#2749)
* Fix wrong getHeader refactoring

Fix regression introduced by
https://github.com/FreshRSS/FreshRSS/pull/2373
The refactoring required a call to init() even for static functions,
which is most of the time not done.
Removed premature abstraction of `$_SERVER`, which was the root cause of
the bug.
https://github.com/FreshRSS/FreshRSS/issues/2748#issuecomment-569898931

* Refactoring: Move serverIsPublic to Minz_Request

* Add mitigations for wrong configurations

Due to the regression, we have some existing configurations with a bad
base_url

* Forgot one instance
2020-01-04 23:35:42 +01:00
Alexandre Alapetite
acc50df0ef Fix logging environment constants (#2745)
* Fix logging environment constants

* COPY_LOG_TO_SYSLOG was only working when Syslog was used
* FRESHRSS_ENV was not properly used to set logging level

* Simplify code

Always call `openlog()` even when it is not used

* Always specify syslog properties

https://github.com/FreshRSS/FreshRSS/pull/2745#discussion_r362207445

* $username is also needed further down

* No new line in syslog
2020-01-03 18:50:33 +01:00
Alexandre Alapetite
b0ef856361 Old ICU: INTL_IDNA_VARIANT_2003 fallback (#2680)
* Old ICU: INTL_IDNA_VARIANT_2003 fallback

Fix https://github.com/FreshRSS/FreshRSS/issues/2676
Fix https://github.com/FreshRSS/FreshRSS/issues/2677
ICU version < 4.6: When INTL_IDNA_VARIANT_UTS46 is not available, use INTL_IDNA_VARIANT_2003
Cf. https://github.com/PrestaShop/PrestaShop/pull/11995
2019-11-20 20:43:16 +01:00
Alexandre Alapetite
bec7566429 Sanitize UTF-8 before commiting entries (#2649)
Fix https://github.com/FreshRSS/FreshRSS/issues/2645
2019-11-11 19:48:45 +01:00
Alexandre Alapetite
fdfd8ce9be Workaround for MySQL limitation 1093 (#2586)
* Workaround for MySQL limitation 1093
https://github.com/FreshRSS/FreshRSS/pull/2335#issuecomment-545194606
including minor Travis fixes
2019-10-23 02:12:49 +02:00
Alexis Degrugillier
cc0db9af4f Feature/new archiving (#2335)
* Change archiving config page layout

I've changed some wording and moved actions into a
maintenance section.

* Update purge action

Now we have more control on the purge action. The configuration allows
us to choose what to keep and what to discard in a more precise way.
At the moment, the configuration applies for all feeds.

* Add purge configuration on feed level

Now the extend purge configuration is available on feed level.
It is stored as attributes and will be used in the purge action.

* Update purge action

Now the purge action uses the feed configuration if it exists and
defaults on user configuration if not.

* Add empty option in period list

* Fix configuration warnings

* Add archiving configuration on categories

See #2369

* Add user info back

* Add explanations in UI

* Fixes for SQLite + error + misc.

* Fix invalid feed reference

* Short array syntax

Only for new code, so far

* Fix prefix error

* Query performance, default values

Work in progress

* Fix default values and confirm before leaving

Form cancel and confirm changes before leaving were broken.
And start taking advantage of the short echo syntax `<?= ?>` as we have
moved to PHP 5.4+

* More work

* Tuning SQL

* Fix MariaDB + performance issue

* SQL performance

* Fix SQLite bug

* Fix some attributes JSON encoding bugs

Especially for SQLite export/import

* More uniform, fix bugs

More uniform between global, category, feed settings

* Drop special cases for old articles during refresh

Instead will use lastSeen date with the new archiving logic.
This was generating problems anyway
https://github.com/FreshRSS/FreshRSS/issues/2154

* Draft drop index keep_history

Not needed anymore

* MySQL typo

Now properly tested with MySQL, PostgreSQL, SQLite

* More work for legacy values

Important to avoid overriding user's preference and risking deleting
data erroneously

* Fix PHP 7.3 / 7.4 warnings

@aledeg "Trying to use values of type null, bool, int, float or resource
as an array (such as $null["key"]) will now generate a notice. "
https://php.net/migration74.incompatible

* Reintroduce min articles and take care of legacy parameters

* A few changes forgotten

* Draft of migration + DROP of feed.keep_history

* Fix several errors

And give up using const for SQL to allow multiple database types (and we
cannot redefine a const)

* Add keep_min to categories + factorise archiving logic

* Legacy fix

* Fix bug yield from

* Minor: Use JSON_UNESCAPED_SLASHE for attributes

And make more uniform

* Fix sign and missing variable

* Fine tune the logic
2019-10-23 00:52:15 +02:00
Alexandre Alapetite
e3e5954394 PDO refactoring for code simplification (#2522)
* PDO refactor

* Automatic prefix when using the syntax `_tableName`
* Uniformity: MySQL is now PDO::ATTR_EMULATE_PREPARES = false just like SQLite and PostgreSQL, with consequences such as only one statement per query
* Use PDO methods exec(), query(), prepare() + execute() in a more efficient way
* Remove auto-update SQL code for versions older than FreshRSS 1.5 (3 years old)
* The name of the default category is set in PHP instead of in the DB (simplies SQL and allows changing the name according to the FreshRSS language)
* Rename `->bd` to `->pdo` (less of a frenshism, and more informative)
* Fix some requests, which were not compatible with MySQL prepared statements

* Whitespace

* Fix syntax for PostgreSQL sequences

+ MySQL install

* Minor formatting

* Fix lastInsertId for PostgreSQL

* Use PHP 5.6+ const

Take advantage of https://github.com/FreshRSS/FreshRSS/pull/2527
https://www.php.net/manual/en/migration56.new-features.php

* A bit of forgotten PHP 5.6 simplification for cURL

* Forgotten $s

* Mini fix custom user config

https://github.com/FreshRSS/FreshRSS/pull/2490/files#r326290346

* More work on install.php but not finished

* install.php working

* More cleaning of PDO in install

* Even more simplification

Take advantage of PDO->exec() to run multiple statements

* Disallow changing the name of the default category

https://github.com/FreshRSS/FreshRSS/pull/2522#discussion_r326967724
2019-09-29 16:22:50 +02:00
Alexandre Alapetite
e761202f8a Remove JSON.php fallback (#2528)
After moving to PHP 5.6+ https://github.com/FreshRSS/FreshRSS/pull/2527
it should not be necessary to have the JSON.php fallback anymore, which
was mainly there due to an obscure licensing issue 6 years ago in Debian
https://wiki.debian.org/qa.debian.org/jsonevil , which broke Ubuntu
13.10 https://github.com/FreshRSS/FreshRSS/issues/306
2019-09-18 17:18:36 +02:00
Alexandre Alapetite
38117df976 Require PHP 5.6+
Discussion
https://github.com/FreshRSS/FreshRSS/pull/2495#issuecomment-531911473
Needed for constant arrays
https://www.php.net/manual/en/migration56.new-features.php which will be
used in https://github.com/FreshRSS/FreshRSS/pull/2522
2019-09-17 20:28:07 +02:00
Marien Fressinaud
75632e70f0 Provide email address verification feature (#2481)
* Add an email field to the profile page

I reuse the `mail_login` from the configuration. I'm not sure if it's
useful today (I would say it was used when Persona login was available).

A good improvement would be to rename `mail_login` into `email` so it
would be more intuitive to use.

* Add boolean to the conf to force email validation

This commit only adds a configuration item.

* Add email during registration if email must be validated

* Set email token to validate when email changes

* Block access to FreshRSS if email is not validated

* Send email when address is changed

* Allow to resend the validation email

* Allow the user to change its email while blocked

* Document the email validation feature

* fixup! Allow the user to change its email while blocked

* tec: Autoload PHPMailer lib

* Validate email address format

* Add feedback on validation email resend action

* Allow to logout when user is blocked

* fix: Change default email "from"

* Reorganize i18n keys

* Complete all the locales with default english

* Hide sidebar (profile page) if email is not validated

* Check email requirements on registration

* Allow admin to specify email when creating users

* Don't check email format if value is empty

* Remove trailing comma in userController

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Set PHPMailer validator to html5 before sending email

* fixup! Remove trailing comma in userController
2019-08-29 12:02:05 +02: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
295cb89af3 Fix PHP 5.5 compat for array const (#2360)
https://github.com/FreshRSS/FreshRSS/issues/2359
2019-04-07 21:39:48 +02:00
Alexandre Alapetite
912480fab8 Ensure sanitizeHTML gets a string (#2351)
Regression triggered by https://github.com/FreshRSS/FreshRSS/pull/2228
2019-04-06 16:07:19 +02:00
Alexandre Alapetite
d9e246ecf7 Shortcuts legacy (#2320)
Fix https://github.com/FreshRSS/FreshRSS/issues/2316
2019-04-02 00:08:51 +02:00
Alexis Degrugillier
f2925594c7 Add header to cli (#2296)
* Add header to cli

Now there is a switch to display the header on user info.
While doing that, I've changed how the command is working to display
all users by default and to accept more than one user at once.
I also changed the display to make it more pleasing.

As this command displays all users by default. I wonder if we still
need the list user command.

See #2294

* Minor format
2019-03-23 23:17:22 +01:00
Alexandre Alapetite
834ffacce2 No old ID (#2276)
* No old ID

https://github.com/FreshRSS/FreshRSS/issues/2273

* PostgreSQL insert or ignore
2019-03-19 20:14:31 +01:00
Alexandre Alapetite
b73d4c807f COPY_SYSLOG_TO_STDERR (#2213)
Update of https://github.com/FreshRSS/FreshRSS/pull/2208
Fixes https://github.com/FreshRSS/FreshRSS/issues/2212
2019-01-08 00:06:01 +01:00