88 Commits

Author SHA1 Message Date
Alexandre Alapetite
00cd5df294 Use native PHP #[Deprecated] (#8325)
https://php.watch/versions/8.4/Deprecated
And enfore it with PHPUnit + PHPStan.
Especially useful for extensions.
2025-12-17 10:11:18 +01:00
Alexandre Alapetite
a8a544a2a2 Fix search encoding and quoting (#8311)
Revised the encoding approach for searches: the HTML encoding is done just before its use for DB search.
Fix also some cases with wrong quoting.
Fix https://github.com/FreshRSS/FreshRSS/pull/8306#issuecomment-3643865439
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8293
2025-12-13 11:31:34 +01:00
Alexandre Alapetite
b6c63d2239 Better transitions between groups of articles (#8174)
fix https://github.com/FreshRSS/FreshRSS/issues/7520
fix https://github.com/FreshRSS/FreshRSS/issues/8168
fix https://github.com/FreshRSS/FreshRSS/discussions/8172
2025-11-04 12:49:21 +01:00
Alexandre Alapetite
f08f7dcff9 Sort by article length (#8119)
* Sort by article length
fix https://github.com/FreshRSS/Extensions/issues/378
Very basic using simply SQL `LENGTH()` function.

<img width="492" height="217" alt="image" src="https://github.com/user-attachments/assets/7cf37303-76c8-4411-b8b1-075e81535b60" />

* Improve content length retrieval
2025-10-16 21:15:44 +02:00
Federico Scodelaro
673067a52d Last user modified (#7886)
* feat: Add user modified functionality

Closes https://github.com/FreshRSS/FreshRSS/issues/7862

Changes proposed in this pull request:

This is an implementation of the proposed feature. It allows entries to have a new field that will be updated whenever an item is marked as read/unread or bookmark/removed from bookmarks. And a new sort criteria to sort by it.

How to test the feature manually:

1. Mark items from a feed as read/unread
2. Mark items from a feed as bookmark / remove bookmark
3. Sort by the new criteria

* feat: Add sort functionality
* feat: Add sort nav button
* fix: Use correct migrations
* fix: Add internationalization
* fix: Linter errors
* chore: PR comments

* Update app/i18n/fr/index.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update app/i18n/pl/index.php
Co-authored-by: Inverle <inverle@proton.me>

* Update app/i18n/nl/index.php
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* make fix-all
* Fixes
* More fixes sort
* Fix wrong index
* Fix unneeded column
* Fix auto-create indexes
* Some copilot suggestions
* One more fix
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-10-11 00:43:38 +02:00
Alexis Degrugillier
b6f4276c6c Change regional language codes (#8065)
* Change regional language codes

According to `ISO-639-1` and `ISO-3166-1 alpha-2` recommendations, regional
languages must be written with the language code in lowercase and the region
in uppercase. For instance, we should have `en-US` instead of `en-us`.

Folders have been updated to reflect those recommendations and regional
language codes have been updated in the translation files.

* Update README files

* Fix configuration for typos

* Revert language order in documentation

* Remove unnecessary code

* Change language configuration getter

* Fix phpstan error

* Fix typo

* Add types

* escape regex

* Move language logic to avoid magic or deprecated methods

* Minor fix on regex
2025-10-06 21:09:01 +02:00
Alexandre Alapetite
34532c0dd4 Add new visibility priority *Show in its feed* (#7972)
* Add new visibility priority *Show in its feed*
fix https://github.com/FreshRSS/FreshRSS/pull/7970#issuecomment-3293917428 (you can't directly filter a hidden feed, it just shows a 404 page)
And add a new visibility *Show in its feed* to show the feed in the list but not its articles.
Ensure that visibility *hidden* is not shown to API.

* TODO for later

* Update app/i18n/pl/sub.php

Co-authored-by: Inverle <inverle@proton.me>
2025-09-30 10:05:17 +02:00
Alexandre Alapetite
f8310a587c Clarify: Visibility hidden vs. archived (#7970)
fix https://github.com/FreshRSS/FreshRSS/issues/7887
We have two concepts: how much a feed is shown or not (controlled by priority), and how often a feed is refreshed (or not, in which case it is archived).
This PR removes the wording *Archived* from the *visibility* parameter, since this is not what it does.
2025-09-15 23:43:46 +02:00
Inverle
87879e8392 Improve leave validation (#7830)
* Improve leave validation

* array_key_exists -> isset

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-08-31 19:09:02 +02:00
Inverle
e33ef74af9 before_login_btn hook + system conf attributes (#7761)
* `before_login_btn` hook + system conf attributes

* phpstan fix

* Refactoring

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-07-30 08:03:04 +02:00
Alexandre Alapetite
5f61e426dc Sort by category title, feed title (#7702)
* Sort by category name, feed name
fix https://github.com/FreshRSS/FreshRSS/issues/7698
Note that sorting is done with the default SQL collation for now, meaning that lower-case vs. upper-case and diacritics are influencing the sorting order. Improvements left for future work.
Watch out that those sorting criteria are slower due to additional joins, additional requests, and poorer indexes.

* i18n:pl

Co-authored-by: Inverle <inverle@proton.me>

* i18n: nl

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

* Fix preserve sort

---------

Co-authored-by: Inverle <inverle@proton.me>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-07-15 12:39:51 +02:00
dependabot[bot]
0cd23cca7c Bump phpstan/phpstan from 2.1.11 to 2.1.13 (#7534)
* Bump phpstan/phpstan from 2.1.11 to 2.1.13

Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 2.1.11 to 2.1.13.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/2.1.11...2.1.13)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.13
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump phpstan/phpstan from 2.1.11 to 2.1.13

Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 2.1.11 to 2.1.13.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/2.1.11...2.1.13)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.13
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix PHPStan

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-05-01 11:50:12 +02:00
maTh
a697ca54ad Shortcuts for adding labels (#7274)
* add shortcut in config

* open my labels menu with shortcut

* the first 9 items are selectable + input field

* i18n

* Update app/i18n/nl/conf.php

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

* index.menu.mylabels

* order fixed

---------

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-02-03 08:47:25 +01:00
Alexandre Alapetite
5368f38753 Reduce undeeded use of elvis operator ?: (#7204) 2025-01-10 08:13:09 +01:00
Alexandre Alapetite
1f466d7a2e Implement custom order-by (#7149)
Add option to sort results by received date (existing, default), publication date, title, URL (link), random.

fix https://github.com/FreshRSS/FreshRSS/issues/1771
fix https://github.com/FreshRSS/FreshRSS/issues/2083
fix https://github.com/FreshRSS/FreshRSS/issues/2119
fix https://github.com/FreshRSS/FreshRSS/issues/2596
fix https://github.com/FreshRSS/FreshRSS/issues/3204
fix https://github.com/FreshRSS/FreshRSS/issues/4405
fix https://github.com/FreshRSS/FreshRSS/issues/5529
fix https://github.com/FreshRSS/FreshRSS/issues/5864
fix https://github.com/FreshRSS/Extensions/issues/161

URL parameters:
* `&sort=id` (current behaviour, sorting according to newest received articles)
* `&sort=date` (publication date, which is not indicative of how new an article is)
* `&sort=title`
* `&sort=link`
* `&sort=rand` (random order - which disables infinite scrolling, at least for now)

combined with `&order=ASC` or `&order=DESC`

![image](https://github.com/user-attachments/assets/2de5aef1-604e-4a73-a147-569f6f42a1be)

## Implementation notes

The sorting criteria by *received date* (id), which is the default, and which was the only one before this PR, is the one that has the best sorting characteristics:
* *uniqueness*: no entries have the exact same received date
* *monotonicity*: new entries always have a higher received date
* *performance*: this field is efficiently indexed in database for fast usage, including for paging (indexing could also be done to other fields, but with lower effective performance)

In contrary, sorting criteria such as by *publication date*, by *title*, or by *link* are neither unique nor monotonic. In particular, multiple articles may share the same *publication date*, and we may receive articles with a *publication date* far in the future, and then later some new articles with a *publication date* far in the past.

To understand why sorting by *publication date* is problematic, it helps to think about sorting by *title* or by *link*, as sorting by *title* and by *publication date* share more or less the same characteristics.

### Problem 1: new articles

New articles may be received in the background after what is shown on screen, and before the next user action such as *mark all as read*. Due to the lack of *monotonicity* when sorting by e.g. *publication date* or *title*, users risk marking as read a batch of articles containing some fresh articles without seeing them.

Mitigation: A parameter `idMax` tracks the maximum ID related to a batch of actions such as *mark all as read* to exclude articles received after those that are displayed.

### Problem 2: paging / pagination

When navigating articles, only a few articles are displayed, and a new "page" of articles needs to be received from the database when scrolling down or when clicking the button to show more articles. When sorting by e.g. *publication date* or *title*, it is not trivial to show the next page without re-showing some of the same articles, and without skipping any. Indeed, views are often with additional criteria such as showing only unread articles, and users may mark some articles as read while viewing them, hereby removing some articles from the previous pages. And like for *Problem 1*, new articles may have been received in the background. Consequently, it is not possible to use `OFFSET` to implement pagination (so the patches suggested by a few users were wrong due to that, in particular).

Mitigation: `idMax` is also used (just like for *Problem 1*) and a *Keyset Pagination* approach is used, combining an unstable sorting criterion such as *publication date* or *title*, together with *id* to ensure stable sorting. (So, 2 sorting criteria + 1 filter criteria)

See e.g. https://www.alwaysdeveloping.net/dailydrop/2022/07/01-keyset-pagination/

### Problem 3: performance

Sorting by anything else than *received date* (id) is doomed to be slow(er) due to the combination of 3 criteria (see *Problem 2*). An `OFFSET` approach (which is not possible anyway as explained) would be even slower. Furthermore, we have no SQL index at the moment, but they would not necessarily help much due to the multiple sorting criteria needed and involving some `OR` logic which is difficult to optimise for databases.

The nicest syntax would be using tuples and corresponding indexes, but that is poorly supported by MySQL https://bugs.mysql.com/bug.php?id=104128

Mitigation: a compatibility SQL syntax is used to implement *Keyset Pagination*

### Problem 4: user confusion

Several users have shown that they do not fully understand the difference between *received date* and *publication date*, and particularly not the pitfalls of *publication date*.

Mitigation: the menus to mark-as-read *before 1 day* and *before 1 week* are disabled when sorting by anything else than *received date*. Likewise, the separation headers *Today* and *Yesterday* and *Before yesterday* are only shown when sorting by *received date*.

Again here, to better understand why, it helps to think about sorting by *title* or by *link*, as sorting by *title* and by *publication date* share more or less the same characteristics.

* [ ] We should write a Q&A and/or documentation about the problems associated to *sorting by publication date*: risks of not noticing new publication, of inadvertently marking them as read, of having some articles with a date in the future hanging at the top of the views (vice versa when sorting in ascending order), performance, etc.

### Problem 5: APIs

Sorting by anything else than *received date* breaks the guarantees needed for a successful synchronisation via API.

Mitigation: sorting by *received date* is ensured for all API calls.
2025-01-06 16:00:00 +01:00
Alexandre Alapetite
c29cbb7b8b Fix regressions on some array structures (#7155)
regressions from https://github.com/FreshRSS/FreshRSS/pull/7131
fix https://github.com/FreshRSS/FreshRSS/issues/7154
2024-12-28 23:58:00 +01:00
Alexandre Alapetite
bbd81b3e7e Fix regression labels (#7150)
Regression from https://github.com/FreshRSS/FreshRSS/pull/7131
2024-12-27 13:02:10 +01:00
Alexandre Alapetite
b1d24fbdb7 PHPStan 2.0 (#7131)
* PHPStan 2.0
fix https://github.com/FreshRSS/FreshRSS/issues/6989
https://github.com/phpstan/phpstan/releases/tag/2.0.0
https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md

* More

* More

* Done

* fix i18n CLI

* Restore a PHPStan Next test
For work towards PHPStan Level 10

* 4 more on Level 10

* fix getTagsForEntry

* API at Level 10

* More Level 10

* Finish Minz at Level 10

* Finish CLI at Level 10

* Finish Controllers at Level 10

* More Level 10

* More

* Pass bleedingEdge

* Clean PHPStan options and add TODOs

* Level 10 for main config

* More

* Consitency array vs. list

* Sanitize themes get_infos

* Simplify TagDAO->getTagsForEntries()

* Finish reportAnyTypeWideningInVarTag

* Prepare checkBenevolentUnionTypes and checkImplicitMixed

* Fixes

* Refix

* Another fix

* Casing of __METHOD__ constant
2024-12-27 12:12:49 +01:00
Alexandre Alapetite
897e4a3f4a Search in all feeds (#7144)
* Search in all feeds
Search in PRIORITY_ARCHIVED with `&get=A`
fix https://github.com/FreshRSS/FreshRSS/discussions/7143

* Fix type

* Search in PRIORITY_ARCHIVED with `&get=Z`

* More

* Fixes

* One more fix

* Extra features in user queries

* Move i18n key

* Fix overview

* Enlarge query boxes

* Revert i18n spelling

* i18n: it

Thanks @UserRoot-Luca

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>

---------

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
2024-12-27 12:03:59 +01:00
Alexandre Alapetite
6b14a743cc New state: favorite or unread (#7088)
* New state: favorite or unread
https://github.com/FreshRSS/FreshRSS/discussions/7078#discussioncomment-11526292

* Experiment using this state by default

* Rework state

* Allow ANDS for typos

* Revert change unrelated to this PR

* Revert change of default state

* Add option *unread_or_favorite*

* Fix hide_read_feeds

* i18n: it

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>

* Update app/i18n/pl/conf.php

Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>

* Update app/i18n/pl/conf.php

Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>

* Fix i18n

* Fix auto_remove_article

* Fix mark_unread_enabled

---------

Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>
2024-12-15 12:34:18 +01:00
Luc SANCHEZ
15745d42b7 Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code

Upgrade code to php 8.1

* fix remarques

* code review

* code review

* code review

* Apply suggestions from code review

* code review

* Fixes

* Many remainging updates of array syntax

* Lost case 'reading-list'

* Uneeded PHPDoc

---------

Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-11-28 17:11:04 +01:00
Mike
24a4fcb5c3 Add move to next unread Label on mark as read. (#6886)
* Add move to next unread Label on mark as read.

The Labels, unlike the Feeds and Categories, don't move to the next
unread when "move to next unread on mark all as read" user feature is
enabled.
Labels are more complex than Feeds and Categories because Entries can be
in more than Label at a time. So when marking all Entries in the Label
as read, it can cause other Labels to end up with all their Entries
marked as read as well. The calculation of what the next
Label/Feed/Category is to jump to normally happens when generating the
link for the "Mark as Read" buttons, but it can't for Labels.

To address the problem for Labels, use a placeholder value during the
pre-calculation of the "Mark as Read" button link. When that placeholder
value is encountered during the "Mark as Read" action, the next Label
with unread Entries will be calculated immediately after the mark as
read action has been processed.

Fix all the translations of the 'jump_next' text to remove the '(feed or
categories' part that no longer applies.
Attempt to fix the inconsistent Russian, Italian, and Polish
translations of 'jump_next' text, which phrased the '(feed or
categories)' part differently.

* Minor code formattting

* Fixes

* Optimize next label lookup.

Only get the tag list once, and actually error check that it returned successfully.
Fix a typo in a comment as well.

* Fix fallback when all Labels are read.

Fix the missing check for whether we're in the fallback case or not.

* Update app/i18n/ru/conf.php

* Update app/Controllers/entryController.php

* Minor changes

* One more minor

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-10-17 10:38:25 +02:00
Alexandre Alapetite
a81656c3ed Upgrade to PHP 8.1 (#6711)
* Upgrade to PHP 8.1
As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474

https://www.php.net/releases/8.0/en.php
https://www.php.net/releases/8.1/en.php

Upgrade to available native type declarations
https://php.net/language.types.declarations

Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore)

Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22.

* Include 6736
https://github.com/FreshRSS/FreshRSS/pull/6736
2024-09-06 09:06:46 +02:00
Alexandre Alapetite
d2247221bb Minor update whitespace PHPCS rules (#6666)
* Minor update whitespace PHPCS rules
To simplify our configuration, apply more rules, and be clearer about what is added or removed compared with PSR12.
Does not change our current conventions, but just a bit more consistent.

* Forgotten *.phtml

* Sort exclusion patterns + add a few for Extensions repo

* Relaxed some rules
2024-08-01 20:31:40 +02:00
Alexandre Alapetite
ea2bcf3a5d Fix individual OMPL feed export (#6435)
fix https://github.com/FreshRSS/FreshRSS/issues/6433
2024-05-07 23:04:17 +02:00
Alexandre Alapetite
39cc1c11ec New feature: shareable user query (#6052)
* New feature: shareable user query
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs.
Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people.
Also add a new HTML output for people without an RSS reader.

fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890
fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504

* Remove unused method

* Fix token saving

* Implement HTML view

* Update i18n for master token

* Revert i18n get_favorite

* Fix missing i18n for user queries from before this PR

* Remove irrelevant tests

* Add link to RSS version

* Fix getGet

* Fix getState

* Fix getSearch

* Alternative getSearch

* Default getOrder

* Explicit default state

* Fix test

* Add OPML sharing

* Remove many redundant SQL queries from original implementation of user queries

* Fix article tags

* Use default user settings

* Prepare public search

* Fixes

* Allow user search on article tags

* Implement user search

* Revert filter bug

* Revert wrong SQL left outer join change

* Implement checkboxes

* Safe check of OPML

* Fix label

* Remove RSS button to favour new sharing method
That sharing button was using a global admin token

* First version of HTTP 304

* Disallow some recusrivity
fix https://github.com/FreshRSS/FreshRSS/issues/6086

* Draft of nav

* Minor httpConditional

* Add support for offset for pagination

* Fix offset pagination

* Fix explicit order ASC

* Add documentation

* Help links i18n

* Note about deprecated master token

* Typo

* Doc about format
2024-02-26 09:01:03 +01:00
Alexandre Alapetite
314077a457 PHPStan prepare exceptions (#6037)
Take advantage of
https://phpstan.org/blog/bring-your-exceptions-under-control

Minimum changes to pass `tooWideThrowType` and `implicitThrows`.

Revert some mistakes from:
https://github.com/FreshRSS/FreshRSS/pull/5504
Preparation needed before new PRs of the same type:
https://github.com/FreshRSS/FreshRSS/pull/5962

Fix several wrong PHPDocs and catches:

> Method ... has ...Exception in PHPDoc @throws tag but it's not thrown.

> Dead catch - ...Exception is never thrown in the try block.
2024-01-15 10:36:30 +01:00
Alexandre Alapetite
d65f77c081 More robust assignment of categories to feeds (#5986)
Several minor cases, none of which should really be necessary
Might help:
https://github.com/FreshRSS/FreshRSS/issues/5981
https://github.com/FreshRSS/FreshRSS/issues/5982
2023-12-27 15:18:36 +01:00
Alexandre Alapetite
a80a5f48a1 Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels

* Revert wrong replace in comment

* Fix PHPStan level 8

* Update PHPStan and other dev dependencies

* Remove obsolete comment

* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge

* More bleedingEdge

* A bit more PHPStan level 9

* More PHPStan level 9

* Prepare for booleansInConditions
Ignore int and null

* Revert wrong line

* More fixes

* Fix keep_max_n_unread

* Stricter attribute functions

* Stricter callHooks and more PHPStan level 9

* More typing

* A tiny more
2023-12-18 17:59:16 +01:00
Luc SANCHEZ
30c7a61a9b Use strict_types (#5830)
* Little's optimisations and booleans in conditions

* Apply strict type

* Apply strict type

* Apply strict type

* Fix multiple bugs with PHP 8.2 and 8.3

* Many declares missing, more errors fixed

* Apply strict type

* Another approach

* Stronger typing for Minz_Session

* Fix case of SQLite

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-16 22:43:00 +01:00
Alexandre Alapetite
348028a290 New feature important feeds (#5782)
* New feature important feeds

* Fix PHPStan

* Initial style for important feeds + keep unread

* Change UI order

* Count important unread

* Never mark as read important feeds during scroll

* Fix i18n conf.iew.normal regression

* Fix reader view

* More fix reader view

* Create important.svg

* Fix title

* Fix counter

* Account for important during  mark-all-as-read

* Fix underline colour

* 📌

* Changelog

---------

Co-authored-by: math-gh <>
Co-authored-by: maTh <1645099+math-GH@users.noreply.github.com>
2023-11-08 20:23:54 +01:00
Alexandre Alapetite
06d0099504 Require PHP 7.4+ (#5720)
* Require PHP 7.4+
https://github.com/FreshRSS/FreshRSS/discussions/5474

* Update Docker oldest
Alpine 3.13 with PHP 7.4.26

* Add missing packets to Docker oldest

* Update to typed properties
https://php.net/migration74.new-features#migration74.new-features.core.typed-properties

* More types
2023-10-30 20:47:27 +01:00
berumuron
54592fa1fd fix: Fix the "Show all articles" option (#5580) 2023-08-10 17:02:47 +02:00
Luc SANCHEZ
f8f163d054 Chore/processing of depreciations and updating code to php72 minimum (#5504)
* processing of depreciations and updating of code to php7.2 minimum

* Autoformat many strange array indenting
And revert a few unwanted changes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-07-07 22:36:27 +02:00
Alexandre Alapetite
6e2f2f1c1e A few additional PHPStan rules (#5388)
A subset of
https://github.com/phpstan/phpstan-strict-rules
2023-05-11 13:02:04 +02:00
Alexandre Alapetite
bd9fa803f1 PHPStan Level 7 complete DAOs (#5354)
* PHPStan Level 7 complete DAOs

* Finalise PHPStan Level 7 for CategoryDAO

* PHPStan Level 7 for Context and Search

* Apply suggestions from code review

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>
2023-05-02 14:38:32 +02:00
Alexandre Alapetite
f3760f138d Complete PHPStan Level 6 (#5305)
* Complete PHPStan Level 6
Fix https://github.com/FreshRSS/FreshRSS/issues/4112
And initiate PHPStan Level 7

* PHPStan Level 6 for tests
* Use phpstan/phpstan-phpunit
* Update to PHPStan version 1.10

* Fix mixed bug

* Fix mixed return bug

* Fix paginator bug

* Fix FreshRSS_UserConfiguration

* A couple more Minz_Configuration bug fixes

* A few trivial PHPStan Level 7 fixes

* A few more simple PHPStan Level 7

* More files passing PHPStan Level 7
Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251

* A few more PHPStan Level 7 preparations

* A few last details
2023-04-17 08:30:21 +02:00
Alexandre Alapetite
dbbae15a84 Remove ConfigurationSetter (#5251)
This class has not been maintained for a while. Only a subset of our configuration properties are there, and some code is not relevant anymore. Furthermore, it is relying exclusively on dynamically invoked functions, making it challenging to maintain, in particular to find out what is used and what is not, what is handled and what is not.
It is not well suited for changes in data formats, which have been handled in the Context class instead.
It is also not able to handle configuration properties that are missing.
It is the class with most errors for PHPStan level 6 (179 errors). It is also making intense use of is_callable and call_user_func_array, which are performance killers.
Should the need arrise again to perform validation of our internal configuration files, I suggest an implementation with the opposite approach, namely driven by our code instead of driven by the data.
In summary, at the moment, this class is costly, while not offering many guarantees.
2023-04-07 12:40:43 +02:00
Alexandre Alapetite
6c01e4e7d6 Use typed access to request parameters (#5267)
* Use typed access to request parameters
This was a big source of mixed datatypes in many places

* Fix notifications

* Fix bookmarkAction
2023-04-07 00:13:49 +02:00
Luc SANCHEZ
ac3dd96f48 Cleaning code and typehinting (#5064)
* Cleaning code and typehinting

* Fix remarque alphabetic order

* Cleaning

* rollback self::

* Update Context.php

* Fix remarques

* Fix remarques

* Fix remarques

* Remarque's from Alkarex

* Remarque's from Alkarex

* Cast higher up

* Fix Level 5

* Claiming Level 6
Cf. https://github.com/FreshRSS/FreshRSS/pull/5230

* Address my comments

* indexController as Level 6 as well

* Fixed some wrong types

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-03-27 01:12:45 +02:00
Luc SANCHEZ
5f898dcc5e Modernize Constants and use new constant for string 'currentUser' (#5089)
* Modernize Constants and use new constant 'currentUser'

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Add FreshRSS_Context::currentUser() function and use

* Update app/Controllers/userController.php

* Update app/Controllers/userController.php

* Update app/Controllers/userController.php

* Update app/Models/Auth.php

* Update p/api/greader.php

* Update p/api/greader.php

* Update p/api/greader.php

* Update app/Models/Context.php

* Update app/Models/LogDAO.php

* Update lib/Minz/Log.php

* Update p/api/greader.php

* Update app/layout/header.phtml

* Update app/views/helpers/export/articles.phtml

* Update cli/do-install.php

* Remarque's from Alkarex

* Remarque's from Alkarex

* Refactor using new Minz_User class

* Consistent naming of public constants

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-03-26 14:17:22 +02:00
Alexandre Alapetite
dbdb7869c4 Safer timezone set (#5021)
* Safer timezone set
Add missing tzdata in Docker :newest
Fallback to UTC if no timezone is defined at all
#fix https://github.com/FreshRSS/FreshRSS/pull/4906#issuecomment-1386747169

* Better refactoring
Show fallback timezone everywhere
2023-01-19 18:26:04 +01:00
Alexandre Alapetite
42eeb402ad Fix type hints regressions (#4855)
Fix regressions from https://github.com/FreshRSS/FreshRSS/pull/4561

Example:

```
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to checkToken() must be an instance of FreshRSS_UserConfiguration, instance of Minz_Configuration given, called in /var/www/FreshRSS/p/api/greader.php on line 1091 and defined in /var/www/FreshRSS/p/api/greader.php:223
Stack trace:
#0 /var/www/FreshRSS/p/api/greader.php(1091): checkToken()
#1 {main}
  thrown in /var/www/FreshRSS/p/api/greader.php on line 223
```

Improvement of https://github.com/FreshRSS/FreshRSS/pull/4110
2022-11-15 15:42:26 +01:00
Luc SANCHEZ
d9e1c1c2c3 Typing function checkToken (#4561)
* Typing function checkToken

* Typing function and rename

Co-authored-by: Luc SANCHEZ <luc.sanchez@zol.fr>
2022-11-14 15:07:23 +01:00
maTh
4214954ea1 Improved: error page (#4465)
* error page: true HTML page

* error page: http500 erorr

* error page: add CSP header

* 'log.txt' replaced by LOG_FILENAME

* use ADMIN_LOG

* log.txt => LOG_FILENAME

* error message: add <title>

* Docs created

* delete: documentation on error message page

* line break added

* added: new line at the end

* typo fixed

* Update lib/lib_rss.php

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

* Update lib/lib_rss.php

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

* Minz HTTP 500

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-08-21 22:44:03 +02:00
Alexandre Alapetite
09aeeeb325 Refactor updateContext into its own FreshRSS_Context class (#4496)
So that it is both cleaner and easier to call from other controllers and extensions
2022-08-10 09:37:11 +02:00
Alexandre Alapetite
82ac1d1e67 Refactor entry-to-GReader API format (#4490)
* Refactor entry to GReader API format
Some code was copied in two locations and not completely uniform.
Cleaning of related variables and functions (e.g. better types for entries and categories as objects vs. as IDs).
Usecase: I need to call the same GReader-compatible serialization from an extension

* Fixed some edge cases

* Keep summary instead of content
`summary` and `content` seems to be used interchangeably in the Google Reader API. We have been using `summary` for our client API and  `content` in our export/import, so stick to that.
2022-08-08 12:04:02 +02:00
Alexandre Alapetite
509c8cae63 Dynamic OPML (#4407)
* Dynamic OPML draft
#fix https://github.com/FreshRSS/FreshRSS/issues/4191

* Export dynamic OPML
http://opml.org/spec2.opml#1629043127000

* Restart with simpler approach

* Minor revert

* Export dynamic OPML also for single feeds

* Special category type for importing dynamic OPML

* Parameter for excludeMutedFeeds

* Details

* More draft

* i18n

* Fix update

* Draft manual import working

* Working manual refresh

* Draft automatic update

* Working Web refresh + fixes

* Import/export dynamic OPML settings

* Annoying numerous lines in SQL logs

* Fix minor JavaScript error

* Fix auto adding new columns

* Add require

* Add missing 🗲

* Missing space

* Disable adding new feeds to dynamic categories

* Link from import

* i18n typo

* Improve theme icon function

* Fix pink-dark
2022-07-04 09:53:26 +02:00
Alexandre Alapetite
ec11da4e84 Safer htmlspecialchars_utf8 (#4411)
* Safer htmlspecialchars_utf8
#fix https://github.com/FreshRSS/FreshRSS/issues/4410

* Undefined variable
2022-06-11 22:14:46 +02:00
Alexandre Alapetite
8808fb4545 Fix keep state after favourites tags (#4178)
* Fix keep state after favourites tags
#fix https://github.com/FreshRSS/FreshRSS/issues/4124 regression

* Optimisation
2022-01-29 14:19:16 +01:00