Skip to content

Commit b737322

Browse files
release: fixes
- Fixed image upload in image dropdown field - Enhanced security
2 parents 93efbae + ec02e10 commit b737322

File tree

5 files changed

+22
-35
lines changed

5 files changed

+22
-35
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/admin.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,19 +291,20 @@ function ppom_admin_save_form_meta() {
291291

292292
global $wpdb;
293293

294-
extract( $_REQUEST );
295-
296294
$send_file_attachment = 'NA';
297295
$aviary_api_key = 'NA';
298296
$show_cart_thumb = 'NA';
299297

298+
$ppom = array();
299+
$productmeta_id = isset( $_REQUEST['productmeta_id'] ) ? sanitize_text_field( $_REQUEST['productmeta_id'] ) : '';
300+
300301
if ( is_string( $_REQUEST['ppom'] ) ) {
301302
$ppom_encoded = $_REQUEST['ppom'];
302303
parse_str( $ppom_encoded, $ppom_decoded);
303-
$_REQUEST['ppom'] = $ppom_decoded['ppom'];
304+
$ppom = $ppom_decoded['ppom'];
304305
}
305306

306-
$ppom_meta = ( isset($_REQUEST['ppom_meta']) ? $_REQUEST['ppom_meta'] : isset($_REQUEST['ppom']) ) ? $_REQUEST['ppom'] : '';
307+
$ppom_meta = isset($_REQUEST['ppom_meta']) ? $_REQUEST['ppom_meta'] : $ppom;
307308

308309
if ( empty( $ppom_meta ) ) {
309310
$resp = array(
@@ -331,6 +332,7 @@ function( $pm ) {
331332
$aviary_api_key = isset( $_REQUEST['aviary_api_key'] ) ? sanitize_text_field( $_REQUEST['aviary_api_key'] ) : '';
332333
$productmeta_style = isset( $_REQUEST['productmeta_style'] ) ? sanitize_text_field( $_REQUEST['productmeta_style'] ) : '';
333334
$productmeta_js = isset( $_REQUEST['productmeta_js'] ) ? sanitize_text_field( $_REQUEST['productmeta_js'] ) : '';
335+
$product_id = isset( $_REQUEST['product_id'] ) ? intval( $_REQUEST['product_id'] ) : 0;
334336

335337
if ( strlen( $productmeta_name ) > 50 ) {
336338
$resp = array(
@@ -406,8 +408,8 @@ function( $pm ) {
406408
}
407409

408410

409-
if ( isset( $_REQUEST['product_id'] ) && $_REQUEST['product_id'] != '' ) {
410-
ppom_attach_fields_to_product( $ppom_id, intval( $_REQUEST['product_id'] ) );
411+
if ( ! empty( $product_id ) ) {
412+
ppom_attach_fields_to_product( $ppom_id, $product_id );
411413
$redirect_to = get_permalink( $product_id );
412414
}
413415

@@ -438,8 +440,8 @@ function( $pm ) {
438440
function ppom_admin_update_form_meta() {
439441

440442

441-
$return_page = isset( $_REQUEST['ppom_meta'] ) ? 'ppom-energy' : 'ppom';
442-
extract( $_REQUEST );
443+
$return_page = isset( $_REQUEST['ppom_meta'] ) ? 'ppom-energy' : 'ppom';
444+
$productmeta_id = isset( $_REQUEST['productmeta_id'] ) ? sanitize_text_field( $_REQUEST['productmeta_id'] ) : '';
443445

444446
$ppom_args = array(
445447
'page' => $return_page,
@@ -640,7 +642,7 @@ function ppom_admin_delete_meta() {
640642

641643
global $wpdb;
642644

643-
extract( $_REQUEST );
645+
$productmeta_id = isset( $_REQUEST['productmeta_id'] ) ? sanitize_text_field( $_REQUEST['productmeta_id'] ) : '';
644646

645647
$tbl_name = $wpdb->prefix . PPOM_TABLE_META;
646648
$ppom_id = intval( $productmeta_id );

js/admin/ppom-admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ jQuery(function($) {
759759
var price_metatype = 'price';
760760
var stock_metatype = 'stock';
761761
var stock_placeholder = ppom_vars.i18n.stock;
762+
let url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url" value="">';
762763

763764
// Set name key for imageselect addon
764765
if (meta_type == 'imageselect') {
@@ -779,14 +780,13 @@ jQuery(function($) {
779780
var condidtion_attr = 'image_options';
780781
price_placeholder = ppom_vars.i18n.metaIds;
781782
price_metatype = 'meta_id';
783+
url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url" value="">';
782784
}
783785
else {
784786
var class_name = '';
785787
var condidtion_attr = '';
786788
}
787789

788-
let url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url" value="">';
789-
790790
if (meta.type !== 'image') {
791791
img_icon = '<img width="60" src="' + meta.icon + '" style="width: 34px;">';
792792
url_field = '';

phpstan-baseline.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,21 +2915,6 @@ parameters:
29152915
count: 1
29162916
path: inc/admin.php
29172917

2918-
-
2919-
message: "#^Variable \\$ppom might not be defined\\.$#"
2920-
count: 1
2921-
path: inc/admin.php
2922-
2923-
-
2924-
message: "#^Variable \\$product_id might not be defined\\.$#"
2925-
count: 1
2926-
path: inc/admin.php
2927-
2928-
-
2929-
message: "#^Variable \\$productmeta_id might not be defined\\.$#"
2930-
count: 11
2931-
path: inc/admin.php
2932-
29332918
-
29342919
message: "#^Constant PPOM_PATH not found\\.$#"
29352920
count: 1

readme.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Are you a WooCommerce store owner looking to offer personalized products? PPOM (
1818

1919
- Would you like to see PPOM in action before installing it? [VIEW PPOM FIELDS DEMO](https://demo-ppom-lite.vertisite.cloud/)
2020
- Need any help with setup? [CHECK DOCUMENTATION](https://docs.themeisle.com/collection/1695-product-option-manager)
21-
- Interested in PPOM PRO? [LEARN MORE ABOUT PPOM PRO](https://themeisle.com/plugins/ppom-pro/upgrade?utm_source=wpadmin&utm_medium=readme&utm_campaign=quick-links)
21+
- Interested in PPOM PRO? [LEARN MORE ABOUT PPOM PRO](https://themeisle.com/plugins/ppom-pro/upgrade?utm_source=wordpressorg&utm_medium=readme&utm_campaign=quick-links)
2222

2323
## Why Choose PPOM?
2424

@@ -193,7 +193,7 @@ Boost your sales and customer satisfaction by offering tailored product options
193193

194194
✅ **Enquiry Form**: The "Enquiry Form" add-on simplifies collecting custom customer inquiries directly from your website, helping you address their needs efficiently. Customize where messages go and how you respond to enhance user satisfaction and potentially increase sales.
195195

196-
Interested in PPOM PRO? [Learn more](https://themeisle.com/plugins/ppom-pro/upgrade?utm_source=wpadmin&utm_medium=readme&utm_campaign=interested-pro)
196+
Interested in PPOM PRO? [Learn more](https://themeisle.com/plugins/ppom-pro/upgrade?utm_source=wordpressorg&utm_medium=readme&utm_campaign=interested-pro)
197197

198198
## Tailored Flexibility for Every Business Need:
199199

@@ -232,7 +232,7 @@ PPOM is an open-source project, and we welcome contributors to be part of our vi
232232
###Useful Resources 📌
233233

234234
- Read more about WordPress on our [blog](https://themeisle.com/blog/).
235-
- Interested in our other plugins? Take a look [here](https://themeisle.com/wordpress-plugins/?utm_source=wpadmin&utm_medium=readme&utm_campaign=PPOM).
235+
- Interested in our other plugins? Take a look [here](https://themeisle.com/wordpress-plugins/?utm_source=wordpressorg&utm_medium=readme&utm_campaign=PPOM).
236236

237237
== Installation ==
238238
1. Upload the plugin directory to the `/wp-content/plugins/` directory

0 commit comments

Comments
 (0)