Commit Graph

114 Commits

Author SHA1 Message Date
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
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
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
0442243037 Fix nav_menu mark-as-read (#2909)
* Fix nav_menu mark-as-read

#Fix https://github.com/FreshRSS/FreshRSS/issues/2905
Fix regression from https://github.com/FreshRSS/FreshRSS/pull/2588

We need info about the first item (id_max) before being able to output
nav_menu. Before https://github.com/FreshRSS/FreshRSS/pull/2588 we used
to output everything in memory before starting to produce an output. Now
that we stream the output, we need a temporary buffer until we have
received the first item/article.

* Repair loading page

* Simplify CSS

Make it work in Chrome as well

* Lint

* Partial revert

* Base max_id solely on current time
2020-05-18 18:45:47 +02:00
Alexandre Alapetite
0f94402b7e Better performance with yield (#2588)
* Better performance with yield

Largely decrease the time to first byte, and reduced memory consumtion.
Before, we used to make several copies in memory of the whole list of
articles before sending them to the client. Now streamed as they are
processed.

* Travis
2020-02-29 18:19:09 +01:00
Marien Fressinaud
7802fd33a6 tec: Allow to change CSP header from controllers
For an extension, I needed to call a script from an external domain.
Unfortunately, the CSP headers didn't allow this domain and I had to
patch manually the FreshRSS FrontController for my extension. It's
obviously not a long-term solution since it has nothing to do in the
core of FRSS, and I don't want to apply this patch manually at each
update.

With this patch, I allow changing the CSP header from inside the
controller actions. It allows extensions to modify headers. It's also an
opportunity to remove a bit of code from the FrontController. I wasn't
happy with the previous implementation anyhow.

Reference: https://github.com/flusio/xExtension-Flus/commit/ed12d56#diff-ff12e33ed31b23bda327499fa6e84eccR143
2019-12-22 15:01:02 +01:00
Alexis Degrugillier
f6e10579f2 Add category order (#2592)
* Add category order

Each category has a new 'priority' attribute. It is used to sort categories in
views. Categories with the same priority are sorted alphabetically. Categories
with no priority are displayed after those with one.

For example, if we have the following categories:
- A (priority: 2)
- B (no priority)
- C (priority: 1)
- D (priority: 2)
- E (no priority)
- F (priority: 1)

They will be displayed in the following order:
- C
- F
- A
- D
- B
- E

See #190

* Shorten help text

It took too much room and will not be so necessary once we have drag &
drop
2019-10-26 13:16:15 +02:00
Marien Fressinaud
a2ed6626c2 Add support for terms of service
This feature is optional. It is based on the presence of a
`data/tos.html` file that an administrator can create. If this file
exists, FreshRSS will automatically add a "ToS" checkbox on the
registration page that users must check to be able to create their
account.
2019-09-17 09:21:23 +02:00
Marien Fressinaud
49e1a2c579 Allow to change the view layout (#2467)
The `_useLayout` function is marked as deprecated, replaced by a more
powerful `_layout` function.
2019-08-02 11:40:57 +02:00
Alexandre Alapetite
ad19b6bf2e Fix wrong mark-as-read maxId argument (#2431)
Fix https://github.com/FreshRSS/FreshRSS/issues/2429
2019-06-29 20:47:38 +02:00
Alexandre Alapetite
2374374ba9 Less jQuery (#2234)
* Less jQuery

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/2199

* Even less jQuery + global view unread title fix

* Even less jQuery

* Yet even less jQuery

* Even less jQuery

* Reduce some events

* Even less jQuery

* jQuery gone from main view

+Fixed English i18n

* Fix feed folded view

* Remove Firefox 64 workaround

Remove workaround for Gecko bug 1514498 in Firefox 64, fixed in Firefox
65

* Split to extra.js

Avoid loading unneeded JavaScript code for the main view.
+ several adjustements

* Improve CSS transition fold category

* Rewrite shortcuts

Remove library. Much faster, shorter, one listener instead of many.
Control of the shortcut context.
Fix https://github.com/FreshRSS/FreshRSS/issues/2215

* Remove debug

* Minor syntax

* Filter out unwanted shortcut modifiers

* Menu overflow fix

* Typo

* Fix unfolding in mobile view

* Remove jQuery from category.js

* Remove jQuery from Global view
2019-02-13 15:06:28 +01:00
Alexandre Alapetite
5b030dcc6f Ensure fast flush of HTTP headers and HTML head (#2045)
* Ensure fast flush of HTTP headers and HTML head

The fast flush optimisation done in
https://github.com/FreshRSS/FreshRSS/pull/1133 does not seem to work
anymore (need to check if it is related to a PHP version).
Work-around when PHP flush() is not working
Can be tested by adding a `sleep(5);` after:

ee902ee7c4/app/layout/layout.phtml (L27)
Follow-up of the performance checks of
https://github.com/FreshRSS/FreshRSS/pull/2040

* output_buffering in .user.ini for PHP CGI / FPM

* Reuse .user.ini for Docker PHP config

* Longer flush

Flush a bit later, to be compatible with the default value of 4096 for
PHP output_buffering, and thus avoid the need of tuning the value.
2018-10-14 14:37:50 +02:00
Alexandre Alapetite
8ee8a573f1 Custom labels (#2027)
* First draft of custom tags

https://github.com/FreshRSS/FreshRSS/issues/928
https://github.com/FreshRSS/FreshRSS/issues/1367

* SMALLINT to BIGINT for id_entry

And uppercase SQL types

* Fix layout for unreads

* Start UI menu

* Change menu order

* Clean database helpers

https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r217971535

* Travis rules do not understand PostgreSQL constants

Grrr

* Tag controller + UI

* Add column attributes to tags

* Use only favicon for now, for label

* Fix styling for different themes

* Constant for maximum InnoDB index length in Unicode

https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r219052200
(I would have personnally prefered keeping the readability of a real
value instead of a constant, in this case of many SQL fields)

* Use FreshRSS_Factory::createCategoryDao

* Add view of all articles containing any tag

* Fix search in tags

* Mark as read tags

* Partial auto-update unread tags

* More auto update tag unreads

* Add tag deletion

* Do not purge tagged articles

* Minor comment

* Fix SQLite and UI bug

* Google Reader API support for user tags

Add SQL check that tag names must be distinct from category names

* whitespace

* Add missing API for EasyRSS

* Compatibility SQLite

Problematic parentheses

* Add SQL DISTINCT for cases with multiple tags

* Fix for PostgreSQL

PostgreSQL needs some additional type hint to avoid "could not determine
data type of parameter $1"

http://www.postgresql-archive.org/Could-not-determine-data-type-of-parameter-1-tp2171092p2171094.html
2018-09-29 20:47:17 +02:00
Alexandre Alapetite
4e8932d4bb Minz: fix absolute URL bug (#2006)
* Fix absolute URL bug

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

* Better base_url guess in install.php

* Revert changes in install.php
2018-09-09 00:51:02 +02:00
Alexandre Alapetite
84d891f8cf Light Boolean search implementation (#1828)
* Light Boolean search implementation

"Hello intitle:World OR date:P1D example"
https://github.com/FreshRSS/FreshRSS/issues/879

* Doc Boolean search

* Doc typos
2018-03-14 17:20:41 +01:00
Alexis Degrugillier
00776f4547 PHP 7.2: Fix a warning when retrieving the list of entries (#1739)
When retrieving the list of entries when the context was 'all' or 'starred', there was the following warning:

> Warning: count(): Parameter must be an array or an object that implements Countable in /home/alexis/FreshRSS/app/Controllers/indexController.php on line 206

I fixed that by changing how the array is tested.
2017-12-19 09:35:37 +01: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
Alexandre Alapetite
56f66f4b61 Remove superflous category request
A category request was systematically done, although it is not always
needed.
2016-10-15 14:58:40 +02:00
Alexandre Alapetite
2a5aa34ad2 Better control of number of entries per page or RSS feed
https://github.com/FreshRSS/FreshRSS/issues/1249
* Since X hours: `https://freshrss.example/i/?a=rss&hours=3`
* Explicit number: `https://freshrss.example/i/?a=rss&nb=10`
* Limited by `min_posts_per_rss` and `max_posts_per_rss` in user config
2016-09-11 15:06:33 +02:00
Alexandre Alapetite
02d1d66235 PHP 5.3 more compatibility
https://github.com/FreshRSS/FreshRSS/pull/1209#issuecomment-239617504
https://github.com/FreshRSS/FreshRSS/issues/1208
2016-08-13 15:35:52 +02:00
Alexandre Alapetite
af31f1b20f PHP 5.3 scope compatibility
https://github.com/FreshRSS/FreshRSS/issues/1208
2016-08-13 10:35:45 +02:00
Alexandre Alapetite
a6071a0d98 PHP 5.3 compatibility for callback
https://github.com/FreshRSS/FreshRSS/issues/1208
2016-08-12 22:56:02 +02:00
Alexandre Alapetite
b042d3a772 HTTP2 optimization
Fast flush HTTP headers, push promise CSS.
Requires PHP 5.3+ due to anonymous function.
Do not load syles, scripts, and notifications for Ajax requests.
https://github.com/FreshRSS/FreshRSS/issues/1089
2016-04-23 19:10:32 +02:00
Alexandre Alapetite
27d2b88a19 Minz getBaseUrl correction and RSS template bug
https://github.com/FreshRSS/FreshRSS/issues/848
Corrections in Minz (HTTP_HOST was not sanitized, getURI() was never
used and not working anyway with absolute base_url)
$this->url was not defined in rss.phtml
2015-05-23 02:23:38 +02:00
Alexis Degrugillier
1156129593 Use the search object to get values in the search
It is now possible to combine multiple keywords to do a search. The separation of concern is better now since the search extraction is not done in the DAO anymore.
At the moment, a multiple keyword search is stored as this. It could be nice to have it rendered differently in the search page to make it more readable.
At the moment, there is a problem with search enclosed by ". Same search works well when enclosed by '.
2015-02-21 09:46:21 -05:00
Marien Fressinaud
d3a93ea290 BREAKING FEATURE: Remove general in config
General attribute has been removed from system config.
Now subattributes (e.g. environment, salt, title, etc.) are directly accessible.

YOU HAVE TO FIX YOUR ./data/config.php file!

- Remove the general array
- Values inside this array must be kept
- To see what it must look like, please have a look to ./data/config.default.php
  (but keep your values!!).

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-06 18:53:36 +01:00
Marien Fressinaud
d27efeec04 Fix Controllers to use the correct config system
See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-06 17:38:31 +01:00
Marien Fressinaud
7cca47d1ab Change name of user configuration var in Context
- FreshRSS_Context::$conf is replaced by FreshRSS_Context::$user_conf
- Introduce FreshRSS_Context::$system_conf
- Remove FreshRSS_Configuration object

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-05 22:45:03 +01:00
Marien Fressinaud
57bffe83eb Fix i18n for index Controller
Fix strings for:

- about page
- rss and reader views
- fix title of global view
2014-12-11 00:25:02 +01:00
Marien Fressinaud
d455837c6d Fix i18n for normal view 2014-12-11 00:00:15 +01:00
Marien Fressinaud
8a40a72657 Fix i18n for logs, pagination and javascript vars
Logs first to avoid annoying message when refreshing log page
2014-12-10 23:16:12 +01:00
Marien Fressinaud
83d95ca4b8 Fix titles for normal and global views
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-24 15:11:02 +02:00
Marien Fressinaud
0d6993fe08 Reader view comes back!
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-24 12:51:17 +02:00
Marien Fressinaud
1efbf6fb86 Add comments to Context object.
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 20:05:00 +02:00
Marien Fressinaud
1fe5ed5d21 nextGet and idMax are coming back.
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 19:19:15 +02:00
Marien Fressinaud
9551145200 Better view mode
- Seperate view mode from default state in conf
- Load read articles if no unread articles only if view is adaptive

See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 18:21:36 +02:00
Marien Fressinaud
98587d5d61 Fix a set of TODO and bugs
- Context object raises correct Exception if get is invalid
- RSS feed is well-indicated on the home page
- State is better calculated
- Add some comments

See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 17:57:22 +02:00
Marien Fressinaud
f1f9b2f5ff Entries are loaded again! It's working :)
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 13:52:20 +02:00
Marien Fressinaud
b446a510eb Finish to update context object
See See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 13:35:30 +02:00
Marien Fressinaud
fcae415753 Update title and get parameter correctly.
See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-22 13:13:24 +02:00
Marien Fressinaud
80cffa6de5 Views are in dedicated actions + improve Context
- Seperate normal, global and rss outputs in dedicated actions (NOT WORKING YET!)
- Rewrite aside_flux and nav_menu to use Context object
- Improve Context object

See https://github.com/marienfressinaud/FreshRSS/issues/634
2014-10-21 16:55:19 +02:00
Marien Fressinaud
8a7bab3a55 Refactoring of indexController
Global view has been moved to a different action (all is not working)

See https://github.com/marienfressinaud/FreshRSS/issues/634
and https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-20 19:35:22 +02:00
Marien Fressinaud
1a22a87fb1 Use FreshRSS_Context::$conf only
- Replace $this->view->conf in controllers
- Replace $this->conf in views
2014-10-20 18:45:22 +02:00
Marien Fressinaud
1252b3dd86 Authentication system moved + Persona comes back!
AuthController is dedicated to auhentication.
Persona is back, greater than ever!

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-07 16:37:10 +02:00
Marien Fressinaud
79aa5beaf4 Refactor authentication system.
Big work, not finished. A lot of features have been removed.

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-06 23:29:20 +02:00
Marien Fressinaud
d8f4681382 Replace Minz_Log::record by corresponding methods
Please not use Minz_Log::record anymore!

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-05 19:35:29 +02:00
Marien Fressinaud
9a0d01be0c Coding style
Remove spaces before parenthesis.

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-05 18:24:28 +02:00
Marien Fressinaud
6c8b36f04e Let's begin the big refactoring!
Minz_Translate::t\s? replaces by _t

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-05 15:55:20 +02:00
Alexandre Alapetite
a5a0bd9a35 SQL performance: Removed filter to hide old articles
As discussed on
https://github.com/marienfressinaud/FreshRSS/issues/493#issuecomment-56266415
For performance, but this is also a good simplification.
Will help with PostgreSQL
https://github.com/marienfressinaud/FreshRSS/issues/416 and SQLite too
https://github.com/marienfressinaud/FreshRSS/issues/100 because the main
query becomes simpler.

Me may need to introduce another system to hide old articles, if this is
a problem for some users.
Also, the feature showing "empty feeds" in another colour may need to be
adapted.
2014-09-30 22:28:47 +02:00
Marien Fressinaud
a14d325432 Auto-redirect from formLogin if already logged in 2014-09-19 20:30:54 +02:00