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/ConfigurationController.php +10 -35 10.2.2 → 11.1.0 View file →
@@ -20,8 +20,10 @@
20 20 use Subscription;
21 21 use License;
22 22 use Language;
23 23
24 + const CRON_TASK_NAME = 'acymailing_automated_tasks_cron_task';
25 +
24 26 public function __construct()
25 27 {
26 28 parent::__construct();
27 29 $this->breadcrumb[acym_translation('ACYM_CONFIGURATION')] = acym_completeLink('configuration');
@@ -32,37 +34,8 @@
32 34 ],
33 35 ];
34 36 }
35 37
36 - public function getAjax(): void
37 - {
38 - acym_checkToken();
39 -
40 - $field = acym_getVar('string', 'field', '');
41 -
42 - $whitelistedFields = [
43 - 'level',
44 - 'unsplash_key',
45 - 'tenor_key',
46 - ];
47 -
48 - if (acym_isAdmin()) {
49 - $whitelistedFields[] = 'save_thumbnail';
50 - }
51 -
52 - if (!in_array($field, $whitelistedFields)) {
53 - acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_LOAD_INFORMATION'), [], false);
54 - }
55 -
56 - $res = $this->config->get($field, '');
57 -
58 - if (intval($res) !== 0 && empty($res)) {
59 - acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_LOAD_INFORMATION'), [], false);
60 - } else {
61 - acym_sendAjaxResponse('', ['value' => $res]);
62 - }
63 - }
64 -
65 38 public function displayMessage(string $message, bool $ajax = false): array
66 39 {
67 40 $correspondences = [
68 41 'WEBSITE_NOT_FOUND' => ['message' => 'ACYM_WEBSITE_NOT_FOUND', 'type' => 'error'],
@@ -113,14 +86,14 @@
113 86 return $response;
114 87 }
115 88 }
116 89
117 - function seeLogs(): void
90 + public function seeLogs(): void
118 91 {
119 - $filename = acym_getVar('string', 'filename');
92 + $filename = acym_getVar('string', 'filename', '');
120 93
121 94 if (empty($filename) || !acym_fileNameValid($filename)) {
122 - echo acym_translation('ACYM_FILENAME_EMPTY_OR_NOT_VALID');
95 + echo esc_html(acym_translation('ACYM_FILENAME_EMPTY_OR_NOT_VALID'));
123 96 exit;
124 97 }
125 98
126 99 $reportPath = acym_getLogPath($filename);
@@ -125,9 +98,9 @@
125 98
126 99 $reportPath = acym_getLogPath($filename);
127 100
128 101 if (!file_exists($reportPath)) {
129 - echo acym_translation('ACYM_EXIST_LOG');
102 + echo esc_html(acym_translation('ACYM_EXIST_LOG'));
130 103 exit;
131 104 }
132 105
133 106 if (ACYM_CMS === 'wordpress') @ob_get_clean();
@@ -132,9 +105,9 @@
132 105
133 106 if (ACYM_CMS === 'wordpress') @ob_get_clean();
134 107
135 108 $final = acym_fileGetContent($reportPath);
136 - echo nl2br($final);
109 + echo nl2br(esc_html($final));
137 110
138 111 exit;
139 112 }
140 113
@@ -139,8 +112,9 @@
139 112 }
140 113
141 114 private function loginForOAuth2(bool $isSmtp = true): void
142 115 {
116 + // Step 1: prompt consent window to the user
143 117 $this->store();
144 118
145 119 $redirectUrl = '';
146 120 acym_trigger('onAcymOauthAuthenticate', [&$redirectUrl, $isSmtp]);
@@ -150,13 +124,14 @@
150 124
151 125 return;
152 126 }
153 127
154 - acym_redirect($redirectUrl);
128 + acym_redirect($redirectUrl, '', 'message', false);
155 129 }
156 130
157 131 public function handleOauthAuthentication(): void
158 132 {
133 + // Step 2: get the access and refresh tokens after the user is redirected to the config with a code in the URL
159 134 $code = acym_getVar('string', 'code');
160 135
161 136 if (empty($code)) {
162 137 return;