Skip to content

Commit 63dc7b8

Browse files
committed
Merge branch 'develop'
2 parents 6ac1322 + 935532e commit 63dc7b8

File tree

9 files changed

+905
-918
lines changed

9 files changed

+905
-918
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [4.20] - 2022-01-18
8+
### Added
9+
* New option to use feed item GUIDs instead of permalinks to detect duplicate items.
10+
11+
### Changed
12+
* Small performance improvement when importing feed items.
13+
14+
### Fixed
15+
* A warning about `get_headers()` only working with URLs.
16+
* A warning about iteration over a non-array value.
17+
* An AJAX XSS vulnerability on the Feed Sources page. Thanks WPScan!
18+
719
## [4.19.3] - 2021-11-24
820
### Fixed
921
* An error during cron schedule filtering.

includes/Aventura/Wprss/Core/Licensing/Settings.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,13 @@ public function renderActivateLicenseButton( $args ) {
349349
);
350350

351351
$license = $manager->getLicense($addonId);
352+
$licenseValid = $license !== null && $license->isValid();
353+
$licenseKey = $license !== null ? $license->getKey() : null;
352354

353-
if ($license !== null && !$license->isInvalid() && ($licenseKey = $license->getKey()) && !empty($licenseKey)) {
355+
if ($licenseValid && !empty($licenseKey)) {
354356
if (!is_object($data)) {
355357
printf(
356-
'<p><small>%</small></p>',
358+
'<p><small>%s</small></p>',
357359
__(
358360
'Failed to get license information. This is a temporary problem. Check your internet connection and try again later.',
359361
'wprss'

includes/admin-display.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -483,27 +483,25 @@ function wprss_fetch_feeds_action_hook()
483483
{
484484
$response = wprss()->createAjaxResponse();
485485
$wprss = wprss();
486-
$kFeedSourceId = 'feed_source_id';
487-
try {
488-
$kId = 'id';
489-
if (!isset($_POST[$kId]) || empty($_POST[$kId])) {
490-
throw new Exception($wprss->__('Could not schedule fetch: source ID must be specified'));
491-
}
492-
$id = $_POST['id'];
493-
$response->setAjaxData($kFeedSourceId, $id);
486+
$feedIdKey = 'feed_source_id';
494487

488+
try {
495489
if (!current_user_can('edit_feed_sources')) {
496-
throw new Exception($wprss->__([
497-
'Could not schedule fetch for source #%1$s: user must have sufficient privileges',
498-
$id,
499-
]));
490+
throw new Exception(__('Could not schedule fetch for feed source: user must have sufficient privileges.'));
500491
}
501492

502493
// Verify admin referer
503494
if (!wprss_verify_nonce('wprss_feed_source_action', 'wprss_admin_ajax_nonce')) {
504-
throw new Exception($wprss->__(['Could not schedule fetch for source #%1$s: nonce is expired', $id]));
495+
throw new Exception(__('Could not schedule fetch for feed source: nonce is invalid.', 'wprss'));
505496
}
506497

498+
$id = filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT);
499+
if (!$id) {
500+
throw new Exception($wprss->__('Could not schedule fetch: feed source ID is invalid or was not specified'));
501+
}
502+
$response->setAjaxData($feedIdKey, $id);
503+
504+
507505
update_post_meta($id, 'wprss_force_next_fetch', '1');
508506

509507
// Prepare the schedule args
@@ -534,7 +532,7 @@ function wprss_fetch_feeds_action_hook()
534532
} catch (Exception $e) {
535533
$response = wprss()->createAjaxErrorResponse($e);
536534
if (isset($id)) {
537-
$response->setAjaxData($kFeedSourceId, $id);
535+
$response->setAjaxData($feedIdKey, $id);
538536
}
539537
echo $response->getBody();
540538
exit();

includes/admin-help-metaboxes.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
'wprss'
5757
),
5858

59+
'wprss_use_guids' => __(
60+
'Enable this option to identify duplicate feed items by their GUIDs, rather than by their permalink.' .
61+
"\n\n" .
62+
'This can be useful when the feed items share the same permalink, and so not all feed items would get imported.',
63+
'wprss'
64+
),
65+
5966
'wprss_import_source' => __(
6067
'Tick this box to get the site name and URL from the RSS feed, for each item individually.' .
6168
"\n\n" .

includes/admin-metaboxes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ function wprss_get_custom_fields()
122122
'type' => 'checkbox',
123123
];
124124

125+
$wprss_meta_fields['use_guids'] = [
126+
'label' => __('Use GUIDs', 'wprss'),
127+
'id' => $prefix . 'use_guids',
128+
'type' => 'checkbox',
129+
];
130+
125131
// for extensibility, allows more meta fields to be added
126132
return apply_filters('wprss_fields', $wprss_meta_fields);
127133
}

includes/feed-importing-images.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ function wpra_get_item_enclosure_images($item)
464464
continue;
465465
}
466466

467-
foreach ($enclosure->get_thumbnails() as $thumbnail) {
467+
$thumbnails = $enclosure->get_thumbnails();
468+
$thumbnails = is_array($thumbnails) ? $thumbnails : [];
469+
470+
foreach ($thumbnails as $thumbnail) {
468471
if (empty($thumbnail)) {
469472
continue;
470473
}
@@ -1036,7 +1039,8 @@ function wpra_image_feature_enabled($feature)
10361039
*/
10371040
function wpra_is_url_an_image($url)
10381041
{
1039-
$headers = get_headers($url, true);
1042+
$headers = @get_headers($url, true);
1043+
$headers = is_array($headers) ? $headers : [];
10401044
$headers = array_change_key_case($headers, CASE_LOWER);
10411045

10421046
if (empty($headers['content-type'])) {

0 commit comments

Comments
 (0)