diff --git a/ajax_handlers/save_survey.php b/ajax_handlers/save_survey.php index a5fe845..56cb00e 100644 --- a/ajax_handlers/save_survey.php +++ b/ajax_handlers/save_survey.php @@ -3,26 +3,26 @@ include_once("ajax_handler.php"); class SurveyJS_SaveSurvey extends SurveyJS_AJAX_Handler { - + function __construct() { - parent::__construct("SurveyJS_SaveSurvey", false); + parent::__construct("SurveyJS_SaveSurvey", false); } - + function callback() { if($_SERVER['REQUEST_METHOD'] === 'POST') { $id = sanitize_key($_POST['Id']); - $json = sanitize_text_field($_POST['Json']); + $json = current_user_can( 'unfiltered_html' ) ? $_POST['Json'] : wp_kses_post( $_POST['Json'] ); if(!!$json) { global $wpdb; $table_name = $wpdb->prefix . 'sjs_my_surveys'; - $result = $wpdb->update( - $table_name, - array( + $result = $wpdb->update( + $table_name, + array( 'json' => $json ), - array( + array( 'id' => intval($id) ) ); @@ -32,4 +32,4 @@ function callback() { } } -?> \ No newline at end of file +?>