Commit Graph

38 Commits

Author SHA1 Message Date
Alexandre Alapetite
607f7e7254 Fix several comments syntaxes (#3615)
Mainly wrong `@return` types in comments
2021-05-08 10:27:18 +02:00
Alexis Degrugillier
31cb07ac1a Fix author search link (#3315)
Before, when clicking on the author link, the search was done on the
main stream in the normal view. It's fine until the feed is not visible
in the main stream.
Now, the current context is used along with the search.

See #3314
2021-01-03 00:59:57 +01:00
Alexandre Alapetite
0319cc9d23 Minz allow parallel sessions (#3096)
* Minz allow parallel sessions

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

* Array optimisation

* Array optimisation missing

* Reduce direct access to $_SESSION except in install process

* Fix session start headers warning

* Use cookie only the first time the session is started:
`PHP Warning:  session_start(): Cannot start session when headers
already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39`

* New concept of volatile session for API calls

Optimisation: do not use cookies or local storage at all for API calls
without a Web session
Fix warning:

```
PHP Warning:  session_destroy(): Trying to destroy uninitialized session
in Unknown on line 0
```

* Only call Minz_Session::init once in our index

It was called twice (once indirectly via FreshRSS->init())

* Whitespace

* Mutex for notifications

Implement mutex for notifications
https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809

* Typo

* Install script is not ready for using Minz_Session
2020-10-06 23:19:45 +02:00
Alexandre Alapetite
7652369359 Minz: Attach a notification to a request (#3208)
* Minz: Attach a notification to a request

Notifications should be attached to a request, not to a global session.
Fix
https://github.com/FreshRSS/FreshRSS/pull/3096#issuecomment-654891906
Prepare https://github.com/FreshRSS/FreshRSS/pull/3096

* Rename array

* Avoid string constants

Implement
https://github.com/FreshRSS/FreshRSS/pull/3208#issuecomment-703243863

* Improved logic

* Simplify storage

https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499511213

* Fix notification bug in configuration/system
2020-10-05 19:03:33 +02:00
Alexis Degrugillier
36bda2e715 Add language detection when the user is not logged in (#3022)
Before, when the user was not logged in, pages where translated with the '_' user language.
Now, they are translated with the user preferred language if there is one supported by FreshRSS or with the system default language.
2020-06-05 10:10:46 +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
Alexis Degrugillier
de2b323847 Refacto request class (#2373)
I split the code into more manageable chunks to make it more readable.
It's now easier to get a grasp on it. In the process, I tried to use
the yoda style notation to avoid unintentional variable assignement.
I also tried to exit early to avoid many "if" levels.

I have also added a better way to handle headers and a way to extract
languages from the request. It will be easier to choose which language
to use for i18n.
2019-12-04 08:26:38 +01:00
Craig Andrews
d33c0ff2ca Remove magicQuotesOff (#2697) (#2698)
* Remove magicQuotesOff (#2697)

Magic quotes have been deprecated since PHP 5.4 and as of PHP 7.4 `get_magic_quotes_gpc()` displays a warning.

* Remove unused Minz_Helper::stripslashes_r

`Minz_Helper::stripslashes_r` is no longer used.

It's last user was `Minz_Request::magicQuotesOff`
2019-12-03 22:26:05 +01: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
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
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
aaed69252b Support of proxies with subfolder / path rules (#2191)
Support HTTP_X_FORWARDED_PREFIX HTTP_X_FORWARDED_HOST
Improve Docker/Træfik for rules based on path/sub-folder
2018-12-18 20:41:06 +01:00
Alexandre Alapetite
ba000d0e08 Better support for HTTP_X_FORWARDED_PROTO (#2037)
https://github.com/FreshRSS/FreshRSS/issues/2031
2018-10-01 00:01:33 +02:00
Alexandre Alapetite
b552abb332 JSON column for feeds (#1838)
* Draft of JSON column for feeds
https://github.com/FreshRSS/FreshRSS/issues/1654

* Add some per-feed options
  * Feed cURL timeout
  * Mark updated articles as read https://github.com/FreshRSS/FreshRSS/issues/891
  * Mark as read upon reception https://github.com/FreshRSS/FreshRSS/issues/1702
  * Ignore SSL (unsafe) https://github.com/FreshRSS/FreshRSS/issues/1811

* Try PHPCS workaround
While waiting for a better syntax support
2018-05-01 17:02:11 +02:00
Alexandre Alapetite
71918dbc5a New Docker (#1813)
* Draft of new Docker

Based on Alpine Linux. Size ~78MB.
https://github.com/FreshRSS/docker-freshrss/issues/4
https://github.com/FreshRSS/FreshRSS/issues/520
https://github.com/FreshRSS/docker-freshrss
https://github.com/FreshRSS/docker-freshrss-production

* Docker readme

* +x execution rights prepare

* Docker readme links to hub.docker.com

https://hub.docker.com/r/freshrss/freshrss/
2018-03-04 01:02:02 +01: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
ba9f4461d8 Secure cookie HTTPS 2016-03-08 19:00:04 +01:00
Alexandre Alapetite
bfae186e36 Use HTTP_X_FORWARDED_
https://github.com/FreshRSS/FreshRSS/issues/975
2015-11-03 20:23:30 +01:00
Marien Fressinaud
1e65fd687e Use filter_var in guessBaseUrl
See https://github.com/FreshRSS/FreshRSS/issues/906
See https://github.com/FreshRSS/FreshRSS/pull/915/files#r35304704
2015-07-23 11:38:56 +02:00
Marien Fressinaud
6db0941196 Fix unexpected behaviour in getBaseUrl
- getBaseUrl() returns info from configuration only and always append
  the suffix
- add a guessBaseUrl() to extract base_url from $_SERVER info
- fix Url::display() to take this change in consideration

Fix https://github.com/FreshRSS/FreshRSS/issues/906
Use https://github.com/FreshRSS/FreshRSS/pull/910
2015-07-23 10:05:32 +02:00
Alexandre Alapetite
2d22bf300a dirname problem
https://github.com/FreshRSS/FreshRSS/issues/906
2015-07-17 23:43:43 +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
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
51a71ec4b9 New configuration system (not working yet)
- Use only Minz_Configuration
- register() method to load a new configuration file
- get() to get a configuration
- new exceptions related to configuration
- fix a list configuration calls to have FRSS working

Current problems to resolve:

- How to handle configuration param verifications (i.e. check auth_type
  is a value from none, http_auth, persona or form)
- We must use $conf = Minz_Configuration::get('system'); $general_conf = $conf->general;
  to access global system configuration which is quite annoying. How to change that?

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-05 16:54:16 +01: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
d284958d52 Improve redirection when deleting an idle feed 2014-09-19 19:44:40 +02:00
Marien Fressinaud
fc7d2a0bf2 Move http referer test into lib_rss
Rename method (coding style)
Change in app/FreshRSS.php
Improve test of app/install.php
2014-09-17 14:21:56 +02:00
Alexandre Alapetite
a126d99b3c Bug referer for systems with non-standard HTTP port
Now tests also for the scheme and port, which must be identical to the
ones in the referer.

https://github.com/marienfressinaud/FreshRSS/issues/565#issuecomment-53916915
https://github.com/marienfressinaud/FreshRSS/issues/554
2014-08-30 18:31:50 +02:00
Marien Fressinaud
7900c5e550 Move htmlspecialchars_utf8 from Request to Helper
And remove html_chars_utf8 to use htmlspecialchars_utf8 instead in
importExportController
2014-08-12 21:56:34 +02:00
Marien Fressinaud
ede94098be Fix missing REQUEST_METHOD
Useful when executing actualize_script.php
2014-08-12 21:15:12 +02:00
Marien Fressinaud
22e2bf9239 Fix coding style of Minz_Request 2014-08-12 21:12:02 +02:00
Marien Fressinaud
1b20f6bd02 New wrappers Minz_Request::good() and bad()
1. Set a notification message in session variable
2. Redirect to a specific url

First use in importExportController.php

See https://github.com/marienfressinaud/FreshRSS/conversations/576
2014-08-12 21:01:07 +02:00
Marien Fressinaud
a7e8332809 Improve system of queries
- Coding style
- More checks server side
- Default query name is "Query n°X"
- List of queries is moved into nav_menu, in a dropdown
- Better system to remove fields in JS (to a.remove elements, give an
  attibute data-remove="id_to_remove")
- Fix a bug in lib/Mine/Request.php (htmlspecialchars_utf8 can be applied on
  arrays now)
- Few theme improvements
- Add an element .no-mobile to apply to elements which should not appear on
  mobiles

See https://github.com/marienfressinaud/FreshRSS/pull/498
2014-06-14 09:04:31 +02:00
Alexandre Alapetite
5081ffaf39 Minz: remove one layer of ob_ (experimental)
https://github.com/marienfressinaud/FreshRSS/issues/303#issuecomment-38351311
https://github.com/marienfressinaud/FreshRSS/issues/163
* Remove Minz_Response (not needed anymore)
* Move Minz_Request::reseted to Minz_Dispatcher::reset()
2014-03-22 17:56:07 +01:00
Marien Fressinaud
9f6fa5f7c6 Better function isPost
Use $_SERVER['REQUEST_METHOD'] instead of empty($_POST)
Possibly related to #413
2014-02-11 23:42:24 +01:00
Alexandre Alapetite
48a1a36222 Correction bug base_url
À appliquer aussi à la 0.7-beta
2013-12-28 00:02:55 +01:00
Alexandre Alapetite
a1f8bade61 SQL : petits changement recherche
Traite mieux les caractères spéciaux.
Permet par exemple une recherche sur des mots contenant des apostrophes,
ou le signe pourcentage, etc.
Il faudra toujours essayer d'améliorer la recherche en particulier
lorsque plusieurs mots sont fournis
2013-12-16 21:58:47 +01:00
Alexandre Alapetite
4ee4f16ffe Problème de casse renommage répertoire 2013-12-15 11:24:14 +01:00