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/Bounces/Listing.php +0 -235 10.0.1 → 11.1.1 View file →
@@ -1,235 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Bounces;
4 -
5 -use AcyMailing\Classes\ListClass;
6 -use AcyMailing\Classes\RuleClass;
7 -use AcyMailing\Helpers\BounceHelper;
8 -use AcyMailing\Helpers\CronHelper;
9 -use AcyMailing\Helpers\ToolbarHelper;
10 -use AcyMailing\Helpers\UpdateHelper;
11 -use AcyMailing\Helpers\WorkflowHelper;
12 -
13 -trait Listing
14 -{
15 - public function listing()
16 - {
17 - $this->storeRedirectListing(true);
18 - }
19 -
20 - public function prepareToolbar(&$data, $element = 'bounces')
21 - {
22 - $toolbarHelper = new ToolbarHelper();
23 - if ($element === 'bounces') {
24 - $toolbarHelper->addButton(
25 - 'ACYM_CONFIGURE',
26 - [
27 - 'data-task' => 'config',
28 - 'id' => 'acym__bounce__button__config',
29 - 'type' => 'button',
30 - ],
31 - 'settings'
32 - );
33 - $toolbarHelper->addButton(
34 - 'ACYM_RESET_DEFAULT_RULES',
35 - [
36 - 'data-task' => 'reinstall',
37 - 'type' => 'button',
38 - 'data-confirmation-message' => 'ACYM_ARE_YOU_SURE',
39 - ],
40 - 'repeat'
41 - );
42 - $toolbarHelper->addButton('ACYM_RUN_BOUNCE_HANDLING', ['data-task' => 'test'], 'play_arrow');
43 - $toolbarHelper->addButton('ACYM_CREATE', ['data-task' => 'rule', 'type' => 'submit'], 'add', true);
44 -
45 -
46 - $remindMe = json_decode($this->config->get('remindme', '[]'), true);
47 - $messageIdentifier = 'bounce_rules_'.UpdateHelper::BOUNCE_VERSION;
48 -
49 - if (!in_array($messageIdentifier, $remindMe) && $this->config->get('bounceVersion', 0) < UpdateHelper::BOUNCE_VERSION) {
50 - $message = acym_translation('ACYM_NEW_BOUNCE_RULES');
51 - $message .= '<a href="#" class="acym__do__not__remindme acym__do__not__remindme__info" title="'.$messageIdentifier.'">';
52 - $message .= acym_translation('ACYM_DO_NOT_REMIND_ME');
53 - $message .= '</a>';
54 -
55 - acym_enqueueMessage($message, 'info', false);
56 - }
57 - } else {
58 - $toolbarHelper = new ToolbarHelper();
59 - $toolbarHelper->addSearchBar($data['search'], 'mailboxes_search', 'ACYM_SEARCH');
60 - $toolbarHelper->addButton(acym_translation('ACYM_CREATE'), ['data-task' => 'mailboxAction'], 'add', true);
61 - $data['toolbar'] = $toolbarHelper;
62 - }
63 -
64 - $data['toolbar'] = $toolbarHelper;
65 - }
66 -
67 - public function bounces()
68 - {
69 - $data = [];
70 -
71 -
72 - $data['workflowHelper'] = new WorkflowHelper();
73 - if (!acym_level(ACYM_ENTERPRISE)) {
74 - acym_setVar('layout', 'splashscreen');
75 - $data['isEnterprise'] = false;
76 - }
77 -
78 - $this->prepareToolbar($data);
79 -
80 - parent::display($data);
81 - }
82 -
83 - public function ajaxSetOrdering()
84 - {
85 - $order = json_decode(acym_getVar('string', 'order'));
86 - $i = 1;
87 - $error = false;
88 - foreach ($order as $rule) {
89 - $query = 'UPDATE #__acym_rule SET `ordering` = '.intval($i).' WHERE `id` = '.intval($rule);
90 - $error = acym_query($query) < 0 || $error;
91 - $i++;
92 - }
93 -
94 - acym_sendAjaxResponse('', [], !$error);
95 - }
96 -
97 - public function test()
98 - {
99 - $ruleClass = new RuleClass();
100 -
101 - if ($ruleClass->getOrderingNumber() < 1) {
102 - acym_enqueueMessage(acym_translation('ACYM_NO_RULES'), 'error');
103 -
104 - $this->listing();
105 -
106 - return;
107 - }
108 -
109 - acym_increasePerf();
110 - $bounceHelper = new BounceHelper();
111 - $bounceHelper->report = true;
112 -
113 - if ($bounceHelper->init()) {
114 - if ($bounceHelper->connect()) {
115 - $this->runBounce = true;
116 - } else {
117 - $errors = $bounceHelper->getErrors();
118 - if (!empty($errors)) {
119 - acym_enqueueMessage($errors, 'error');
120 - $errorString = implode(' ', $errors);
121 - $port = $this->config->get('bounce_port', '');
122 - if (preg_match('#certificate#i', $errorString) && !$this->config->get('bounce_certif', false)) {
123 - acym_enqueueMessage(acym_translationSprintf('ACYM_YOU_MAY_TURN_ON_OPTION', '<i>'.acym_translation('ACYM_SELF_SIGNED_CERTIFICATE').'</i>'), 'warning');
124 - } elseif (!empty($port) && !in_array($port, ['993', '143', '110'])) {
125 - acym_enqueueMessage(acym_translation('ACYM_BOUNCE_WRONG_PORT'), 'warning');
126 - }
127 - }
128 - }
129 - }
130 -
131 - $this->listing();
132 - }
133 -
134 - public function process()
135 - {
136 - acym_increasePerf();
137 -
138 - $bounceHelper = new BounceHelper();
139 - $bounceHelper->report = true;
140 - if (!$bounceHelper->init()) {
141 - return;
142 - }
143 - if (!$bounceHelper->connect()) {
144 - acym_display($bounceHelper->getErrors(), 'error');
145 -
146 - return;
147 - }
148 - $disp = "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n";
149 - $disp .= '<title>'.addslashes(acym_translation('ACYM_BOUNCE_PROCESS')).'</title>'."\n";
150 - $disp .= "<style>body{font-size:12px;font-family: Arial,Helvetica,sans-serif;padding-top:30px;}</style>\n</head>\n<body>";
151 - echo $disp;
152 -
153 - acym_display(acym_translationSprintf('ACYM_BOUNCE_CONNECT_SUCC', $this->config->get('bounce_username')), 'success');
154 - $nbMessages = $bounceHelper->getNBMessages();
155 - $nbMessagesReport = acym_translationSprintf('ACYM_NB_MAIL_MAILBOX', $nbMessages);
156 - acym_display($nbMessagesReport, 'info');
157 -
158 - if (empty($nbMessages)) {
159 - exit;
160 - }
161 -
162 - $bounceHelper->handleMessages();
163 -
164 - $cronHelper = new CronHelper();
165 - $cronHelper->saveReport([$nbMessagesReport], $bounceHelper->messages);
166 -
167 - if ($this->config->get('bounce_max', 0) != 0 && $nbMessages > $this->config->get('bounce_max', 0)) {
168 - $url = acym_completeLink('bounces&task=process&continuebounce=1', true, true);
169 - if (acym_getVar('int', 'continuebounce')) {
170 - echo '<script type="text/javascript">document.location.href=\''.$url.'\';</script>';
171 - } else {
172 - echo '<div style="padding:20px;"><a href="'.$url.'">'.acym_translation('ACYM_CLICK_HANDLE_ALL_BOUNCES').'</a></div>';
173 - }
174 - }
175 -
176 - echo '</body></html>';
177 - while ($bounceHelper->obend-- > 0) {
178 - ob_start();
179 - }
180 - exit;
181 - }
182 -
183 - public function reinstall()
184 - {
185 - $ruleClass = new RuleClass();
186 - $ruleClass->cleanTable();
187 -
188 - $updateHelper = new UpdateHelper();
189 - $updateHelper->installBounceRules();
190 -
191 - return $this->listing();
192 - }
193 -
194 - public function config()
195 - {
196 - acym_redirect(acym_completeLink('configuration', false, true));
197 - }
198 -
199 - public function delete()
200 - {
201 - $rulesSelected = acym_getVar('array', 'elements_checked');
202 -
203 - if (in_array(RuleClass::FINAL_RULE_ID, $rulesSelected)) {
204 - acym_enqueueMessage(acym_translation('ACYM_CANNOT_DELETE_FINAL_RULE'), 'error');
205 -
206 - $key = array_search(RuleClass::FINAL_RULE_ID, $rulesSelected);
207 - if ($key !== false) {
208 - unset($rulesSelected[$key]);
209 - }
210 - }
211 -
212 - $ruleClass = new RuleClass();
213 - $ruleClass->delete($rulesSelected);
214 -
215 - $this->listing();
216 - }
217 -
218 - public function setInactive()
219 - {
220 - $rulesSelected = acym_getVar('array', 'elements_checked');
221 - $ruleClass = new RuleClass();
222 - $ruleClass->setInactive($rulesSelected);
223 -
224 - $this->listing();
225 - }
226 -
227 - public function setActive()
228 - {
229 - $rulesSelected = acym_getVar('array', 'elements_checked');
230 - $ruleClass = new RuleClass();
231 - $ruleClass->setActive($rulesSelected);
232 -
233 - $this->listing();
234 - }
235 -}