@@ -483,27 +483,25 @@ function wprss_fetch_feeds_action_hook()
483
483
{
484
484
$ response = wprss ()->createAjaxResponse ();
485
485
$ 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 ' ;
494
487
488
+ try {
495
489
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. ' ));
500
491
}
501
492
502
493
// Verify admin referer
503
494
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 ' ));
505
496
}
506
497
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
+
507
505
update_post_meta ($ id , 'wprss_force_next_fetch ' , '1 ' );
508
506
509
507
// Prepare the schedule args
@@ -534,7 +532,7 @@ function wprss_fetch_feeds_action_hook()
534
532
} catch (Exception $ e ) {
535
533
$ response = wprss ()->createAjaxErrorResponse ($ e );
536
534
if (isset ($ id )) {
537
- $ response ->setAjaxData ($ kFeedSourceId , $ id );
535
+ $ response ->setAjaxData ($ feedIdKey , $ id );
538
536
}
539
537
echo $ response ->getBody ();
540
538
exit ();
0 commit comments