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/Followup.php +28 -11 10.1.4 → 11.1.0 View file →
@@ -38,10 +38,10 @@
38 38
39 39 foreach ($data['allCampaigns'] as $key => $oneFollowup) {
40 40 if (!empty($triggers[$oneFollowup->trigger])) {
41 41 $oneFollowup->condition = json_decode($oneFollowup->condition, true);
42 - $data['allCampaigns'][$key]->condition = $followupClass->getConditionSummary($oneFollowup->condition, $oneFollowup->trigger);
43 - $data['allCampaigns'][$key]->mail_ids = $followupClass->getEmailsByIds($oneFollowup->id);
42 + $data['allCampaigns'][$key]->condition = $followupClass->getConditionSummary($oneFollowup);
43 + $data['allCampaigns'][$key]->mail_ids = $followupClass->getEmailsByIds([$oneFollowup->id]);
44 44 }
45 45 }
46 46 }
47 47
@@ -46,9 +46,9 @@
46 46 }
47 47
48 48 public function deleteFollowup(): void
49 49 {
50 - acym_checkToken();
50 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
51 51 $ids = acym_getVar('array', 'elements_checked', []);
52 52 $allChecked = acym_getVar('string', 'checkbox_all');
53 53 $currentPage = explode('_', acym_getVar('string', 'page'));
54 54 $pageNumber = $this->getVarFiltersListing('int', end($currentPage).'_pagination_page', 1);
@@ -191,9 +191,10 @@
191 191
192 192 return;
193 193 }
194 194
195 - $favoriteTemplate = $this->config->get('favorite_template', 0);
195 + $mailClass = new MailClass();
196 + $favoriteTemplate = $mailClass->getFavoriteTemplateId();
196 197 $startFrom = empty($favoriteTemplate) ? '' : '&from='.$favoriteTemplate;
197 198 $data = [
198 199 'workflowHelper' => new WorkflowHelper(),
199 200 'followup' => $followup,
@@ -209,16 +210,17 @@
209 210 $this->breadcrumb[empty($followup->name) ? acym_translation('ACYM_NEW_FOLLOW_UP') : $followup->name] = acym_completeLink(
210 211 'campaigns&task=edit&step=followupEmail&id='.$followup->id
211 212 );
212 213
214 + // Ask the user if he wants to add the new email to the queue for the users that already triggered the followup
213 215 if (intval($followup->active) === 1) {
214 216 $newlyCreatedEmail = acym_getVar('int', 'newEmailId');
215 217 if (!empty($newlyCreatedEmail)) {
216 218 $numberOfSubscribers = $followupClass->getNumberSubscribersByListId($followup->list_id, true);
217 219 if (!empty($numberOfSubscribers)) {
218 - $message = '<span class="acym__followup__add_queue" data-acym-email-id="'.intval($newlyCreatedEmail).'">';
220 + $message = '<button type="button" class="acym__followup__add_queue" data-acym-email-id="'.intval($newlyCreatedEmail).'">';
219 221 $message .= acym_translationSprintf('ACYM_FOLLOWUP_ADD_QUEUE', $numberOfSubscribers);
220 - $message .= '</span>';
222 + $message .= '</button>';
221 223 acym_enqueueMessage($message, 'info', false);
222 224 }
223 225 }
224 226 }
@@ -227,8 +229,10 @@
227 229 }
228 230
229 231 public function followupDuplicateMail(): void
230 232 {
233 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
234 +
231 235 $mailId = acym_getVar('int', 'action_mail_id', 0);
232 236 $id = acym_getVar('int', 'id', 0);
233 237 $followupClass = new FollowupClass();
234 238 if (!$followupClass->duplicateMail($mailId, $id)) {
@@ -239,8 +243,10 @@
239 243 }
240 244
241 245 public function followupDeleteMail(): void
242 246 {
247 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
248 +
243 249 $mailId = acym_getVar('int', 'action_mail_id', 0);
244 250 $followupClass = new FollowupClass();
245 251 if (!$followupClass->deleteMail($mailId)) {
246 252 acym_enqueueMessage(acym_translation('ACYM_COULD_NOT_DELETE_MAIL'), 'error');
@@ -246,18 +252,25 @@
246 252 acym_enqueueMessage(acym_translation('ACYM_COULD_NOT_DELETE_MAIL'), 'error');
247 253 }
248 254
249 255 $step = acym_getVar('cmd', 'step', 'followupEmail');
256 + if (!in_array($step, ['followupEmail', 'followupSummary'], true)) {
257 + $step = 'followupEmail';
258 + }
250 259 $this->$step();
251 260 }
252 261
253 262 public function followupDraft(): void
254 263 {
264 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
265 +
255 266 $this->followupFinalize(0);
256 267 }
257 268
258 269 public function followupActivate(): void
259 270 {
271 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
272 +
260 273 $this->followupFinalize(1);
261 274 }
262 275
263 276 public function followupFinalize(int $status): void
@@ -272,9 +285,11 @@
272 285 }
273 286
274 287 public function saveFollowupCondition(): void
275 288 {
276 - if (!acym_isAdmin()) {
289 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
290 +
291 + if (!acym_isAdmin() || !acym_isAllowed('campaigns')) {
277 292 die('Access denied for follow-ups');
278 293 }
279 294
280 295 $id = acym_getVar('int', 'id', 0);
@@ -289,9 +304,9 @@
289 304 } else {
290 305 $followup = new stdClass();
291 306 $followup->name = '';
292 307 $followup->display_name = '';
293 - $followup->creation_date = date('Y-m-d H:i:s', time() - date('Z'));
308 + $followup->creation_date = gmdate('Y-m-d H:i:s', time());
294 309 $followup->trigger = $trigger;
295 310 $followup->condition = json_encode($followupData['condition']);
296 311 $followup->active = 0;
297 312 $followup->send_once = 1;
@@ -297,9 +312,9 @@
297 312 $followup->send_once = 1;
298 313 }
299 314
300 315 $followup->id = $followupClass->save($followup);
301 - if (!empty($followup->id)) {
316 + if (empty($followup->id)) {
302 317 acym_enqueueMessage(acym_translation('ACYM_ERROR_SAVING').': '.acym_getDBError(), 'error');
303 318 $this->listing();
304 319
305 320 return;
@@ -311,9 +326,11 @@
311 326 }
312 327
313 328 public function saveFollowupEmail(bool $redirect = true): void
314 329 {
315 - if (!acym_isAdmin()) {
330 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
331 +
332 + if (!acym_isAdmin() || !acym_isAllowed('campaigns')) {
316 333 die('Access denied for follow-ups');
317 334 }
318 335
319 336 $id = acym_getVar('int', 'id', 0);
@@ -360,9 +377,9 @@
360 377
361 378 $data = [
362 379 'workflowHelper' => new WorkflowHelper(),
363 380 'followup' => $followup,
364 - 'condition' => $followupClass->getConditionSummary($followup->condition, $followup->trigger),
381 + 'condition' => $followupClass->getConditionSummary($followup),
365 382 ];
366 383
367 384 $this->breadcrumb[empty($followup->name) ? acym_translation('ACYM_NEW_FOLLOW_UP') : $followup->name] = acym_completeLink(
368 385 'campaigns&task=edit&step=followupCondition'.$followup->id