WordPress.org

Plugin Directory

Changeset 1729270 for feedwordpress


Ignore:
Timestamp:
09/13/17 11:55:16 (3 months ago)
Author:
radgeek
Message:

2017.0913 / PHP compatibility fixes, limited fix for one source of 2x duplicate post errors.

Location:
feedwordpress/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • feedwordpress/trunk/feeds-page.php

    r1553712 r1729270  
    195195        <div id="cron-job-explanation" class="setting-description"> 
    196196        <p><?php 
    197         $path = `which curl`; $opts = '--silent %s'; 
     197        // Do we have shell_exec() available from here, or is it disabled for security reasons? 
     198        // If it's available, use it to execute `which` to try to get a realistic path to curl, 
     199        // or to wget. If everything fails or shell_exec() isn't available, then just make 
     200        // up something for the sake of example. 
     201        $shellExecAvailable = (is_callable('shell_exec') && false === stripos(ini_get('disable_functions'), 'shell_exec'));      
     202 
     203        if ($shellExecAvailable) : 
     204            $path = `which curl`; $opts = '--silent %s'; 
     205        endif; 
     206 
     207        if ($shellExecAvailable and (is_null($path) or strlen(trim($path))==0)) : 
     208            $path = `which wget`; $opts = '-q -O - %s'; 
     209        endif; 
     210 
    198211        if (is_null($path) or strlen(trim($path))==0) : 
    199             $path = `which wget`; $opts = '-q -O - %s'; 
    200             if (is_null($path) or strlen(trim($path))==0) : 
    201                 $path = '/usr/bin/curl'; $opts = '--silent %s'; 
    202             endif; 
    203         endif; 
     212            $path = '/usr/bin/curl'; $opts = '--silent %s'; 
     213        endif; 
     214 
    204215        $path = preg_replace('/\n+$/', '', $path); 
    205         $crontab = `crontab -l`; 
    206216         
    207217        $cmdline = $path . ' ' . sprintf($opts, get_bloginfo('url').'?update_feedwordpress=1'); 
  • feedwordpress/trunk/feedwordpress.php

    r1553712 r1729270  
    44Plugin URI: http://feedwordpress.radgeek.com/ 
    55Description: simple and flexible Atom/RSS syndication for WordPress 
    6 Version: 2016.1213 
     6Version: 2017.0913 
    77Author: Charles Johnson 
    88Author URI: http://radgeek.com/ 
     
    1212/** 
    1313 * @package FeedWordPress 
    14  * @version 2016.1213 
     14 * @version 2017.0913 
    1515 */ 
    1616 
     
    3333# -- Don't change these unless you know what you're doing... 
    3434 
    35 define ('FEEDWORDPRESS_VERSION', '2016.1213'); 
     35define ('FEEDWORDPRESS_VERSION', '2017.0913'); 
    3636define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact'); 
    3737 
     
    18241824        // Explicit update request in the HTTP request (e.g. from a cron job) 
    18251825        if (self::update_requested()) : 
    1826  
     1826            /*DBG*/ header("Content-Type: text/plain"); 
     1827             
    18271828            $this->update_hooked = "Initiating a CRON JOB CHECK-IN ON UPDATE SCHEDULE due to URL parameter = ".trim($this->val($_REQUEST['update_feedwordpress'])); 
    18281829 
  • feedwordpress/trunk/feedwordpresslocalpost.class.php

    r960798 r1729270  
    9494    public function feed () { 
    9595        global $feedwordpress; 
    96         $this->link = $feedwordpress->subscription($this->feed_id()); 
     96        if (is_object($feedwordpress) and method_exists($feedwordpress, 'subscription')) : 
     97            $this->link = $feedwordpress->subscription($this->feed_id()); 
     98        endif; 
    9799        return $this->link; 
    98100    } 
  • feedwordpress/trunk/feedwordpresssyndicationpage.class.php

    r1553729 r1729270  
    866866                $result = $wpdb->query($sql); 
    867867                if (!$result): 
    868                     $errs[] = mysql_error(); 
     868                    $errs[] = $wpdb->last_error; 
    869869                endif; 
    870870            endforeach; 
     
    989989                $result = $wpdb->query($sql); 
    990990                if (!$result): 
    991                     $errs[] = mysql_error(); 
     991                    $errs[] = $wpdb->last_error; 
    992992                endif; 
    993993            endforeach; 
     
    12191219| <a href="admin.php?page=<?php print $fwp_path; ?>/feeds-page.php&amp;link_id=<?php print $link_id; ?>">Configure settings</a>.</p></div> 
    12201220<?php           else: ?> 
    1221 <div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo esc_html(mysql_error()); ?>]</p></div> 
     1221<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo esc_html($wpdb->last_error); ?>]</p></div> 
    12221222<?php           endif; 
    12231223        elseif (isset($fwp_post['save_link_id'])): 
  • feedwordpress/trunk/readme.txt

    r1553712 r1729270  
    44Tags: syndication, aggregation, feed, atom, rss 
    55Requires at least: 4.5 
    6 Tested up to: 4.7 
    7 Stable tag: 2016.1213 
     6Tested up to: 4.8.1 
     7Stable tag: 2017.0913 
    88 
    99FeedWordPress syndicates content from feeds you choose into your WordPress weblog.  
     
    9494== Changelog == 
    9595 
     96= 2017.0913 = 
     97 
     98*   PARTIAL FIX FOR 2X DUPLICATE POSTS APPEARING ON DUAL HTTP/HTTPS SITES: Some 
     99    users reported an issue in which their FeedWordPress sites, which are over 
     100    both insecure HTTP and over HTTPS, would pick up exactly 2 copies of every 
     101    post or almost every post from certain feeds, and where the guids for each 
     102    of the pair of duplicate posts would look exactly alike, except for a 
     103    difference in the protocol, for example: 
     104 
     105        http://www.example.com/?guid=c1cd28da39e8d7babcf6499983aca545  
     106        https://www.example.com/?guid=c1cd28da39e8d7babcf6499983aca545 
     107 
     108    ... where www.example.com is the server that your own copy of FeedWordPress 
     109    is installed. This release of FeedWordPress normalizes post guid prefixes 
     110    so as to avoid or limit the scope of this problem. 
     111 
     112*   PHP 7 Compatibility: eliminate remaining sources of PHP 7 compatibility-check 
     113    failures -- remove the use of depreciated mysql_error() function, and make 
     114    sure all classes make use of __construct() convention for constructors. 
     115 
     116*   AVOID "PHP Warning: shell_exec() has been disabled for security reasons in 
     117    [...]/feedwordpress/feeds-page.php on line 197": FeedWordPress uses the PHP 
     118    shell_exec() function in a very narrowly limited way for information gathering, 
     119    trying to find the real path to curl or wget on your system, so that it can 
     120    give as realistic as possible a recommendation for the sample crontab line 
     121    displayed in Syndication > Feeds & Updates. Some web hosting environments 
     122    disable shell_exec for security reasons (since it could in theory be used to 
     123    do a lot more stuff than the very limited information gathering FWP uses it 
     124    for); in which case, this part of the code in FeedWordPress could spit out 
     125    a nasty-looking and potentially worrisome-looking error message. So, now this 
     126    code is fenced with checks to make sure that shell_exec is available, before 
     127    FWP attempts to make use of it. 
     128 
    96129= 2016.1213 = 
    97130 
    98 *   WORDPRSS BACKWARD COMPATIBILITY FOR VERSIONS [4.5, 4.7]: This change fixes 
     131*   WORDPRESS BACKWARD COMPATIBILITY FOR VERSIONS [4.5, 4.7]: This change fixes 
    99132    a fatal PHP error (on some web server configurations you'd see the message 
    100133    "Fatal error: require_once(): Failed opening required '[...]/wp-includes/class-wp-feed-cache.php'" 
  • feedwordpress/trunk/syndicatedpost.class.php

    r1551908 r1729270  
    585585    } /* SyndicatedPost::update_hash() */ 
    586586 
     587    /** 
     588     * SyndicatedPost::normalize_guid_prefix(): generates a normalized URL 
     589     * prefix (including scheme, authority, full path, and the beginning of 
     590     * a query string) for creating guids that conform to WordPress's 
     591     * internal constraints on the URL space for valid guids. To create a 
     592     * normalized guid, just concatenate a valid URL query parameter value 
     593     * to the returned URL. 
     594     * 
     595     * @return string The URL prefix generated. 
     596     * 
     597     * @uses trailingslashit() 
     598     * @uses home_url() 
     599     * @uses apply_filters() 
     600     */ 
    587601    static function normalize_guid_prefix () { 
    588         return trailingslashit(get_bloginfo('url')).'?guid='; 
    589     } 
     602        $url = trailingslashit(home_url(/*path=*/ '', /*scheme=*/ 'http')); 
     603        return apply_filters('syndicated_item_guid_normalized_prefix', $url . '?guid='); 
     604    } /* SyndicatedPost::normalize_guid_prefix() */ 
    590605 
    591606    static function normalize_guid ($guid) { 
     
    597612        endif; 
    598613        $guid = trim($guid); 
     614         
    599615        return $guid; 
    600616    } /* SyndicatedPost::normalize_guid() */ 
  • feedwordpress/trunk/syndicationdataqueries.class.php

    r1551908 r1729270  
    5656                    $seek[] = $nGuid; 
    5757                endif; 
    58  
     58                 
    5959                // Escape to prevent frak-ups, injections, etc. 
    6060                $seek = array_map('esc_sql', $seek); 
Note: See TracChangeset for help on using the changeset viewer.