Plugin Directory

Changeset 2185703


Ignore:
Timestamp:
11/04/2019 05:06:03 PM (6 years ago)
Author:
burlingtonbytes
Message:

Fix potential security concern

Location:
wp-smartcrop/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-smartcrop/trunk/js/jquery.wp-smartcrop.js

    r2180267 r2185703  
    11/**
    2  * jQuery SmartCrop v2.0.4
     2 * jQuery SmartCrop v2.0.5
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
  • wp-smartcrop/trunk/js/jquery.wp-smartcrop.min.js

    r2180267 r2185703  
    11/**
    2  * jQuery WP-SmartCrop v2.0.4
     2 * jQuery WP-SmartCrop v2.0.5
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
  • wp-smartcrop/trunk/readme.txt

    r2180267 r2185703  
    112112
    113113= 2.0.4 =
     114* Fix potential security concern
     115
     116= 2.0.4 =
    114117* Update admin email
    115118
  • wp-smartcrop/trunk/wp-smartcrop.php

    r2180267 r2185703  
    44 * Plugin URI: https://www.wpsmartcrop.com/
    55 * Description: Style your images exactly how you want them to appear, for any screen size, and never get a cut-off face.
    6  * Version: 2.0.4
     6 * Version: 2.0.5
    77 * Author: Bytes.co
    88 * Author URI: https://bytes.co
     
    1313if( !class_exists('WP_Smart_Crop') ) {
    1414    class WP_Smart_Crop {
    15         public  $version = '2.0.4';
     15        public  $version = '2.0.5';
    1616        private $plugin_dir_path;
    1717        private $plugin_dir_url;
     
    340340
    341341        function edit_attachment( $attachment_id ) {
    342             if( isset( $_REQUEST['attachments'] ) && isset( $_REQUEST['attachments'][$attachment_id] ) ) {
    343                 $attachment = $_REQUEST['attachments'][$attachment_id];
    344 
    345                 $old_enabled = get_post_meta( $attachment_id, '_wpsmartcrop_enabled', true );
    346                 $old_focus   = get_post_meta( $attachment_id, '_wpsmartcrop_image_focus', true );
    347 
    348                 if( isset( $attachment['_wpsmartcrop_enabled'] ) && $attachment['_wpsmartcrop_enabled'] == 1 ) {
    349                     $new_enabled = 1;
    350                 } else {
    351                     $new_enabled = false;
    352                 }
    353                 if( isset( $attachment['_wpsmartcrop_image_focus'] ) ) {
    354                     $new_focus = $attachment['_wpsmartcrop_image_focus'];
    355                 } else {
    356                     $new_focus = false;
    357                 }
    358                 if( ( $new_enabled != $old_enabled ) || ( serialize( $new_focus ) != serialize( $old_focus ) ) ) {
    359                     update_post_meta( $attachment_id, '_wpsmartcrop_enabled', $new_enabled );
    360                     update_post_meta( $attachment_id, '_wpsmartcrop_image_focus', $new_focus );
    361                     if( !( isset( $this->options['disable-thumbnails'] ) && $this->options['disable-thumbnails'] ) ) {
    362                         $this->regenerate_thumbnails( $attachment_id );
    363                     }
     342            if( ! isset( $_REQUEST['attachments'] ) || ! isset( $_REQUEST['attachments'][$attachment_id] ) ) {
     343                return;
     344            }
     345            $attachment = $_REQUEST['attachments'][$attachment_id];
     346
     347            $smartcrop_enabled = boolval( isset( $attachment['_wpsmartcrop_enabled'] ) && $attachment['_wpsmartcrop_enabled'] == 1 );
     348            $smartcrop_image_focus = array(
     349                'top'  => null,
     350                'left' => null
     351            );
     352
     353            if ( isset( $attachment['_wpsmartcrop_image_focus'] ) ) {
     354                if ( isset( $attachment['_wpsmartcrop_image_focus']['top'] ) ) {
     355                    $smartcrop_image_focus['top']   = number_format( $attachment['_wpsmartcrop_image_focus']['top'], 2 );
     356                }
     357                if ( isset( $attachment['_wpsmartcrop_image_focus']['left' ] )) {
     358                    $smartcrop_image_focus['left']  = number_format ($attachment['_wpsmartcrop_image_focus']['left'], 2 );
     359                }
     360            }
     361            if ( $smartcrop_image_focus['top'] === null && $smartcrop_image_focus['left'] === null ) {
     362                $smartcrop_image_focus = false;
     363            }
     364
     365            unset($attachment);
     366
     367            $old_enabled = get_post_meta( $attachment_id, '_wpsmartcrop_enabled', true );
     368            $old_focus   = get_post_meta( $attachment_id, '_wpsmartcrop_image_focus', true );
     369
     370            $new_enabled = $smartcrop_enabled;
     371            $new_focus   = $smartcrop_image_focus;
     372
     373            if( ( $new_enabled != $old_enabled ) || ( serialize( $new_focus ) != serialize( $old_focus ) ) ) {
     374                update_post_meta( $attachment_id, '_wpsmartcrop_enabled', $new_enabled );
     375                update_post_meta( $attachment_id, '_wpsmartcrop_image_focus', $new_focus );
     376                if( !( isset( $this->options['disable-thumbnails'] ) && $this->options['disable-thumbnails'] ) ) {
     377                    $this->regenerate_thumbnails( $attachment_id );
    364378                }
    365379            }
Note: See TracChangeset for help on using the changeset viewer.