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/Configuration/Listing.php +25 -33 10.11.1 → 11.1.0 View file →
@@ -9,9 +9,8 @@
9 9 use AcyMailing\Helpers\MailerHelper;
10 10 use AcyMailing\Helpers\TabHelper;
11 11 use AcyMailing\Helpers\ToolbarHelper;
12 12 use AcyMailing\Helpers\UpdatemeHelper;
13 -use AcyMailing\Core\AcymPlugin;
14 13 use AcyMailing\Types\AclType;
15 14 use AcyMailing\Types\DelayType;
16 15 use AcyMailing\Types\FailActionType;
17 16
@@ -20,8 +19,9 @@
20 19 public function listing(): void
21 20 {
22 21 acym_setVar('layout', 'listing');
23 22
23 + // We check if we have to store a token from an OAuth provider
24 24 $this->handleOauthAuthentication();
25 25
26 26 $data = [];
27 27 $data['tab'] = new TabHelper();
@@ -36,13 +36,8 @@
36 36 $this->prepareToolbar($data);
37 37 $this->prepareHoursMinutes($data);
38 38 $this->resetQueueProcess();
39 39
40 - if ($data['wp_mail_smtp_installed']) {
41 - $pluginClass = new AcymPlugin();
42 - $data['button_copy_settings_from'] = $pluginClass->getCopySettingsButton($data, 'from_options', 'wp_mail_smtp');
43 - }
44 -
45 40 $this->prepareMailSettings($data);
46 41 $this->prepareMultilingualOption($data);
47 42
48 43 $this->loadSurveyAnswers($data);
@@ -92,11 +87,8 @@
92 87 $data['sendingMethods'] = [];
93 88 acym_trigger('onAcymGetSendingMethods', [&$data]);
94 89 acym_trigger('onAcymGetSendingMethodsSelected', [&$data]);
95 90
96 - $data['sendingMethodsHtmlSettings'] = [];
97 - acym_trigger('onAcymGetSendingMethodsHtmlSetting', [&$data]);
98 -
99 91 $data['embedImage'] = [];
100 92 $data['embedAttachment'] = [];
101 93 acym_trigger('onAcymSendingMethodOptions', [&$data]);
102 94 }
@@ -136,26 +128,17 @@
136 128 $langs = acym_getLanguages();
137 129 $data['languages'] = [];
138 130
139 131 foreach ($langs as $lang => $obj) {
140 - if ($lang === 'xx-XX') continue;
132 + if ($lang === 'xx-XX') {
133 + continue;
134 + }
141 135
142 136 $oneLanguage = new \stdClass();
143 137 $oneLanguage->language = $lang;
144 138 $oneLanguage->name = $obj->name;
139 + $oneLanguage->icon = $obj->exists ? 'edit' : 'add';
145 140
146 - $linkEdit = acym_completeLink('language&task=displayLanguage&code='.$lang, true);
147 - $icon = $obj->exists ? 'edit' : 'add';
148 - $idModalLanguage = 'acym_modal_language_'.$lang;
149 - $oneLanguage->edit = acym_modal(
150 - '<i class="acymicon-'.$icon.' cursor-pointer acym__color__blue" data-open="'.$idModalLanguage.'" data-ajax="false" data-iframe="'.$linkEdit.'" data-iframe-class="acym__iframe_language" id="image'.$lang.'"></i>',
151 - '', //<iframe src="'.$linkEdit.'"></iframe>
152 - $idModalLanguage,
153 - ['data-reveal-larger' => true],
154 - [],
155 - false
156 - );
157 -
158 141 $data['languages'][] = $oneLanguage;
159 142 }
160 143
161 144 usort(
@@ -223,9 +206,9 @@
223 206 }
224 207
225 208 private function prepareAcl(array &$data): void
226 209 {
227 - $data['acl'] = acym_cmsPermission();
210 + $data['adminPermissions'] = acym_hasAdminPermissions();
228 211 $data['acl_advanced'] = acym_getPagesForAcl();
229 212 $data['aclType'] = new AclType();
230 213 }
231 214
@@ -235,9 +218,8 @@
235 218 $data['acychecker_installed'] = acym_isAcyCheckerInstalled();
236 219 $data['acychecker_get_link'] = ACYM_ACYCHECKER_WEBSITE.'?utm_source=acymailing_plugin&utm_campaign=get_acychecker&utm_medium=button_configuration_security';
237 220
238 221 $data['level'] = acym_level(ACYM_ESSENTIAL);
239 - $data['labelDropdownCaptcha'] = acym_translation('ACYM_CONFIGURATION_CAPTCHA');
240 222
241 223 $captchaOptions = array_replace(
242 224 [
243 225 'none' => acym_translation('ACYM_NONE'),
@@ -250,9 +232,8 @@
250 232
251 233 $data['captchaOptions'] = $captchaOptions;
252 234
253 235 if (!acym_level(ACYM_ESSENTIAL)) {
254 - $data['labelDropdownCaptcha'] .= ' '.acym_translation('ACYM_PRO_VERSION_ONLY');
255 236 $data['captchaOptions'] = [];
256 237 }
257 238 }
258 239
@@ -297,9 +278,9 @@
297 278 }
298 279
299 280 public function store(): void
300 281 {
301 - acym_checkToken();
282 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
302 283
303 284 $formData = acym_getVar('array', 'config', []);
304 285 if (empty($formData)) {
305 286 return;
@@ -307,11 +288,11 @@
307 288
308 289 $this->handleReplyTo($formData);
309 290 $this->handleWordWrap($formData);
310 291 $this->handleQueueSettings($formData);
311 - $this->handleDemoSite($formData);
312 292 $this->handleAcl($formData);
313 293 $this->handleSelect2Fields($formData);
294 + $this->handleDemoSite($formData);
314 295 $this->handleAcyChecker($formData);
315 296 $this->handleNewDkim($formData);
316 297 $this->handleEmails($formData);
317 298 $this->handleUnsubSurvey($formData);
@@ -317,8 +298,9 @@
317 298 $this->handleUnsubSurvey($formData);
318 299
319 300 acym_trigger('onBeforeSaveConfigFields', [&$formData]);
320 301
302 + // Don't move this line in the if, we need to do it before the save
321 303 $licenseKeyBeforeSave = $this->config->get('license_key');
322 304
323 305 if ($this->config->saveConfig($formData)) {
324 306 $this->handleWebsiteLinking($formData, $licenseKeyBeforeSave);
@@ -358,8 +340,9 @@
358 340 {
359 341 $currentTaskId = (int)$this->config->get('scheduled_task_id');
360 342 $frequency = (int)$formData['cron_frequency'];
361 343
344 + //TODO maybe also handle 15min cron like this
362 345 if (
363 346 !acym_level(ACYM_ESSENTIAL)
364 347 || $formData['queue_type'] === 'manual'
365 348 || empty($frequency)
@@ -400,10 +383,9 @@
400 383 }
401 384
402 385 private function handleAcl(array &$formData): void
403 386 {
404 - $aclPermissions = acym_cmsPermission();
405 - if (ACYM_PRODUCTION && !empty($aclPermissions)) {
387 + if (ACYM_PRODUCTION && acym_hasAdminPermissions()) {
406 388 $aclPages = array_keys(acym_getPagesForAcl());
407 389 foreach ($aclPages as $page) {
408 390 if (empty($formData['acl_'.$page])) {
409 391 $formData['acl_'.$page] = [ACYM_ADMIN_GROUP];
@@ -428,10 +410,9 @@
428 410 'allowed_hosts',
429 411 'unsub_survey',
430 412 ];
431 413
432 - $aclPermissions = acym_cmsPermission();
433 - if (!empty($aclPermissions)) {
414 + if (acym_hasAdminPermissions()) {
434 415 $select2Fields[] = 'wp_access';
435 416 }
436 417
437 418 foreach ($select2Fields as $oneField) {
@@ -473,8 +454,9 @@
473 454 }
474 455
475 456 private function handleNewDkim(array &$formData): void
476 457 {
458 + // The user set DKIM as disabled
477 459 if (empty($formData['dkim'])) {
478 460 return;
479 461 }
480 462
@@ -480,12 +462,14 @@
480 462
481 463 $privateKey = $this->config->get('dkim_private');
482 464 $publicKey = $this->config->get('dkim_public');
483 465
466 + // We're manually submitting keys
484 467 if (!empty($formData['dkim_private']) || !empty($formData['dkim_public'])) {
485 468 return;
486 469 }
487 470
471 + // We don't submit keys and stored keys are not empty
488 472 if (!isset($formData['dkim_private']) && !empty($privateKey) && !empty($publicKey)) {
489 473 return;
490 474 }
491 475
@@ -502,8 +486,9 @@
502 486 {
503 487 $isLicenseKeyUpdated = isset($formData['license_key']) && $licenseKeyBeforeSave !== $formData['license_key'];
504 488
505 489 if ($isLicenseKeyUpdated && ACYM_PRODUCTION) {
490 + // If we add a key or edit it, we try to attach it
506 491 if (!empty($formData['license_key'])) {
507 492 $resultAttachLicenseOnUpdateMe = $this->attachLicenseOnUpdateMe($formData['license_key']);
508 493
509 494 if (!empty($resultAttachLicenseOnUpdateMe['message'])) {
@@ -509,8 +494,9 @@
509 494 if (!empty($resultAttachLicenseOnUpdateMe['message'])) {
510 495 $this->displayMessage($resultAttachLicenseOnUpdateMe['message']);
511 496 }
512 497 } else {
498 + // If we remove a key, we try to unlink it
513 499 $resultUnlinkLicenseOnUpdateMe = $this->unlinkLicenseOnUpdateMe($licenseKeyBeforeSave);
514 500
515 501 if (!empty($resultUnlinkLicenseOnUpdateMe['message'])) {
516 502 $this->displayMessage($resultUnlinkLicenseOnUpdateMe['message']);
@@ -522,8 +508,9 @@
522 508 }
523 509
524 510 private function handleMultilingual(array $formData): void
525 511 {
512 + // Remove unused email translations
526 513 $removed = array_diff(
527 514 explode(',', acym_getVar('string', 'previous_multilingual_languages', '')),
528 515 $formData['multilingual_languages']
529 516 );
@@ -545,8 +532,9 @@
545 532 $mailerHelper->Subject = 'Test e-mail from '.ACYM_LIVE;
546 533 $mailerHelper->Body = acym_translation('ACYM_TEST_EMAIL');
547 534 $mailerHelper->SMTPDebug = 1;
548 535 $mailerHelper->isTest = true;
536 + //We set the full error reporting if we are in debug mode
549 537 if (acym_isDebug()) {
550 538 $mailerHelper->SMTPDebug = 2;
551 539 }
552 540
@@ -592,9 +580,9 @@
592 580 $unsubSurvey = json_decode($formData['unsub_survey'], true);
593 581 if (is_array($unsubSurvey)) {
594 582 foreach ($unsubSurvey as $key => $value) {
595 583 if (is_string($value)) {
596 - $unsubSurvey[$key] = strip_tags($value);
584 + $unsubSurvey[$key] = acym_stripTags($value);
597 585 }
598 586 }
599 587 $formData['unsub_survey'] = json_encode($unsubSurvey);
600 588 }
@@ -606,9 +594,9 @@
606 594 foreach ($unsubSurveyTranslation as $lang => $unsubSurvey) {
607 595 if (is_array($unsubSurvey) && isset($unsubSurvey['unsub_survey'])) {
608 596 foreach ($unsubSurvey['unsub_survey'] as $key => $value) {
609 597 if (is_string($value)) {
610 - $unsubSurveyTranslation[$lang]['unsub_survey'][$key] = strip_tags($value);
598 + $unsubSurveyTranslation[$lang]['unsub_survey'][$key] = acym_stripTags($value);
611 599 }
612 600 }
613 601 }
614 602 }
@@ -626,8 +614,10 @@
626 614
627 615
628 616 public function addNewSml(): void
629 617 {
618 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
619 +
630 620 acym_trigger('onConfigurationAddSml');
631 621 $this->listing();
632 622 }
633 623
@@ -632,8 +622,10 @@
632 622 }
633 623
634 624 public function deleteSml(): void
635 625 {
626 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
627 +
636 628 acym_trigger('onConfigurationDeleteSml');
637 629 $this->listing();
638 630 }
639 631 }