PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.1
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 +0 -168 10.2.2 → 11.1.1 View file →
@@ -1,168 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers;
4 -
5 -use AcyMailing\Controllers\Configuration\Language;
6 -use AcyMailing\Core\AcymController;
7 -use AcyMailing\Controllers\Configuration\Listing;
8 -use AcyMailing\Controllers\Configuration\Security;
9 -use AcyMailing\Controllers\Configuration\Mail;
10 -use AcyMailing\Controllers\Configuration\Queue;
11 -use AcyMailing\Controllers\Configuration\Subscription;
12 -use AcyMailing\Controllers\Configuration\License;
13 -
14 -class ConfigurationController extends AcymController
15 -{
16 - use Listing;
17 - use Security;
18 - use Mail;
19 - use Queue;
20 - use Subscription;
21 - use License;
22 - use Language;
23 -
24 - public function __construct()
25 - {
26 - parent::__construct();
27 - $this->breadcrumb[acym_translation('ACYM_CONFIGURATION')] = acym_completeLink('configuration');
28 -
29 - $this->loadScripts = [
30 - 'listing' => [
31 - 'colorpicker',
32 - ],
33 - ];
34 - }
35 -
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 - public function displayMessage(string $message, bool $ajax = false): array
66 - {
67 - $correspondences = [
68 - 'WEBSITE_NOT_FOUND' => ['message' => 'ACYM_WEBSITE_NOT_FOUND', 'type' => 'error'],
69 - 'LICENSE_NOT_FOUND' => ['message' => 'ACYM_LICENSE_NOT_FOUND', 'type' => 'error'],
70 - 'WELL_ATTACH' => ['message' => 'ACYM_LICENSE_WELL_ATTACH', 'type' => 'info'],
71 - 'ISSUE_WHILE_ATTACH' => ['message' => 'ACYM_ISSUE_WHILE_ATTACHING_LICENSE', 'type' => 'error'],
72 - 'ALREADY_ATTACH' => ['message' => 'ACYM_WEBSITE_ALREADY_ATTACHED', 'type' => 'info'],
73 - 'LICENSES_DONT_MATCH' => ['message' => 'ACYM_CANT_UNLINK_WEBSITE_LICENSE_DONT_MATCH', 'type' => 'error'],
74 - 'MAX_SITES_ATTACH' => ['message' => 'ACYM_REACHED_MAX_SITES_ATTACHED', 'type' => 'error'],
75 - 'SITE_NOT_FOUND' => ['message' => 'ACYM_ISSUE_WHILE_ATTACHING_LICENSE', 'type' => 'error'],
76 - 'UNLINK_SUCCESSFUL' => ['message' => 'ACYM_LICENSE_UNLINK_SUCCESSFUL', 'type' => 'info'],
77 - 'UNLINK_FAILED' => ['message' => 'ACYM_ERROR_WHILE_UNLINK_LICENSE', 'type' => 'error'],
78 - 'CRON_WELL_ACTIVATED' => ['message' => 'ACYM_AUTOMATIC_SEND_PROCESS_WELL_ACTIVATED', 'type' => 'info'],
79 - 'CRON_WELL_DEACTIVATED' => ['message' => 'ACYM_AUTOMATIC_SEND_PROCESS_WELL_DEACTIVATED', 'type' => 'info'],
80 - 'CRON_NOT_SAVED' => ['message' => 'ACYM_AUTOMATIC_SEND_PROCESS_NOT_ENABLED', 'type' => 'error'],
81 - ];
82 -
83 - if (!$ajax) {
84 - if (empty($message) || empty($correspondences[$message])) {
85 - acym_enqueueMessage(acym_translation('ACYM_ERROR_ON_CALL_ACYBA_WEBSITE'), 'error');
86 -
87 - if (!empty($message)) {
88 - $notification = [
89 - 'name' => 'curl_error',
90 - 'removable' => 1,
91 - ];
92 - acym_enqueueMessage(acym_translationSprintf('ACYM_CURL_ERROR_MESSAGE', $message), 'error', true, [$notification]);
93 - }
94 -
95 - return [];
96 - }
97 -
98 - acym_enqueueMessage(acym_translation($correspondences[$message]['message']), $correspondences[$message]['type']);
99 -
100 - return $correspondences[$message]['type'] === 'info' ? $correspondences[$message] : [];
101 - } else {
102 - if (empty($message) || empty($correspondences[$message])) {
103 - $response = ['message' => acym_translation('ACYM_ERROR_ON_CALL_ACYBA_WEBSITE'), 'type' => 'error'];
104 -
105 - if (!empty($message)) $response['message'] = acym_translationSprintf('ACYM_CURL_ERROR_MESSAGE', $message);
106 -
107 - return $response;
108 - }
109 -
110 - $response = $correspondences[$message];
111 - $response['message'] = acym_translation($response['message']);
112 -
113 - return $response;
114 - }
115 - }
116 -
117 - function seeLogs(): void
118 - {
119 - $filename = acym_getVar('string', 'filename');
120 -
121 - if (empty($filename) || !acym_fileNameValid($filename)) {
122 - echo acym_translation('ACYM_FILENAME_EMPTY_OR_NOT_VALID');
123 - exit;
124 - }
125 -
126 - $reportPath = acym_getLogPath($filename);
127 -
128 - if (!file_exists($reportPath)) {
129 - echo acym_translation('ACYM_EXIST_LOG');
130 - exit;
131 - }
132 -
133 - if (ACYM_CMS === 'wordpress') @ob_get_clean();
134 -
135 - $final = acym_fileGetContent($reportPath);
136 - echo nl2br($final);
137 -
138 - exit;
139 - }
140 -
141 - private function loginForOAuth2(bool $isSmtp = true): void
142 - {
143 - $this->store();
144 -
145 - $redirectUrl = '';
146 - acym_trigger('onAcymOauthAuthenticate', [&$redirectUrl, $isSmtp]);
147 -
148 - if (empty($redirectUrl)) {
149 - $this->listing();
150 -
151 - return;
152 - }
153 -
154 - acym_redirect($redirectUrl);
155 - }
156 -
157 - public function handleOauthAuthentication(): void
158 - {
159 - $code = acym_getVar('string', 'code');
160 -
161 - if (empty($code)) {
162 - return;
163 - }
164 -
165 - $isSmtp = acym_getVar('string', 'auth_type', 'smtp') === 'smtp';
166 - acym_trigger('onAcymOauthCredentialsCreation', [$isSmtp, $code]);
167 - }
168 -}