PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Controllers/Segments/Edition.php +23 -2 10.11.1 → 11.1.0 View file →
@@ -2,9 +2,8 @@
2 2
3 3 namespace AcyMailing\Controllers\Segments;
4 4
5 5 use AcyMailing\Classes\SegmentClass;
6 -use AcyMailing\Controllers\AutomationController;
7 6 use AcyMailing\Helpers\AutomationHelper;
8 7
9 8 trait Edition
10 9 {
@@ -37,12 +36,20 @@
37 36 }
38 37
39 38 private function store(): int
40 39 {
40 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
41 +
41 42 $segmentId = acym_getVar('int', 'segmentId');
42 43 $filters = acym_getVar('array', 'acym_action');
43 44 $segmentRequest = acym_getVar('array', 'segment');
44 45
46 + if (acym_conditionsContainRestrictedFilter($filters) && !acym_hasAdminPermissions()) {
47 + acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
48 +
49 + return 0;
50 + }
51 +
45 52 $segmentClass = new SegmentClass();
46 53
47 54 if (empty($segmentId)) {
48 55 $segment = new \stdClass();
@@ -64,11 +71,14 @@
64 71 }
65 72
66 73 public function countResultsTotal(): void
67 74 {
75 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
76 +
68 77 $segmentSelected = acym_getVar('int', 'segment_selected');
69 78 if (empty($segmentSelected)) {
70 79 $stepAutomation = acym_getVar('array', 'acym_action', []);
80 + acym_blockRestrictedFilterAjax($stepAutomation);
71 81 } else {
72 82 $segmentClass = new SegmentClass();
73 83 $segment = $segmentClass->getOneById($segmentSelected);
74 84 if (empty($segment)) {
@@ -77,8 +87,9 @@
77 87 $stepAutomation = ['filters' => $segment->filters];
78 88 }
79 89 }
80 90
91 + //if we are in the campaign edition
81 92 $listsIds = acym_getVar('string', 'list_selected', '[]');
82 93 $listsIds = empty($listsIds) ? [] : json_decode($listsIds, true);
83 94
84 95 $isExclude = acym_getVar('boolean', 'exclude', false);
@@ -138,12 +149,16 @@
138 149 }
139 150
140 151 public function countResults(): void
141 152 {
153 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
154 +
142 155 $and = acym_getVar('int', 'and');
143 156 $or = acym_getVar('int', 'or');
144 157 $stepAutomation = acym_getVar('array', 'acym_action');
158 + acym_blockRestrictedFilterAjax($stepAutomation);
145 159
160 + //if we are in the campaign edition
146 161 $listsIds = acym_getVar('string', 'list_selected', '');
147 162
148 163 if (empty($stepAutomation['filters'][$or][$and])) {
149 164 acym_sendAjaxResponse(acym_translation('ACYM_AUTOMATION_NOT_FOUND'), [], false);
@@ -165,9 +180,13 @@
165 180 $options = current($stepAutomation['filters'][$or][$and]);
166 181 $messages = acym_trigger('onAcymProcessFilterCount_'.$filterName, [&$automationHelper, &$options, &$and]);
167 182 $messages = $messages[0];
168 183
169 - if (!empty($listsIds)) $messages .= acym_info(['textShownInTooltip' => 'ACYM_CONDITION_WITH_LISTS_COUNT', 'classText' => 'wysid_tooltip']);
184 + if (!empty($listsIds)) {
185 + ob_start();
186 + acym_info(['textShownInTooltip' => 'ACYM_CONDITION_WITH_LISTS_COUNT', 'classText' => 'wysid_tooltip']);
187 + $messages .= ob_get_clean();
188 + }
170 189
171 190 acym_sendAjaxResponse($messages);
172 191 }
173 192
@@ -179,8 +198,9 @@
179 198
180 199 $and = acym_getVar('int', 'and');
181 200 $or = acym_getVar('int', 'or');
182 201 $stepAutomation = acym_getVar('array', 'acym_action');
202 + acym_blockRestrictedFilterAjax($stepAutomation);
183 203
184 204 if (empty($stepAutomation['filters'][$or][$and])) {
185 205 acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_RETRIEVE_DATA'), [], false);
186 206 }
@@ -186,8 +206,9 @@
186 206 }
187 207
188 208 $automationHelper = new AutomationHelper();
189 209
210 + //if we are in the campaign edition
190 211 $listsIds = acym_getVar('string', 'list_selected', '');
191 212
192 213 if (!empty($listsIds)) {
193 214 $listsIds = json_decode($listsIds);