@@ -299,7 +299,8 @@ function ppom_admin_show_notices() {
299299 */
300300function ppom_admin_save_form_meta () {
301301
302- $ db_version = floatval ( get_option ( 'personalizedproduct_db_version ' ) );
302+ $ db_version = floatval ( get_option ( 'personalizedproduct_db_version ' ) );
303+ $ ppom_form_nonce = isset ( $ _POST ['ppom_form_nonce ' ] ) ? sanitize_text_field ( wp_unslash ( $ _POST ['ppom_form_nonce ' ] ) ) : '' ;
303304
304305 if ( $ db_version < 22.1 ) {
305306 $ resp = array (
@@ -312,8 +313,8 @@ function ppom_admin_save_form_meta() {
312313
313314 // print_r($_REQUEST); exit;
314315
315- if ( ! isset ( $ _POST [ ' ppom_form_nonce ' ] )
316- || ! wp_verify_nonce ( $ _POST [ ' ppom_form_nonce ' ] , 'ppom_form_nonce_action ' )
316+ if ( empty ( $ ppom_form_nonce )
317+ || ! wp_verify_nonce ( $ ppom_form_nonce , 'ppom_form_nonce_action ' )
317318 || ! ppom_security_role ()
318319 ) {
319320 $ resp = array (
@@ -482,8 +483,9 @@ function ( $pm ) {
482483function ppom_admin_update_form_meta () {
483484
484485
485- $ return_page = isset ( $ _REQUEST ['ppom_meta ' ] ) ? 'ppom-energy ' : 'ppom ' ;
486- $ productmeta_id = isset ( $ _REQUEST ['productmeta_id ' ] ) ? sanitize_text_field ( $ _REQUEST ['productmeta_id ' ] ) : '' ;
486+ $ return_page = isset ( $ _REQUEST ['ppom_meta ' ] ) ? 'ppom-energy ' : 'ppom ' ;
487+ $ productmeta_id = isset ( $ _REQUEST ['productmeta_id ' ] ) ? sanitize_text_field ( $ _REQUEST ['productmeta_id ' ] ) : '' ;
488+ $ ppom_form_nonce = isset ( $ _POST ['ppom_form_nonce ' ] ) ? sanitize_text_field ( wp_unslash ( $ _POST ['ppom_form_nonce ' ] ) ) : '' ;
487489
488490 $ ppom_args = array (
489491 'page ' => $ return_page ,
@@ -506,8 +508,8 @@ function ppom_admin_update_form_meta() {
506508 }
507509
508510
509- if ( ! isset ( $ _POST [ ' ppom_form_nonce ' ] )
510- || ! wp_verify_nonce ( $ _POST [ ' ppom_form_nonce ' ] , 'ppom_form_nonce_action ' )
511+ if ( empty ( $ ppom_form_nonce )
512+ || ! wp_verify_nonce ( $ ppom_form_nonce , 'ppom_form_nonce_action ' )
511513 || ! ppom_security_role ()
512514 ) {
513515 $ resp = array (
@@ -683,8 +685,10 @@ function ppom_admin_update_ppom_meta_only( $ppom_id, $ppom_meta ) {
683685 */
684686function ppom_admin_delete_meta () {
685687
686- if ( ! isset ( $ _POST ['ppom_meta_nonce ' ] )
687- || ! wp_verify_nonce ( $ _POST ['ppom_meta_nonce ' ], 'ppom_meta_nonce_action ' )
688+ $ ppom_meta_nonce = isset ( $ _POST ['ppom_meta_nonce ' ] ) ? sanitize_text_field ( wp_unslash ( $ _POST ['ppom_meta_nonce ' ] ) ) : '' ;
689+
690+ if ( empty ( $ ppom_meta_nonce )
691+ || ! wp_verify_nonce ( $ ppom_meta_nonce , 'ppom_meta_nonce_action ' )
688692 || ! ppom_security_role ()
689693 ) {
690694 $ response = array (
@@ -730,8 +734,10 @@ function ppom_admin_delete_meta() {
730734 */
731735function ppom_admin_delete_selected_meta () {
732736
733- if ( ! isset ( $ _POST ['ppom_meta_nonce ' ] )
734- || ! wp_verify_nonce ( $ _POST ['ppom_meta_nonce ' ], 'ppom_meta_nonce_action ' )
737+ $ ppom_meta_nonce = isset ( $ _POST ['ppom_meta_nonce ' ] ) ? sanitize_text_field ( wp_unslash ( $ _POST ['ppom_meta_nonce ' ] ) ) : '' ;
738+
739+ if ( empty ( $ ppom_meta_nonce )
740+ || ! wp_verify_nonce ( $ ppom_meta_nonce , 'ppom_meta_nonce_action ' )
735741 || ! ppom_security_role ()
736742 || ! array_key_exists ( 'productmeta_ids ' , $ _POST )
737743 || ! is_array ( $ _POST ['productmeta_ids ' ] )
0 commit comments