| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | use Jet_Form_Builder\Actions\Events\Default_Process\Default_Process_Event; |
| 7 | 7 | use Jet_Form_Builder\Actions\Events\Default_Required\Default_Required_Event; |
| 8 | 8 | use Jet_Form_Builder\Admin\Tabs_Handlers\Tab_Handler_Manager; |
| 9 | 9 | use Jet_Form_Builder\Admin\Tabs_Handlers\Options_Handler; |
| 10 | +use Jet_Form_Builder\Blocks\Block_Helper; | |
| 10 | 11 | use Jet_Form_Builder\Classes\Tools; |
| 11 | 12 | use Jet_Form_Builder\Exceptions\Action_Exception; |
| 12 | 13 | use Jet_Form_Builder\Exceptions\Handler_Exception; |
| 13 | 14 | use Jet_Form_Builder\Exceptions\Not_Router_Request; |
| @@ -147,10 +148,12 @@ | ||
| 147 | 148 | return $this->refer; |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | public function set_form_id( $form_id ) { |
| 151 | - $this->form_id = absint( $form_id ); | |
| 152 | + $form_id = absint( $form_id ); | |
| 152 | 153 | |
| 154 | + $this->form_id = Block_Helper::is_valid_form_post( $form_id, true ) ? $form_id : 0; | |
| 155 | + | |
| 153 | 156 | return $this; |
| 154 | 157 | } |
| 155 | 158 | |
| 156 | 159 | public function get_form_id() { |
| @@ -251,8 +254,10 @@ | ||
| 251 | 254 | 'status' => 'failed', |
| 252 | 255 | ) |
| 253 | 256 | ); |
| 254 | 257 | $this->send_raw_response(); |
| 258 | + | |
| 259 | + return; | |
| 255 | 260 | } |
| 256 | 261 | |
| 257 | 262 | $this->try_send(); |
| 258 | 263 | |
| @@ -301,11 +306,15 @@ | ||
| 301 | 306 | } |
| 302 | 307 | } |
| 303 | 308 | |
| 304 | 309 | /** |
| 305 | - * @throws Request_Exception|Action_Exception|Spam_Exception | |
| 310 | + * @throws Request_Exception | |
| 306 | 311 | */ |
| 307 | 312 | public function send_form() { |
| 313 | + if ( ! $this->form_id ) { | |
| 314 | + throw new Request_Exception( 'failed' ); | |
| 315 | + } | |
| 316 | + | |
| 308 | 317 | $this->action_handler->set_form_id( $this->form_id ); |
| 309 | 318 | $this->request_handler->set_form_data(); |
| 310 | 319 | |
| 311 | 320 | do_action( 'jet-form-builder/form-handler/before-send', $this ); |