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/Campaigns/Actions.php +32 -5 10.11.1 → 11.1.0 View file →
@@ -12,8 +12,11 @@
12 12 trait Actions
13 13 {
14 14 public function duplicate(): void
15 15 {
16 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
17 +
18 + //We get the id of campaign checked
16 19 $campaignsSelected = acym_getVar('array', 'elements_checked', []);
17 20
18 21 $campaignClass = new CampaignClass();
19 22 $mailClass = new MailClass();
@@ -23,10 +26,12 @@
23 26 $campaignClass->onlyManageableCampaigns($campaignsSelected);
24 27 }
25 28
26 29 foreach ($campaignsSelected as $campaignSelected) {
30 + //we get the campaign
27 31 $campaign = $campaignClass->getOneById($campaignSelected);
28 32
33 + //remove id and set to draft and not sent
29 34 unset($campaign->id);
30 35 unset($campaign->sending_date);
31 36 $campaign->draft = 1;
32 37 $campaign->sent = 0;
@@ -34,8 +39,9 @@
34 39 if (!empty($campaign->sending_params['resendTarget'])) {
35 40 unset($campaign->sending_params['resendTarget']);
36 41 }
37 42
43 + //We get the mail to duplicate it
38 44 $mail = $mailClass->getOneById($campaign->mail_id);
39 45 $oldMailId = $mail->id;
40 46 unset($mail->id);
41 47 $mail->creation_date = acym_date('now', 'Y-m-d H:i:s', false);
@@ -66,11 +72,13 @@
66 72 $mailClass->save($oneTranslation);
67 73 }
68 74 }
69 75
76 + //we set the new mail id and save campaign
70 77 $campaign->mail_id = $idNewMail;
71 78 $campaignId = $campaignClass->save($campaign);
72 79
80 + //We get the lists
73 81 $allLists = $campaignClass->getListsByMailId($oldMailId);
74 82
75 83 $campaignClass->manageListsToCampaign($allLists, $idNewMail);
76 84 }
@@ -86,14 +94,18 @@
86 94 }
87 95
88 96 public function duplicateFollowup(): void
89 97 {
90 - $followupsSelected = acym_getVar('int', 'elements_checked');
98 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
91 99
100 + //We get the id of follow-ups checked
101 + $followupsSelected = acym_getVar('array', 'elements_checked', []);
102 +
92 103 $followupClass = new FollowupClass();
93 104 $mailClass = new MailClass();
94 105
95 106 foreach ($followupsSelected as $oneFollowupId) {
107 + // Duplicate the follow-up + list associated
96 108 $followUp = $followupClass->getOneByIdWithMails($oneFollowupId);
97 109 $followupEmails = $followUp->mails;
98 110
99 111 unset($followUp->id, $followUp->creation_date, $followUp->list_id, $followUp->mails);
@@ -108,8 +120,9 @@
108 120 return;
109 121 }
110 122 $followUp->id = $newFollowUpId;
111 123
124 + // Duplicate emails of the follow-up and attach them to the new followup
112 125 foreach ($followupEmails as $oneEmail) {
113 126 $mail = $mailClass->getOneById($oneEmail->id);
114 127 unset($mail->id, $mail->creation_date, $mail->creator_id, $mail->autosave);
115 128 $newMailId = $mailClass->save($mail);
@@ -137,9 +150,13 @@
137 150
138 151 return;
139 152 }
140 153
141 - acym_redirect(acym_completeLink('queue', false, true).'&task=playPauseSending&acym__queue__play_pause__active__new_value=1&acym__queue__play_pause__campaign_id='.$id);
154 + acym_redirect(
155 + acym_completeLink('queue', false, true)
156 + .'&task=playPauseSending&acym__queue__play_pause__active__new_value=1&acym__queue__play_pause__campaign_id='.$id
157 + .'&'.acym_getFormToken()
158 + );
142 159 }
143 160
144 161 public function stopSending(): void
145 162 {
@@ -152,9 +169,9 @@
152 169 }
153 170
154 171 private function stopAction(string $action): void
155 172 {
156 - acym_checkToken();
173 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
157 174
158 175 $campaignID = acym_getVar('int', $action);
159 176 $campaignClass = new CampaignClass();
160 177
@@ -182,8 +199,10 @@
182 199 }
183 200
184 201 public function confirmCampaign(): void
185 202 {
203 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
204 +
186 205 $this->updateOpenAcymailerPopup();
187 206 $campaignId = acym_getVar('int', 'campaignId');
188 207 $campaignSendingDate = acym_getVar('string', 'sending_date');
189 208 $resendTarget = acym_getVar('cmd', 'resend_target', '');
@@ -218,8 +237,10 @@
218 237 }
219 238
220 239 public function activeAutoCampaign(): void
221 240 {
241 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
242 +
222 243 $this->updateOpenAcymailerPopup();
223 244 $campaignId = acym_getVar('int', 'campaignId');
224 245 $campaignClass = new CampaignClass();
225 246
@@ -241,8 +262,10 @@
241 262 }
242 263
243 264 public function saveAsDraftCampaign(): void
244 265 {
266 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
267 +
245 268 $campaignId = acym_getVar('int', 'campaignId');
246 269 $campaignClass = new CampaignClass();
247 270
248 271 if (!$campaignClass->hasUserAccess($campaignId)) {
@@ -266,8 +289,9 @@
266 289 }
267 290
268 291 public function toggleActivateColumnCampaign(): void
269 292 {
293 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
270 294
271 295 $campaignId = acym_getVar('int', 'campaignId');
272 296 $campaignClass = new CampaignClass();
273 297
@@ -280,8 +304,9 @@
280 304 }
281 305
282 306 $campaign->active = empty($campaign->active) ? 1 : 0;
283 307
308 + // Remove the next trigger when disabling the automatic campaign. It will be calculated again properly if reactivated
284 309 if ($campaign->active === 0 && $campaign->sending_type === CampaignClass::SENDING_TYPE_AUTO) {
285 310 $campaign->next_trigger = null;
286 311 }
287 312
@@ -297,9 +322,9 @@
297 322 }
298 323
299 324 public function addQueue(): void
300 325 {
301 - acym_checkToken();
326 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
302 327 $this->updateOpenAcymailerPopup();
303 328
304 329 $campaignClass = new CampaignClass();
305 330 $campaignID = acym_getVar('int', 'campaignId', 0);
@@ -322,9 +347,9 @@
322 347
323 348 $status = $campaignClass->send($campaignID);
324 349
325 350 if ($status) {
326 - acym_enqueueMessage(acym_translationSprintf('ACYM_CAMPAIGN_ADDED_TO_QUEUE', $campaign->name), 'info');
351 + acym_enqueueMessage(acym_translationSprintf('ACYM_CAMPAIGN_ADDED_TO_QUEUE', $campaign->name, 'info'));
327 352 } else {
328 353 if (empty($campaignClass->errors)) {
329 354 $notification = [
330 355 'name' => 'queue_campaign_error',
@@ -357,8 +382,10 @@
357 382 }
358 383
359 384 public function updateArchive(): void
360 385 {
386 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
387 +
361 388 $campaignId = acym_getVar('int', 'campaignId', 0);
362 389 if (empty($campaignId)) {
363 390 acym_sendAjaxResponse('', [], false);
364 391 }