aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
AgeCommit message (Collapse)Author
2022-03-22WebSub: Use hash instead of base64 to handle long URLs (#4282)Gravatar Alexandre Alapetite
* WebSub: Use hash instead of base64 to handle long URLs * Use 410 Gone (Part of the WebSub specification https://www.w3.org/TR/websub/ )
2022-03-21Set feed error state when XPath does not match (#4275)Gravatar Alexandre Alapetite
Gives the ability to filter HTML+XPath feeds that are not working
2022-03-16Replace lib_phpQuery by PhpGt/CssXPath (#4261)Gravatar Alexandre Alapetite
https://github.com/PhpGt/CssXPath
2022-02-28Implement Web scraping "HTML + XPath" (#4220)Gravatar Alexandre Alapetite
* More PHP type hints for Fever Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201 Related to https://github.com/FreshRSS/FreshRSS/issues/4200 * Detail * Draft * Progress * More draft * Fix thumbnail PHP type hint https://github.com/FreshRSS/FreshRSS/issues/4215 * More types * A bit more * Refactor FreshRSS_Entry::fromArray * Progress * Starts to work * Categories * Fonctional * Layout update * Fix relative URLs * Cache system * Forgotten files * Remove a debug line * Automatic form validation of XPath expressions * data-leave-validation * Fix reload action * Simpler examples * Fix column type for PostgreSQL * Enforce HTTP encoding * Readme * Fix get full content * target="_blank" * gitignore * htmlspecialchars_utf8 * Implement HTML <base> And fix/revert `xml:base` support in SimplePie https://github.com/simplepie/simplepie/commit/e49c578817aa504d8d05cd7f33857aeda9d41908 * SimplePie upstream PR merged https://github.com/simplepie/simplepie/pull/723
2022-02-07Hot fix: fix type hint null regression (#4207)Gravatar Alexandre Alapetite
2022-02-06Fix Fever 32 bit ID issue + more PHP type hints (#4201)Gravatar Alexandre Alapetite
* 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-05Improved: Fetch articles with selector but do not delete the class ↵Gravatar maTh
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-01-09Add spell checking with typos (#4138)Gravatar Alexandre Alapetite
* Add spell checking with typos Implement https://github.com/FreshRSS/FreshRSS/pull/4134#issuecomment-1008027558 * GitHub Actions attempt * Quiet wget * Makefile
2022-01-08Fix various typos and spelling errors in documentation, comments and code. ↵Gravatar Thomas Renes
(#4134)
2022-01-06Fix several PHP8.1 warnings (#4123)Gravatar Alexandre Alapetite
* 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-05[CI] PHPCS: check for opening brace on same line (#4122)Gravatar Frans de Jonge
* [CI] PHPCS: check for opening brace on same line * make fix-all * Minor comments Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-04PHPStan level 5 (#4110)Gravatar Alexandre Alapetite
* 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-01Avoid func_get_args (#4108)Gravatar Alexandre Alapetite
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-01Fix most PHPDocs errors (#4107)Gravatar Alexandre Alapetite
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103 https://phpstan.org/writing-php-code/phpdoc-types
2021-12-01Fix some PHP 8.1 warnings (#4012)Gravatar Alexandre Alapetite
* 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-10-24Fix getNonStandardShortcuts (#3924)Gravatar Alexandre Alapetite
#fix https://github.com/FreshRSS/FreshRSS/issues/3922 Quick fix. The `getNonStandardShortcuts()` could probably be re-written.
2021-05-15git update auto change to edge branch (#3589)Gravatar Alexandre Alapetite
* 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-08Fix several comments syntaxes (#3615)Gravatar Alexandre Alapetite
Mainly wrong `@return` types in comments
2021-04-17Show start error (#3590)Gravatar Alexandre Alapetite
* 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-03-21Remove shortcut validation (#3548)Gravatar Alexis Degrugillier
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-09SimplePie prevent cache pollution (#3502)Gravatar Alexandre Alapetite
* 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-02-28Travis: Enforce phpcs line length + whitespace (#3488)Gravatar Alexandre Alapetite
* 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-11Remove Minz validation (#3439)Gravatar Alexis Degrugillier
It should have been done during #3302.
2021-02-11refactor: remove referer checks, as they are no longer needed (replaced by ↵Gravatar hesch
csrf tokens) (#3432)
2021-02-06Fix heredoc syntax (#3426)Gravatar Alexandre Alapetite
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-05Better error message on failure (#3407)Gravatar Martin
* 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-01-17Curlopt fixes (#3381)Gravatar Eris
* 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-16CURLOPT parameters per feed (#3367)Gravatar Eris
* 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-14Add constant for PHP requirements (#3369)Gravatar Alexis Degrugillier
* 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-02Avoid manual initialisations of system or user configuration (#3070)Gravatar Alexandre Alapetite
* 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
2020-12-28Revert "Extract autoloading process (#3283)"Gravatar Alexandre Alapetite
This reverts commit 46cb89adf842e2fbac254fc99355d6577e4e86eb.
2020-12-28SimplePie Strip comments (#3288)Gravatar Alexandre Alapetite
#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-26Extract autoloading process (#3283)Gravatar Alexis Degrugillier
* 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-10-11Fix sanitize feed description (#3222)Gravatar Alexandre Alapetite
* Fix sanitize feed description #fix https://github.com/FreshRSS/FreshRSS/issues/3221 * Simplification
2020-09-03When ssl_verify is false, decrease SSL security (#3171)Gravatar Alexandre Alapetite
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-07-31Relaxed to allow underscore _ in URL hostnames (#3133)Gravatar Alexandre Alapetite
* 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-14Add a way to disable shortcuts (#3114)Gravatar Alexis Degrugillier
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-01-04Fix wrong getHeader refactoring (#2749)Gravatar Alexandre Alapetite
* 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-03Fix logging environment constants (#2745)Gravatar Alexandre Alapetite
* 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
2019-11-20Old ICU: INTL_IDNA_VARIANT_2003 fallback (#2680)Gravatar Alexandre Alapetite
* 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-11Sanitize UTF-8 before commiting entries (#2649)Gravatar Alexandre Alapetite
Fix https://github.com/FreshRSS/FreshRSS/issues/2645
2019-10-23Workaround for MySQL limitation 1093 (#2586)Gravatar Alexandre Alapetite
* Workaround for MySQL limitation 1093 https://github.com/FreshRSS/FreshRSS/pull/2335#issuecomment-545194606 including minor Travis fixes
2019-10-23Feature/new archiving (#2335)Gravatar Alexis Degrugillier
* 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-09-29PDO refactoring for code simplification (#2522)Gravatar Alexandre Alapetite
* 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-18Remove JSON.php fallback (#2528)Gravatar Alexandre Alapetite
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-17Require PHP 5.6+Gravatar Alexandre Alapetite
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-08-29Provide email address verification feature (#2481)Gravatar Marien Fressinaud
* 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-20Require PHP 5.5+ (#2495)Gravatar Alexandre Alapetite
* 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-04-07Fix PHP 5.5 compat for array const (#2360)Gravatar Alexandre Alapetite
https://github.com/FreshRSS/FreshRSS/issues/2359
2019-04-06Ensure sanitizeHTML gets a string (#2351)Gravatar Alexandre Alapetite
Regression triggered by https://github.com/FreshRSS/FreshRSS/pull/2228