@@ -102,7 +102,7 @@ protected function setup_data( $payment ) {
102102 * Confirm Payment Functionality.
103103 */
104104 public function confirm_payment () {
105- if ( trim ( $ _POST ['code ' ] ) === '' ) {
105+ if ( ! isset ( $ _POST ['code ' ] ) || '' === trim ( wp_unslash ( $ _POST [ ' code ' ] ) ) ) {
106106 $ response = array (
107107 'error ' => true ,
108108 'error_message ' => __ ( 'Did you make a payment? ' , 'pff-paystack ' ),
@@ -117,7 +117,7 @@ public function confirm_payment() {
117117 }
118118
119119 $ this ->helpers = new Helpers ();
120- $ code = sanitize_text_field ( $ _POST ['code ' ] );
120+ $ code = sanitize_text_field ( wp_unslash ( $ _POST ['code ' ] ) );
121121 $ record = $ this ->helpers ->get_db_record ( $ code , $ this ->txn_column );
122122
123123 if ( false !== $ record ) {
@@ -198,10 +198,13 @@ public function confirm_payment() {
198198 */
199199 protected function update_sold_inventory () {
200200 $ usequantity = $ this ->meta ['usequantity ' ];
201- $ sold = $ this ->meta ['sold ' ];
201+ $ sold = ( int ) $ this ->meta ['sold ' ];
202202
203203 if ( 'yes ' === $ usequantity ) {
204- $ quantity = $ _POST ['quantity ' ];
204+ $ quantity = 1 ;
205+ if ( isset ( $ _POST ['quantity ' ] ) ) {
206+ $ quantity = (int ) sanitize_text_field ( wp_unslash ( $ _POST ['quantity ' ] ) );
207+ }
205208 $ sold = $ this ->meta ['sold ' ];
206209
207210 if ( '' === $ sold ) {
@@ -298,7 +301,7 @@ protected function update_payment_dates( $data ) {
298301 protected function maybe_create_subscription () {
299302 // Create a "subscription" and attach it to the current plan code.
300303 if ( 1 == $ this ->meta ['startdate_enabled ' ] && ! empty ( $ this ->meta ['startdate_days ' ] ) && ! empty ( $ this ->meta ['startdate_plan_code ' ] ) ) {
301- $ start_date = date ( 'c ' , strtotime ( '+ ' . $ this ->meta ['startdate_days ' ] . ' days ' ) );
304+ $ start_date = gmdate ( 'c ' , strtotime ( '+ ' . $ this ->meta ['startdate_days ' ] . ' days ' ) );
302305 $ body = array (
303306 'start_date ' => $ start_date ,
304307 'plan ' => $ this ->meta ['startdate_plan_code ' ],
0 commit comments