| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | use AcyMailing\Helpers\ToolbarHelper; |
| 7 | 7 | |
| 8 | 8 | trait Listing |
| 9 | 9 | { |
| 10 | - public function listing() | |
| 10 | + public function listing(): void | |
| 11 | 11 | { |
| 12 | 12 | $data = []; |
| 13 | 13 | |
| 14 | 14 | if (!acym_level(ACYM_ENTERPRISE)) { |
| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | |
| 18 | 18 | parent::display($data); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - protected function prepareToolbar(&$data) | |
| 21 | + protected function prepareToolbar(array &$data): void | |
| 22 | 22 | { |
| 23 | 23 | $toolbarHelper = new ToolbarHelper(); |
| 24 | 24 | $toolbarHelper->addButton(acym_translation('ACYM_CREATE'), ['data-task' => 'edit'], 'add', true); |
| 25 | 25 | |
| @@ -25,11 +25,17 @@ | ||
| 25 | 25 | |
| 26 | 26 | $data['toolbar'] = $toolbarHelper; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function ajaxSetOrdering() | |
| 29 | + public function ajaxSetOrdering(): void | |
| 30 | 30 | { |
| 31 | - $order = json_decode(acym_getVar('string', 'order')); | |
| 31 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 32 | + | |
| 33 | + $order = json_decode(acym_getVar('string', 'order'), true); | |
| 34 | + if (empty($order)) { | |
| 35 | + $order = []; | |
| 36 | + } | |
| 37 | + | |
| 32 | 38 | $i = 1; |
| 33 | 39 | $error = false; |
| 34 | 40 | foreach ($order as $field) { |
| 35 | 41 | $query = 'UPDATE #__acym_field SET `ordering` = '.intval($i).' WHERE `id` = '.intval($field); |
| @@ -39,12 +45,12 @@ | ||
| 39 | 45 | |
| 40 | 46 | acym_sendAjaxResponse('', [], !$error); |
| 41 | 47 | } |
| 42 | 48 | |
| 43 | - public function delete() | |
| 49 | + public function delete(): void | |
| 44 | 50 | { |
| 45 | 51 | $fieldClass = new FieldClass(); |
| 46 | - $ids = acym_getVar('cmd', 'elements_checked'); | |
| 52 | + $ids = acym_getVar('array', 'elements_checked', []); | |
| 47 | 53 | if (in_array('1', $ids) || in_array('2', $ids) || in_array($fieldClass->getLanguageFieldId(), $ids)) { |
| 48 | 54 | acym_enqueueMessage(acym_translation('ACYM_CANT_DELETE'), 'error'); |
| 49 | 55 | $this->listing(); |
| 50 | 56 | } else { |