| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | use AcyMailing\Helpers\WorkflowHelper; |
| 10 | 10 | |
| 11 | 11 | trait Summary |
| 12 | 12 | { |
| 13 | - public function summary() | |
| 13 | + public function summary(): void | |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | 16 | if (!acym_level(ACYM_ENTERPRISE)) { |
| 17 | 17 | acym_redirect(acym_completeLink('dashboard&task=upgrade&version=enterprise', false, true)); |
| @@ -17,19 +17,20 @@ | ||
| 17 | 17 | acym_redirect(acym_completeLink('dashboard&task=upgrade&version=enterprise', false, true)); |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function activeAutomation() | |
| 21 | + public function activeAutomation(): void | |
| 22 | 22 | { |
| 23 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 24 | + | |
| 23 | 25 | $automationClass = new AutomationClass(); |
| 24 | 26 | $automation = $automationClass->getOneById(acym_getVar('int', 'id')); |
| 25 | 27 | $automation->active = 1; |
| 26 | - $saved = $automationClass->save($automation); | |
| 27 | - if (!empty($saved)) { | |
| 28 | - acym_enqueueMessage(acym_translation('ACYM_SUCCESSFULLY_SAVED'), 'success'); | |
| 29 | - $this->listing(); | |
| 28 | + $automationId = $automationClass->save($automation); | |
| 29 | + if (!empty($automationId)) { | |
| 30 | + acym_enqueueMessage(acym_translation('ACYM_SUCCESSFULLY_SAVED')); | |
| 30 | 31 | } else { |
| 31 | 32 | acym_enqueueMessage(acym_translation('ACYM_ERROR_SAVING'), 'error'); |
| 32 | - $this->listing(); | |
| 33 | 33 | } |
| 34 | + $this->listing(); | |
| 34 | 35 | } |
| 35 | 36 | } |