Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-import-export-lite/includes/classes/import/downloader/download.php
+++ b/wp-import-export-lite/includes/classes/import/downloader/download.php
@@ -3,34 +3,41 @@
namespace wpieimportDownloader;
-defined( 'ABSPATH' ) || exit;
+defined('ABSPATH') || exit;
-class Download {
+class Download
+{
- private $url = "";
- private $sslverify = false;
+ private $url = "";
+ private $sslverify = false;
private $redirection = 5;
- private $timeout = 3000;
+ private $timeout = 3000;
+
+ public function __construct()
+ {
- public function __construct() {
-
}
- public function download_file( $url = "" ) {
+ public function download_file($url = "")
+ {
+
+ if (empty($url)) {
+ return new WP_Error('wpie_import_error', __('File Download Error : File URL is empty', 'wp-import-export-lite'));
+ }
- $this->url = $url;
+ $this->url = wp_http_validate_url($url);
- if ( empty( $this->url ) ) {
- return new WP_Error( 'wpie_import_error', __( 'File Download Error : File URL is empty', 'wp-import-export-lite' ) );
+ if (false === $this->url) {
+ return new WP_Error('wpie_import_error', __('File Download Error : File URL is not valid', 'wp-import-export-lite'));
}
$wp_file = $this->wp_download();
- if ( is_wp_error( $wp_file ) ) {
+ if (is_wp_error($wp_file)) {
$guzzle_file = $this->guzzle_download();
- if ( !is_wp_error( $guzzle_file ) ) {
+ if (!is_wp_error($guzzle_file)) {
$wp_file = $guzzle_file;
}
}
@@ -38,52 +45,54 @@
return $wp_file;
}
- private function wp_download() {
+ private function wp_download()
+ {
$filename = time() . rand() . ".tmp";
$file = get_temp_dir() . $filename;
- $response = wp_safe_remote_get( $this->url, [ 'timeout' => $this->timeout, 'stream' => true, 'filename' => $file, 'sslverify' => $this->sslverify ] );
+ $response = wp_safe_remote_get($this->url, ['timeout' => $this->timeout, 'stream' => true, 'filename' => $file, 'sslverify' => $this->sslverify]);
- if ( is_wp_error( $response ) ) {
+ if (is_wp_error($response)) {
- if ( file_exists( $file ) ) {
- unlink( $file );
+ if (file_exists($file)) {
+ unlink($file);
}
return $response;
}
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
+ if (200 != wp_remote_retrieve_response_code($response)) {
- if ( file_exists( $file ) ) {
- unlink( $file );
+ if (file_exists($file)) {
+ unlink($file);
}
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
+ return new WP_Error('http_404', trim(wp_remote_retrieve_response_message($response)));
}
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
+ $content_md5 = wp_remote_retrieve_header($response, 'content-md5');
- if ( $content_md5 ) {
+ if ($content_md5) {
- $md5_check = verify_file_md5( $file, $content_md5 );
+ $md5_check = verify_file_md5($file, $content_md5);
- if ( is_wp_error( $md5_check ) ) {
+ if (is_wp_error($md5_check)) {
- if ( file_exists( $file ) ) {
- unlink( $file );
+ if (file_exists($file)) {
+ unlink($file);
}
return $md5_check;
}
- unset( $md5_check );
+ unset($md5_check);
}
return $file;
}
- private function guzzle_download() {
+ private function guzzle_download()
+ {
$filename = time() . rand() . ".tmp";
@@ -94,34 +103,34 @@
try {
$client = new GuzzleHttpClient();
- $response = $client->request( 'GET', $this->url, [ 'sink' => $file, 'verify' => false ] );
- } catch ( Exception $e ) {
- return new WP_Error( 'download_error', $e->getMessage() );
+ $response = $client->request('GET', $this->url, ['sink' => $file, 'verify' => false]);
+ } catch (Exception $e) {
+ return new WP_Error('download_error', $e->getMessage());
}
- if ( 200 != $response->getStatusCode() ) {
+ if (200 != $response->getStatusCode()) {
- if ( file_exists( $file ) ) {
- unlink( $file );
+ if (file_exists($file)) {
+ unlink($file);
}
- return new WP_Error( 'download_error', __( "File Download Error : Invalid Status Code", 'wp-import-export-lite' ) );
+ return new WP_Error('download_error', __("File Download Error : Invalid Status Code", 'wp-import-export-lite'));
}
- $content_md5 = $response->getHeaderLine( 'content-type' );
+ $content_md5 = $response->getHeaderLine('content-type');
- if ( $content_md5 ) {
+ if ($content_md5) {
- $md5_check = verify_file_md5( $file, $content_md5 );
+ $md5_check = verify_file_md5($file, $content_md5);
- if ( is_wp_error( $md5_check ) ) {
+ if (is_wp_error($md5_check)) {
- if ( file_exists( $file ) ) {
- unlink( $file );
+ if (file_exists($file)) {
+ unlink($file);
}
return $md5_check;
}
- unset( $md5_check );
+ unset($md5_check);
}
--- a/wp-import-export-lite/wp-import-export-lite.php
+++ b/wp-import-export-lite/wp-import-export-lite.php
@@ -3,224 +3,225 @@
/*
Plugin Name: WP Import Export Lite
Description: The Advanced and powerful solution for importing and exporting data to WordPress. Import and Export to Posts, Pages, and Custom Post Types. Ability to update existing data, and much more.
- Version: 3.9.30
+ Version: 3.9.31
Author: VJInfotech
Author URI: http://www.vjinfotech.com
Text Domain: wp-import-export-lite
Domain Path: /languages/
*/
-defined( 'ABSPATH' ) || exit;
+defined('ABSPATH') || exit;
-if ( file_exists( realpath( plugin_dir_path( __FILE__ ) ) . '/deactivate-plugins.php' ) ) {
- require_once(realpath( plugin_dir_path( __FILE__ ) ) . '/deactivate-plugins.php');
- add_action( 'admin_init', 'wpie_auto_deactivate_pro_plugins' );
+if (file_exists(realpath(plugin_dir_path(__FILE__)) . '/deactivate-plugins.php')) {
+ require_once(realpath(plugin_dir_path(__FILE__)) . '/deactivate-plugins.php');
+ add_action('admin_init', 'wpie_auto_deactivate_pro_plugins');
}
// Plugin version
-if ( !defined( 'WPIE_PLUGIN_VERSION' ) ) {
- define( 'WPIE_PLUGIN_VERSION', '3.9.30' );
+if (!defined('WPIE_PLUGIN_VERSION')) {
+ define('WPIE_PLUGIN_VERSION', '3.9.30');
}
// Plugin version
-if ( !defined( 'WPIE_DB_VERSION' ) ) {
- define( 'WPIE_DB_VERSION', '1.0.0' );
+if (!defined('WPIE_DB_VERSION')) {
+ define('WPIE_DB_VERSION', '1.0.0');
}
// Plugin base name
-if ( !defined( 'WPIE_PLUGIN_FILE' ) ) {
- define( 'WPIE_PLUGIN_FILE', __FILE__ );
+if (!defined('WPIE_PLUGIN_FILE')) {
+ define('WPIE_PLUGIN_FILE', __FILE__);
}
// Plugin Folder Path
-if ( !defined( 'WPIE_PLUGIN_DIR' ) ) {
- define( 'WPIE_PLUGIN_DIR', realpath( plugin_dir_path( WPIE_PLUGIN_FILE ) ) . '/' );
+if (!defined('WPIE_PLUGIN_DIR')) {
+ define('WPIE_PLUGIN_DIR', realpath(plugin_dir_path(WPIE_PLUGIN_FILE)) . '/');
}
-$plugin_url = plugin_dir_url( WPIE_PLUGIN_FILE );
+$plugin_url = plugin_dir_url(WPIE_PLUGIN_FILE);
-if ( is_ssl() ) {
- $plugin_url = str_replace( 'http://', 'https://', $plugin_url );
+if (is_ssl()) {
+ $plugin_url = str_replace('http://', 'https://', $plugin_url);
}
-if ( !defined( 'WPIE_PLUGIN_URL' ) ) {
- define( 'WPIE_PLUGIN_URL', untrailingslashit( $plugin_url ) );
+if (!defined('WPIE_PLUGIN_URL')) {
+ define('WPIE_PLUGIN_URL', untrailingslashit($plugin_url));
}
// Plugin site path
-if ( !defined( 'WPIE_PLUGIN_SITE' ) ) {
- define( 'WPIE_PLUGIN_SITE', 'http://www.vjinfotech.com' );
+if (!defined('WPIE_PLUGIN_SITE')) {
+ define('WPIE_PLUGIN_SITE', 'http://www.vjinfotech.com');
}
-if ( !defined( 'WPIE_PLUGIN_API' ) ) {
- define( 'WPIE_PLUGIN_API', 'http://api.vjinfotech.com/' );
+if (!defined('WPIE_PLUGIN_API')) {
+ define('WPIE_PLUGIN_API', 'http://api.vjinfotech.com/');
}
-if ( !defined( 'WPIE_DOC_URL' ) ) {
- define( 'WPIE_DOC_URL', 'http://plugins.vjinfotech.com/wordpress-import-export/documentation/' );
+if (!defined('WPIE_DOC_URL')) {
+ define('WPIE_DOC_URL', 'http://plugins.vjinfotech.com/wordpress-import-export/documentation/');
}
-if ( !defined( 'WPIE_SUPPORT_URL' ) ) {
- define( 'WPIE_SUPPORT_URL', 'http://www.vjinfotech.com/support/' );
+if (!defined('WPIE_SUPPORT_URL')) {
+ define('WPIE_SUPPORT_URL', 'http://www.vjinfotech.com/support/');
}
$wpupload_dir = wp_upload_dir();
-$wpie_upload_dir = $wpupload_dir[ 'basedir' ] . '/wp-import-export-lite';
+$wpie_upload_dir = $wpupload_dir['basedir'] . '/wp-import-export-lite';
-$wpie_upload_url = $wpupload_dir[ 'baseurl' ] . '/wp-import-export-lite';
+$wpie_upload_url = $wpupload_dir['baseurl'] . '/wp-import-export-lite';
-if ( !defined( 'WPIE_SITE_UPLOAD_DIR' ) ) {
- define( 'WPIE_SITE_UPLOAD_DIR', $wpupload_dir[ 'basedir' ] );
+if (!defined('WPIE_SITE_UPLOAD_DIR')) {
+ define('WPIE_SITE_UPLOAD_DIR', $wpupload_dir['basedir']);
}
-unset( $wpupload_dir );
+unset($wpupload_dir);
-if ( !defined( 'WPIE_UPLOAD_DIR' ) ) {
- define( 'WPIE_UPLOAD_DIR', $wpie_upload_dir );
+if (!defined('WPIE_UPLOAD_DIR')) {
+ define('WPIE_UPLOAD_DIR', $wpie_upload_dir);
}
-if ( !defined( 'WPIE_UPLOAD_URL' ) ) {
- define( 'WPIE_UPLOAD_URL', $wpie_upload_url );
+if (!defined('WPIE_UPLOAD_URL')) {
+ define('WPIE_UPLOAD_URL', $wpie_upload_url);
}
-unset( $wpie_upload_url );
+unset($wpie_upload_url);
-if ( !defined( 'WPIE_ASSETS_URL' ) ) {
- define( 'WPIE_ASSETS_URL', WPIE_PLUGIN_URL . '/assets' );
+if (!defined('WPIE_ASSETS_URL')) {
+ define('WPIE_ASSETS_URL', WPIE_PLUGIN_URL . '/assets');
}
-if ( !defined( 'WPIE_UPLOAD_EXPORT_DIR' ) ) {
- define( 'WPIE_UPLOAD_EXPORT_DIR', WPIE_UPLOAD_DIR . "/export" );
+if (!defined('WPIE_UPLOAD_EXPORT_DIR')) {
+ define('WPIE_UPLOAD_EXPORT_DIR', WPIE_UPLOAD_DIR . "/export");
}
-if ( !defined( 'WPIE_UPLOAD_IMPORT_DIR' ) ) {
- define( 'WPIE_UPLOAD_IMPORT_DIR', WPIE_UPLOAD_DIR . "/import" );
+if (!defined('WPIE_UPLOAD_IMPORT_DIR')) {
+ define('WPIE_UPLOAD_IMPORT_DIR', WPIE_UPLOAD_DIR . "/import");
}
-if ( !defined( 'WPIE_UPLOAD_TEMP_DIR' ) ) {
- define( 'WPIE_UPLOAD_TEMP_DIR', WPIE_UPLOAD_DIR . "/temp" );
+if (!defined('WPIE_UPLOAD_TEMP_DIR')) {
+ define('WPIE_UPLOAD_TEMP_DIR', WPIE_UPLOAD_DIR . "/temp");
}
-if ( !defined( 'WPIE_UPLOAD_MAIN_DIR' ) ) {
- define( 'WPIE_UPLOAD_MAIN_DIR', WPIE_UPLOAD_DIR . "/upload" );
+if (!defined('WPIE_UPLOAD_MAIN_DIR')) {
+ define('WPIE_UPLOAD_MAIN_DIR', WPIE_UPLOAD_DIR . "/upload");
}
-wp_mkdir_p( $wpie_upload_dir );
+wp_mkdir_p($wpie_upload_dir);
-unset( $wpie_upload_dir );
+unset($wpie_upload_dir);
-if ( !is_dir( WPIE_UPLOAD_EXPORT_DIR ) ) {
- wp_mkdir_p( WPIE_UPLOAD_EXPORT_DIR );
+if (!is_dir(WPIE_UPLOAD_EXPORT_DIR)) {
+ wp_mkdir_p(WPIE_UPLOAD_EXPORT_DIR);
}
-if ( !is_dir( WPIE_UPLOAD_IMPORT_DIR ) ) {
- wp_mkdir_p( WPIE_UPLOAD_IMPORT_DIR );
+if (!is_dir(WPIE_UPLOAD_IMPORT_DIR)) {
+ wp_mkdir_p(WPIE_UPLOAD_IMPORT_DIR);
}
-if ( !is_dir( WPIE_UPLOAD_TEMP_DIR ) ) {
- wp_mkdir_p( WPIE_UPLOAD_TEMP_DIR );
+if (!is_dir(WPIE_UPLOAD_TEMP_DIR)) {
+ wp_mkdir_p(WPIE_UPLOAD_TEMP_DIR);
}
-if ( !is_dir( WPIE_UPLOAD_MAIN_DIR ) ) {
- wp_mkdir_p( WPIE_UPLOAD_MAIN_DIR );
+if (!is_dir(WPIE_UPLOAD_MAIN_DIR)) {
+ wp_mkdir_p(WPIE_UPLOAD_MAIN_DIR);
}
-if ( wp_is_writable( WPIE_UPLOAD_DIR ) && is_dir( WPIE_UPLOAD_DIR ) ) {
- @touch( WPIE_UPLOAD_DIR . '/index.php' );
+if (wp_is_writable(WPIE_UPLOAD_DIR) && is_dir(WPIE_UPLOAD_DIR)) {
+ @touch(WPIE_UPLOAD_DIR . '/index.php');
}
-if ( wp_is_writable( WPIE_UPLOAD_EXPORT_DIR ) && is_dir( WPIE_UPLOAD_EXPORT_DIR ) ) {
- @touch( WPIE_UPLOAD_EXPORT_DIR . '/index.php' );
+if (wp_is_writable(WPIE_UPLOAD_EXPORT_DIR) && is_dir(WPIE_UPLOAD_EXPORT_DIR)) {
+ @touch(WPIE_UPLOAD_EXPORT_DIR . '/index.php');
}
-if ( wp_is_writable( WPIE_UPLOAD_IMPORT_DIR ) && is_dir( WPIE_UPLOAD_IMPORT_DIR ) ) {
- @touch( WPIE_UPLOAD_IMPORT_DIR . '/index.php' );
+if (wp_is_writable(WPIE_UPLOAD_IMPORT_DIR) && is_dir(WPIE_UPLOAD_IMPORT_DIR)) {
+ @touch(WPIE_UPLOAD_IMPORT_DIR . '/index.php');
}
-if ( wp_is_writable( WPIE_UPLOAD_TEMP_DIR ) && is_dir( WPIE_UPLOAD_TEMP_DIR ) ) {
- @touch( WPIE_UPLOAD_TEMP_DIR . '/index.php' );
+if (wp_is_writable(WPIE_UPLOAD_TEMP_DIR) && is_dir(WPIE_UPLOAD_TEMP_DIR)) {
+ @touch(WPIE_UPLOAD_TEMP_DIR . '/index.php');
}
-if ( wp_is_writable( WPIE_UPLOAD_MAIN_DIR ) && is_dir( WPIE_UPLOAD_MAIN_DIR ) ) {
- @touch( WPIE_UPLOAD_MAIN_DIR . '/index.php' );
+if (wp_is_writable(WPIE_UPLOAD_MAIN_DIR) && is_dir(WPIE_UPLOAD_MAIN_DIR)) {
+ @touch(WPIE_UPLOAD_MAIN_DIR . '/index.php');
}
-if ( !defined( 'WPIE_IMPORT_ADDON_URL' ) ) {
- define( 'WPIE_IMPORT_ADDON_URL', WPIE_PLUGIN_URL . '/includes/classes/import/extensions' );
+if (!defined('WPIE_IMPORT_ADDON_URL')) {
+ define('WPIE_IMPORT_ADDON_URL', WPIE_PLUGIN_URL . '/includes/classes/import/extensions');
}
-if ( !defined( 'WPIE_EXPORT_ADDON_URL' ) ) {
- define( 'WPIE_EXPORT_ADDON_URL', WPIE_PLUGIN_URL . '/includes/classes/export/extensions' );
+if (!defined('WPIE_EXPORT_ADDON_URL')) {
+ define('WPIE_EXPORT_ADDON_URL', WPIE_PLUGIN_URL . '/includes/classes/export/extensions');
}
-if ( !defined( 'WPIE_CSS_URL' ) ) {
- define( 'WPIE_CSS_URL', WPIE_ASSETS_URL . '/css' );
+if (!defined('WPIE_CSS_URL')) {
+ define('WPIE_CSS_URL', WPIE_ASSETS_URL . '/css');
}
-if ( !defined( 'WPIE_JS_URL' ) ) {
- define( 'WPIE_JS_URL', WPIE_ASSETS_URL . '/js' );
+if (!defined('WPIE_JS_URL')) {
+ define('WPIE_JS_URL', WPIE_ASSETS_URL . '/js');
}
-if ( !defined( 'WPIE_IMAGES_URL' ) ) {
- define( 'WPIE_IMAGES_URL', WPIE_ASSETS_URL . '/images' );
+if (!defined('WPIE_IMAGES_URL')) {
+ define('WPIE_IMAGES_URL', WPIE_ASSETS_URL . '/images');
}
-if ( !defined( 'WPIE_INCLUDES_DIR' ) ) {
- define( 'WPIE_INCLUDES_DIR', WPIE_PLUGIN_DIR . '/includes' );
+if (!defined('WPIE_INCLUDES_DIR')) {
+ define('WPIE_INCLUDES_DIR', WPIE_PLUGIN_DIR . '/includes');
}
-if ( !defined( 'WPIE_LIBRARIES_DIR' ) ) {
- define( 'WPIE_LIBRARIES_DIR', WPIE_PLUGIN_DIR . '/libraries' );
+if (!defined('WPIE_LIBRARIES_DIR')) {
+ define('WPIE_LIBRARIES_DIR', WPIE_PLUGIN_DIR . '/libraries');
}
-if ( !defined( 'WPIE_CLASSES_DIR' ) ) {
- define( 'WPIE_CLASSES_DIR', WPIE_INCLUDES_DIR . '/classes' );
+if (!defined('WPIE_CLASSES_DIR')) {
+ define('WPIE_CLASSES_DIR', WPIE_INCLUDES_DIR . '/classes');
}
-if ( !defined( 'WPIE_IMPORT_CLASSES_DIR' ) ) {
- define( 'WPIE_IMPORT_CLASSES_DIR', WPIE_CLASSES_DIR . '/import' );
+if (!defined('WPIE_IMPORT_CLASSES_DIR')) {
+ define('WPIE_IMPORT_CLASSES_DIR', WPIE_CLASSES_DIR . '/import');
}
-if ( !defined( 'WPIE_EXPORT_CLASSES_DIR' ) ) {
- define( 'WPIE_EXPORT_CLASSES_DIR', WPIE_CLASSES_DIR . '/export' );
+if (!defined('WPIE_EXPORT_CLASSES_DIR')) {
+ define('WPIE_EXPORT_CLASSES_DIR', WPIE_CLASSES_DIR . '/export');
}
-if ( !defined( 'WPIE_VIEW_DIR' ) ) {
- define( 'WPIE_VIEW_DIR', WPIE_INCLUDES_DIR . '/views' );
+if (!defined('WPIE_VIEW_DIR')) {
+ define('WPIE_VIEW_DIR', WPIE_INCLUDES_DIR . '/views');
}
-if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-schedule.php' ) ) {
+if (file_exists(WPIE_CLASSES_DIR . '/class-wpie-schedule.php')) {
require_once(WPIE_CLASSES_DIR . '/class-wpie-schedule.php');
new wpieWPIE_Schedule();
}
-if ( file_exists( WPIE_PLUGIN_DIR . '/support/support.php' ) ) {
+if (file_exists(WPIE_PLUGIN_DIR . '/support/support.php')) {
require_once(WPIE_PLUGIN_DIR . '/support/support.php');
}
-if ( file_exists( WPIE_CLASSES_DIR . '/function.php' ) ) {
+if (file_exists(WPIE_CLASSES_DIR . '/function.php')) {
require_once(WPIE_CLASSES_DIR . '/function.php');
}
-add_action( 'init', 'wpie_init_addons' );
+add_action('init', 'wpie_init_addons');
-if ( !function_exists( 'wpie_init_addons' ) ) {
+if (!function_exists('wpie_init_addons')) {
- function wpie_init_addons() {
- if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-extensions.php' ) ) {
+ function wpie_init_addons()
+ {
+ if (file_exists(WPIE_CLASSES_DIR . '/class-wpie-extensions.php')) {
require_once(WPIE_CLASSES_DIR . '/class-wpie-extensions.php');
$wpie_ext = new wpieaddonsWPIE_Extension();
$wpie_ext->wpie_init_extensions();
- unset( $wpie_ext );
+ unset($wpie_ext);
}
}
}
-if ( file_exists( WPIE_CLASSES_DIR . '/class-updates.php' ) ) {
+if (file_exists(WPIE_CLASSES_DIR . '/class-updates.php')) {
require_once(WPIE_CLASSES_DIR . '/class-updates.php');
new wpieUpdates();
}
-if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST[ 'action' ] ) && substr( wpie_sanitize_field( $_REQUEST[ 'action' ] ), 0, 4 ) == 'wpie' ) {
+if (is_admin() && defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && substr(wpie_sanitize_field($_REQUEST['action']), 0, 4) == 'wpie') {
- if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-action.php' ) ) {
+ if (file_exists(WPIE_CLASSES_DIR . '/class-wpie-action.php')) {
require_once(WPIE_CLASSES_DIR . '/class-wpie-action.php');
}
-} elseif ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-general.php' ) ) {
+} elseif (file_exists(WPIE_CLASSES_DIR . '/class-wpie-general.php')) {
require_once(WPIE_CLASSES_DIR . '/class-wpie-general.php');
new wpiecoreWPIE_General();