Commit Graph

2406 Commits

Author SHA1 Message Date
Andrew Dolgov 74d7f88fae
make_self_url: properly strip out GET params 2022-07-24 14:50:03 +03:00
Andrew Dolgov 5006c754c4
readability: add missing dependencies 2022-07-24 14:03:04 +03:00
Chih-Hsuan Yen f3aceb4648
Fix an error when disabling all user plugins
If I enabled some user plugins via Preferences -> Plugins and then
disabled all of them, an error occurred:

Jul 16 22:34:20 php[100]: PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /usr/share/webapps/tt-rss/classes/pref/prefs.php:1027
Jul 16 22:34:20 php[100]: Stack trace:
Jul 16 22:34:20 php[100]: #0 /usr/share/webapps/tt-rss/classes/pref/prefs.php(1027): array_filter()
Jul 16 22:34:20 php[100]: #1 /usr/share/webapps/tt-rss/backend.php(136): Pref_Prefs->setplugins()
Jul 16 22:34:20 php[100]: #2 {main}
Jul 16 22:34:20 php[100]:   thrown in /usr/share/webapps/tt-rss/classes/pref/prefs.php on line 1027

Apparently the issue was elevated from a warning to an error in PHP 8.0
[1].

[1] https://php.watch/versions/8.0/internal-function-exceptions
2022-07-16 22:50:16 +08:00
Andrew Dolgov 5c70d26b7e
some very minor php8.1 warnings fixed 2022-07-13 07:08:31 +03:00
DJ_TBX 9d69fd2a56 Fix MySQL search Queries
Add the missing space between "AND" and "MATCH" in MySQL search queries
2022-07-04 00:17:01 +03:00
Andrew Dolgov 50f014e52d
implement native fulltext search on mysql 2022-06-19 22:21:54 +03:00
Andrew Dolgov 6d98cc6c80
schema: add fulltext indexes for mysql to support af_psql_trgm and possibly future fulltext search 2022-06-19 21:53:57 +03:00
Andrew Dolgov c2f7044485
userhelper: fix optional parameter being declared before a required one 2022-06-13 08:37:39 +03:00
Andrew Dolgov d4be821825
UserHelper, CLI: add a method to check user password 2022-06-10 22:16:48 +03:00
Andrew Dolgov cf1eaeedf3
* add UserHelper methods to manipulate user database (add, modify, delete)
* expose said methods via CLI (update.php)
 * fix several invocations of deprecated functions
 * set stricter type hints on several method arguments
2022-06-10 13:39:00 +03:00
Andrew Dolgov 2975c7297b
throttle updates if received HTTP 429 (Too Many Requests) 2022-06-09 09:06:52 +03:00
Andrew Dolgov 7cd26272fa
Revert "minor: Support html content in mailer.php"
This reverts commit b91ffae292.
2022-06-06 21:05:24 +03:00
Andrew Dolgov 8151295829
Revert "trivia: coding style"
This reverts commit 9e557501fa.
2022-06-06 21:05:15 +03:00
Andrew Dolgov 8ef816d8f8
feeds-tree: move external onClick dojo/method to PrefFeedTree class 2022-06-06 09:31:37 +03:00
Andrew Dolgov 6436dd16f9
filter-tree: move external dojo/method to PrefFilterTree class 2022-06-06 09:29:16 +03:00
Andrew Dolgov dd983e5de1 prefs: move external filter tree onload method (which checks for inactive feeds, etc.) to FilterTree class 2022-06-05 11:47:21 +03:00
Andrew Dolgov fc84712135 pref-filters: add a button to hide or show rules in the filter list 2022-06-05 11:41:28 +03:00
Andrew Dolgov 9457bb090a fix PHP8 undefined array key warning when resetting prefs to defaults 2022-06-05 11:14:42 +03:00
Andrew Dolgov 5adedcd3d0 fix custom-set site URLs never used while updating feeds 2022-05-29 08:02:12 +03:00
Andrew Dolgov b0059d3f88 when determining feed-specific favicon, instead of using first match or generic fallback, go through entire list of determined favicon URLs 2022-05-28 22:27:59 +03:00
Hardway Hou 9e557501fa trivia: coding style 2022-05-24 20:49:01 +08:00
Hardway Hou b91ffae292 minor: Support html content in mailer.php 2022-05-24 10:09:46 +08:00
Andrew Dolgov 1b3e655f89 use CURLAUTH_BASIC by default for password-protected feeds, keeping
CURLAUTH_ANY as a fallback in case we got a 403.
2022-05-23 08:43:04 +03:00
Siemenskun 3406a16025 Fix typo 2022-05-22 02:02:56 +03:00
Siemenskun d33d026b12 Fix xml parsing error
Move re-requesting logic before parsing response body, otherwise it puts HTTP headers into XML body
2022-05-22 01:46:46 +03:00
Andrew Dolgov 2654b3c6be disable some pointless startup sanity checks when running under docker 2022-04-03 19:39:34 +03:00
Andrew Dolgov 4250386ba5 set last_login_update session variable immediately when logging in 2022-03-29 13:52:22 +03:00
Andrew Dolgov 385da287d8 rewrite_relative: deal with undefined path warning 2022-03-22 19:43:32 +03:00
Andrew Dolgov 0345e9d3f6 rewrite_relative: use isset() to check for relative path 2022-03-22 16:18:22 +03:00
Andrew Dolgov e35a4a1306 tests: add stub autoloader, add a few more rewrite_relative tests 2022-03-22 14:32:32 +03:00
Andrew Dolgov 1c4f7ab3b8 * add phpunit as a dev dependency
* add some basic tests for UrlHelper::rewrite_relative()
 * fix UrlHelper::rewrite_relative() to work better on non-absolute
   relative URL paths
2022-03-22 12:24:31 +03:00
David Edler de1e218a83
various fixes vor php 8.1 compatibility
Cherry-picked from https://git-gitea.tt-rss.org/fox/tt-rss/pulls/56,
while excluding changes in vendor/ (causes compatiblity issues with
PHP<8 [1]) and strftime-related ones (already re-applied in
https://git-gitea.tt-rss.org/fox/tt-rss/pulls/66).

[1] https://community.tt-rss.org/t/support-for-php-8-1/5089/9
2022-03-09 00:46:15 +08:00
Andrew Dolgov 39c0bd378a getAllCounters: set default value if frontend doesn't pass label or feed id count 2022-02-25 12:41:53 +03:00
Andrew Dolgov f7e2f62022 fix Feeds::_get_counters() used improperly as a replacement for
getFeedUnread()
2022-02-20 12:48:38 +03:00
Andrew Dolgov 77f39d65b5 * Feeds::_get_counters - fix retrieving unread for tags
* mark several symbols as @deprecated properly
 * replace uses of (deprecated) getFeedUnread() with Feeds::_get_counters()
2022-02-20 11:04:40 +03:00
Andrew Dolgov 168dc6fe57 rewrite_relative: prevent php warning when checking for unset content type in EXTRA_SCHEMES_BY_CONTENT_TYPE 2022-02-18 16:44:03 +03:00
Andrew Dolgov 74a247fc5c rewrite_relative: whitelist specific schemes for URLs with 'known' content-types i.e. specified for enclosures 2022-02-17 22:38:38 +03:00
Andrew Dolgov 89ef98e57e allow running as root in a container environment 2022-02-17 17:32:02 +03:00
Felix Eckhofer cc30198b3d
Replace deprecated `strftime` 2022-02-03 16:13:01 +01:00
Schrottfresse 931e33c381 Add workaround for boolean values being intergers with MySQL/PHP 8.1 2022-01-28 08:37:29 +01:00
Andrew Dolgov c57ebf2c10 fix filter last_triggered not updating 2022-01-25 22:33:13 +03:00
Richard Tollerton aaccf89501 update_rss_feed: juxtapose pdo and ORM commit on timestamp update
If for whatever reason $pdo holds a DDL lock on ttrss_entries, it could
block ORM's save, leading to a deadlock. To work around this, call
$pdo->commit() before ORM::for_table()->save().
2022-01-13 23:39:49 -06:00
Andrew Dolgov c3482fbe6b generate a warning if plugin-generated content of HOOK_ARTICLE_BUTTON or _LEFT_BUTTON can't be parsed as valid XML 2022-01-06 10:37:03 +03:00
Andrew Dolgov 1818fc11a5 fetch: return HTTP code when no curl_error() is available 2021-12-23 17:32:44 +03:00
Andrew Dolgov 6971ca08b2 remove deprecated LOG_ constants 2021-12-23 17:32:27 +03:00
Andrew Dolgov 7aeaa1b039 rssutils: rewrite several invocations of (deprecated) rewrite_relative_url() to UrlHelper::rewrite_relative() 2021-12-20 08:03:30 +03:00
Andrew Dolgov 40b2356be2 filters:
* add filter action to ignore feed-provided tags
 * simplify handling of various filter-provided tags
 * bump schema to 146
2021-12-20 07:56:16 +03:00
Andrew Dolgov 720b318796 * fox.form.Select: add several properties allowing it to better
imitate other controls like DropDownButton, etc.
 * rework several main toolbar items to use fox.form.Select instead of
other controls
 * replace HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM with
HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2 because of markup change (option
instead of menuitem)
 * PluginHost: add some explicit typecasts to make intellephense shut up
2021-12-14 21:53:45 +03:00
wn_ 0726a9d820 Handle another potential 'SUM()' null situation in Feeds. 2021-12-14 12:50:53 +00:00
wn_ ddc81b2c89 Add a note on why ed74c43f18 was needed. 2021-12-14 12:47:25 +00:00
wn_ ed74c43f18 Handle the admin user not having any entries in 'Feeds::_get_global_unread'. 2021-12-14 12:06:32 +00:00
Andrew Dolgov 53061d1508 * add HOOK_POST_LOGOUT
* auth_remote: add config option AUTH_REMOTE_POST_LOGOUT_URL
2021-12-06 13:20:18 +03:00
fox 6a70f5e92c Merge pull request 'Prevent "Undefined index: version" events for git version with open_basedir after 9dabfbfa11' (#57) from ltGuillaume/tt-rss:master into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/57
2021-12-03 07:25:06 +03:00
jbaldus 987870074b Fixes declaration of Pref_Prefs::csrf_ignore to match IHandler::csrf_ignore 2021-12-02 20:57:19 +03:00
ltGuillaume 0269c7ce32 Prevent "Undefined index: version" events for git version with open_basedir after 9dabfbfa11 2021-12-02 18:55:08 +01:00
Andrew Dolgov 5df8dacf9f api, getHeadlines: properly accept feed_id 0 2021-12-01 19:04:42 +03:00
Andrew Dolgov a201e10ee0 Revert "various fixes vor php 8.1 compatibility"
This reverts commit 14027ae04e.
2021-12-01 13:37:35 +03:00
Andrew Dolgov aaebe55456 Revert "replace strftime with date"
This reverts commit 72e21f89ce.
2021-12-01 13:37:25 +03:00
David Edler 72e21f89ce replace strftime with date 2021-11-30 22:07:11 +01:00
David Edler 14027ae04e various fixes vor php 8.1 compatibility 2021-11-30 21:50:09 +01:00
Andrew Dolgov 409c63dcf8 remove mixed type hints from function arguments because we still support PHP7 2021-11-29 12:30:33 +03:00
Andrew Dolgov 28fb571dca * fix showing headlines for tag-based virtual feeds
* API: allow retrieving headlines for tag-based feeds (bump api level to 18)
2021-11-29 10:20:13 +03:00
Andrew Dolgov 204f92b926 urlhelper: add debugging output for download attempts 2021-11-24 08:19:04 +03:00
Andrew Dolgov a6cad5cbca api: don't try to pass null login/password when subscribing to feed 2021-11-23 16:55:21 +03:00
Andrew Dolgov 9dabfbfa11 _get_version:
- don't bother with git if open_basedir is enabled
 - check for SCRIPT_ROOT instead of TTRSS_.. anything because that would be set regardless of install method
2021-11-23 14:46:24 +03:00
Andrew Dolgov 3323ae78ce * sql_bool_to_bool: make parameter nullable
* errorhandler: don't try to truncate null strings
 * UrlHelper::rewrite_relative: fix undefined offset warnings for URLs
that lack schema/host (data: etc)
2021-11-20 16:11:44 +03:00
Andrew Dolgov e7111e4f14 sanitize: make force_remove_images nullable 2021-11-20 14:02:37 +03:00
Andrew Dolgov 2b4ba59a79 feeds/add: force cast category id to integer 2021-11-19 17:02:25 +03:00
fox 0a3a464def Merge pull request 'Consistently handle param string to bool conversions in handlers.' (#53) from wn/tt-rss:feature/consistent-param-to-bool into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/53
2021-11-19 07:36:15 +03:00
fox 3070933f64 Merge pull request 'Fix Undefined array key "order_by"' (#54) from klempin/tt-rss:master into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/54
2021-11-19 07:35:20 +03:00
fox e5ec69f45a Merge pull request 'Don't type DiskCache's $mimeMap.' (#55) from wn/tt-rss:bugfix/diskcache-mimemap-type into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/55
2021-11-19 07:34:26 +03:00
wn_ 59a09790eb Don't type DiskCache's $mimeMap.
PHP typing of class properties is only supported on PHP 7.4+.
2021-11-18 23:51:36 +00:00
Philip Klempin 739c3fe760 Fix Undefined array key "order_by" 2021-11-18 22:33:03 +00:00
wn_ 4a891b20f0 Fix 'view_mode' default in API#getHeadlines() 2021-11-18 21:31:52 +00:00
wn_ d532eb773b Switch from null to false as the default for missing bool params. 2021-11-18 18:25:04 +00:00
wn_ cd71292610 Actually, always clean in Handler._param_to_bool() 2021-11-18 18:18:49 +00:00
wn_ 16a7208893 Clean string params in Handler._param_to_bool() 2021-11-18 18:16:50 +00:00
wn_ 2422aae577 Consistently handle param string to bool conversions in handlers. 2021-11-18 18:09:47 +00:00
Andrew Dolgov 57d9a5e925 config: use phpdoc comments for global options, etc 2021-11-18 20:51:11 +03:00
Andrew Dolgov d6f604c06c API/catchupFeed: properly pass is_cat as bool 2021-11-18 20:02:24 +03:00
Andrew Dolgov 1ea177491f * base plugin class: correct description of hook_house_keeping()
* cache_starred_images: keep status files in a separate cache directory
2021-11-18 19:54:42 +03:00
Andrew Dolgov b2ffc8c2e3 _format_headlines_list: fix phpstan warning properly 2021-11-18 11:03:26 +03:00
Andrew Dolgov 9ac67c7973 API: fix unexpected null being passed to _order_to_override_query 2021-11-18 11:01:46 +03:00
Andrew Dolgov b77f6c9a6b API: force methods to return bool to make wrap() mistakes easier to track 2021-11-18 10:46:06 +03:00
Andrew Dolgov 9e469b1642 api: a few more returns in login 2021-11-18 09:04:08 +03:00
Andrew Dolgov 10a1d4d879 api: don't return errors on login success 2021-11-18 09:01:44 +03:00
wn_ 2d830c6281 Minor correction to RSSUtils::cache_enclosures() $enclosures param type.
All FeedEnclosure values are currently strings, even though the numeric things get converted to int before getting inserted in 'ttrss_enclosures'.
2021-11-17 20:45:41 +00:00
wn_ fb1e85baaf Switch FeedParser back to described behavior for setting 'error'.
Also some formatting.
2021-11-17 19:29:54 +00:00
Andrew Dolgov aeb4137cbd document a few more plugin hooks 2021-11-17 18:30:32 +03:00
Andrew Dolgov 3e273ea527 add descriptions for some plugin hooks 2021-11-17 15:56:58 +03:00
Andrew Dolgov bd66eff7cc better check for docker 2021-11-17 10:52:37 +03:00
Andrew Dolgov 938f7db482 correctly show non-docker git installs as unsupported 2021-11-17 10:36:04 +03:00
Andrew Dolgov 5980b3d2cb pluginhost: set stricter @params 2021-11-16 18:35:13 +03:00
Andrew Dolgov 10d1a8c05a adjust phpdoc tags for hook definitions/constants (make them reference each other) 2021-11-16 16:31:40 +03:00
Andrew Dolgov ad30d39e2a not dead: Article.assigntolabel etc are exported methods called by frontend (Headlines.js) 2021-11-16 15:45:35 +03:00
Andrew Dolgov 4166628c36 Merge branch 'wip-phpstan-level6' of git.tt-rss.org:fox/tt-rss into wip-phpstan-level6 2021-11-16 09:19:19 +03:00
Andrew Dolgov 6a8030fd76 mailer: don't crash if php mail() fails with no reported errors 2021-11-16 09:19:12 +03:00
wn_ d78ba7b3a9 Minor fix in 'classes/articles.php'.
It looks like these functions are dead code, though.  Adding comments for future review.
2021-11-16 02:14:31 +00:00
Andrew Dolgov b2952843f5 * DiskCache: add download() helper
* Af_Comics_Gocomics_FarSide: cache linked images because it seems to
be required anyway
2021-11-15 23:22:21 +03:00
wn_ 109b702ed0 Minor fix to DOMNodeList#item() potential type (null vs false) 2021-11-15 12:24:38 +00:00
Andrew Dolgov aa924d9ee7 deal with several DOMElement-related errors 2021-11-15 08:26:02 +03:00
Andrew Dolgov 2493c9cddd set better matching type hint on virtual feed object 2021-11-15 08:19:44 +03:00
Andrew Dolgov 676c5787e7 require virtual feed plugins to implement IVirtualFeed 2021-11-15 07:11:29 +03:00
Andrew Dolgov 3bd13b91c8 add IVirtualFeed interface for plugins implementing virtual feeds 2021-11-15 07:08:41 +03:00
Andrew Dolgov 07ea364189 Merge branch 'wip-phpstan-level6' of git.tt-rss.org:fox/tt-rss into wip-phpstan-level6 2021-11-15 06:54:04 +03:00
Andrew Dolgov edc7998851 revise phpdoc annotations for hook_search() 2021-11-15 06:53:55 +03:00
wn_ fb208bb136 Fix a PHPStan warning in 'UrlHelper::rewrite_relative()'. 2021-11-15 03:28:17 +00:00
wn_ 41b4eef504 Address PHPStan warnings for FeedEnclosure. 2021-11-15 02:46:19 +00:00
wn_ 78acf18b70 Address PHPStan warnings in FeedItem classes. 2021-11-15 02:40:45 +00:00
wn_ 8943604aad Change the param type for UserHelper::hash_password() $algo to appease PHPStan.
PHPStan was complaining in 'plugins/auth_internal/init.php' due to UserHelper::hash_password() being passed a string, rather than a UserHelper::HASH_ALGO_* constant.  Just switching the param to string for now.
2021-11-14 22:44:48 +00:00
wn_ 324d926eb4 Also fix the param signature for Plugin#hook_hotkey_info() 2021-11-14 22:16:16 +00:00
wn_ 12f9df1066 Fix the return signature for Plugin#hook_hotkey_info() 2021-11-14 22:11:27 +00:00
wn_ 6d438c5a77 Address PHPStan warning in 'classes/pref/users.php'. 2021-11-14 20:27:17 +00:00
wn_ 5632d75a45 Address PHPStan warning in 'classes/pref/system.php'. 2021-11-14 20:26:21 +00:00
wn_ abab2a94e8 Address PHPStan warning in 'classes/pref/prefs.php'.
Also update 'select_hash' and 'select_tag' values param, which can have int or string keys.
2021-11-14 20:13:09 +00:00
wn_ b8f0627a0e Address PHPStan warning in 'classes/pref/labels.php'. 2021-11-14 20:13:09 +00:00
Andrew Dolgov 56cf425e45 revise prototype for hook_enclosure_imported 2021-11-14 23:03:25 +03:00
wn_ 9326ed605f Address PHPStan warning in 'classes/pref/filters.php'. 2021-11-14 17:59:57 +00:00
wn_ 812f5f532e Address PHPStan warning in 'classes/mailer.php'. 2021-11-14 17:59:57 +00:00
Andrew Dolgov 931a7533ce adjust some return types in urlhelper 2021-11-14 20:53:30 +03:00
Andrew Dolgov afdb4b0072 set phpdoc annotations for auth_base 2021-11-14 20:26:05 +03:00
Andrew Dolgov 6bd6a14c20 revise phpdoc annotations for hook_sanitize() 2021-11-14 20:19:12 +03:00
wn_ f5c881586b Handle potentially null link, title, etc. in FeedParser. 2021-11-14 16:59:21 +00:00
Andrew Dolgov 7988c79bd4 plugin.php: add some minor method phpdoc corrections 2021-11-14 18:05:31 +03:00
Andrew Dolgov 1b5c61ac85 userhelper: add a phpdoc variable class hint 2021-11-14 18:02:20 +03:00
Andrew Dolgov 01b39d985c deal with the rest of warnings in plugin.php 2021-11-14 18:00:03 +03:00
Andrew Dolgov dd7299b6d0 deal with a few more phpstan warnings re: base plugin class 2021-11-14 17:19:35 +03:00
Andrew Dolgov 55729b4bbd fix HOOK_QUERY_HEADLINES being invoked with different argument lists, add some more phpdoc comments for base plugin class 2021-11-14 17:07:47 +03:00
Andrew Dolgov af2f4460ce * deal with some phpstan warnings in base plugin class
* arguably better hack for incompatible plugins causing E_COMPILE_ERROR
2021-11-14 16:49:10 +03:00
Andrew Dolgov 15af164f69 pluginhost: add a hack to not crash on an incompatible plugin more than once (per login) - UGLY 2021-11-14 11:50:55 +03:00
Andrew Dolgov 0a2dcacbcf normalize some mismatching hook function definitions to match base Plugin class 2021-11-14 11:11:49 +03:00
Andrew Dolgov 81a10f69bc deal with phpstan warnings related to base authentication modules 2021-11-14 10:48:32 +03:00
wn_ 5a50c333b2 Address PHPStan warnings in 'classes/pref/filters.php'. 2021-11-14 00:59:19 +00:00
Andrew Dolgov fe5ada7250 set some annotations on Plugin hook methods 2021-11-13 20:07:13 +03:00
Andrew Dolgov 5e34fe17a7 experimental: bring back plugin hooks to Plugin base class once (to be improved/fixed with annotations later) 2021-11-13 20:03:28 +03:00
Andrew Dolgov 618e96b793 deal with some warnings in plugins/trgm,readability and base plugin class 2021-11-13 19:55:30 +03:00
Andrew Dolgov 03d0692268 no need to duplicate annotations 2021-11-13 19:52:47 +03:00
Andrew Dolgov 37827427a2 rework previous Plugin changes as phpdoc annotations 2021-11-13 19:41:50 +03:00
Andrew Dolgov 9845d5fd15 revert all plugin base class related changes to keep compatibility with extant plugins (for the time being) 2021-11-13 19:36:26 +03:00
wn_ edd476e7fe minor: correct $cat type in Pref_Feeds#calculate_children_count() 2021-11-13 16:00:59 +00:00
wn_ a18473e4c0 Address PHPStan warnings in 'classes/pref/feeds.php'. 2021-11-13 15:56:31 +00:00
wn_ b37a03fb31 Fix the type of Labels::update_cache() 2021-11-13 15:56:31 +00:00
Andrew Dolgov f2323bda81 fix phpstan warnings in classes/plugin-template.php 2021-11-13 18:26:11 +03:00
Andrew Dolgov 70051742af experimental: also don't keep base plugin template as a non-analyzed file 2021-11-13 18:21:04 +03:00
Andrew Dolgov b381e95792 experimental: auto-generate and add all plugin hook methods to Plugin class 2021-11-13 18:18:05 +03:00
Andrew Dolgov 8a83f061bf fix phpstan warnings in classes/sanitizer.php 2021-11-13 17:52:03 +03:00
Andrew Dolgov a7983d475e fix phpstan warnings in classes/api.php 2021-11-13 17:51:26 +03:00
Andrew Dolgov 77b8dc7386 fix phpstan warnings in classes/feedparser.php 2021-11-13 17:48:52 +03:00
Andrew Dolgov 45431170b6 fix phpstan warnings in classes/db/migrations.php 2021-11-13 17:31:13 +03:00
wn_ 3ba8d964b6 Address PHPStan warnings in 'classes/api.php'. 2021-11-13 14:15:20 +00:00