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/Mails/Listing.php +42 -27 10.11.1 → 11.1.0 View file →
@@ -14,14 +14,16 @@
14 14 public function listing(): void
15 15 {
16 16 acym_setVar('layout', 'listing');
17 17
18 + // Get filters data
18 19 $searchFilter = $this->getVarFiltersListing('string', 'mails_search', '');
19 20 $tagFilter = $this->getVarFiltersListing('string', 'mails_tag', '');
20 - $ordering = $this->getVarFiltersListing('string', 'mails_ordering', 'creation_date');
21 + $ordering = $this->getVarFiltersListing('cmd', 'mails_ordering', 'creation_date');
21 22 $orderingSortOrder = $this->getVarFiltersListing('cmd', 'mails_ordering_sort_order', 'desc');
22 23
23 24 $pagination = new PaginationHelper();
25 + // Get pagination data
24 26 $mailsPerPage = $pagination->getListLimit();
25 27 $page = $this->getVarFiltersListing('int', 'mails_pagination_page', 1);
26 28 $mailClass = new MailClass();
27 29 $status = MailClass::TYPE_STANDARD;
@@ -47,8 +49,9 @@
47 49
48 50 return;
49 51 }
50 52
53 + // Prepare the pagination
51 54 $pagination->setStatus($matchingMails['total']->total, $page, $mailsPerPage);
52 55
53 56 ob_start();
54 57 require acym_getView('mails', 'listing_import', true);
@@ -85,37 +88,39 @@
85 88 $toolbarHelper = new ToolbarHelper();
86 89 $toolbarHelper->addSearchBar($data['search'], 'mails_search', 'ACYM_SEARCH');
87 90 $toolbarHelper->addFilterByTag($data, 'mails_tag', 'acym__templates__filter__tags acym__select');
88 91 $toolbarHelper->addButton(acym_translation('ACYM_ADD_DEFAULT_TMPL'), ['data-task' => 'installDefaultTmpl', 'id' => 'acym__mail__install-default'], 'content_copy');
89 - $otherContent = acym_modal(
90 - '<i class="acymicon-download"></i>'.acym_translation('ACYM_IMPORT'),
91 - $data['templateImportView'],
92 - 'acym__template__import__reveal',
93 - [],
92 +
93 + $toolbarHelper->addModalButton(
94 94 [
95 - 'class' => 'button button-secondary cell medium-6 large-shrink',
96 - 'data-reload' => 'true',
97 - 'data-ajax' => 'false',
95 + 'button' => '<i class="acymicon-download"></i>'.esc_html(acym_translation('ACYM_IMPORT')),
96 + 'modalContent' => $data['templateImportView'],
97 + 'id' => 'acym__template__import__reveal',
98 + 'attributesButton' => [
99 + 'class' => 'button button-secondary cell medium-6 large-shrink',
100 + 'data-reload' => 'true',
101 + 'data-ajax' => 'false',
102 + ],
98 103 ]
99 104 );
100 105
101 - $otherContent .= acym_modal(
102 - '<i class="acymicon-add"></i>'.acym_translation('ACYM_CREATE'),
103 - '<div class="cell grid-x grid-margin-x">
104 - <button type="button" data-task="edit" data-editor="html" class="acym__create__template button cell large-auto small-6 margin-top-1 button-secondary">'.acym_translation(
105 - 'ACYM_HTML_EDITOR'
106 - ).'</button>
107 - <button type="button" data-task="edit" data-editor="acyEditor" class="acym__create__template button cell medium-auto margin-top-1">'.acym_translation(
108 - 'ACYM_DD_EDITOR'
109 - ).'</button>
106 + $toolbarHelper->addModalButton(
107 + [
108 + 'button' => '<i class="acymicon-add"></i>'.esc_html(acym_translation('ACYM_CREATE')),
109 + 'modalContent' => '<div class="cell grid-x grid-margin-x">
110 + <button type="button" data-task="edit" data-editor="html" class="acym__create__template button cell large-auto small-6 margin-top-1 button-secondary">'.esc_html(
111 + acym_translation('ACYM_HTML_EDITOR')
112 + ).'</button>
113 + <button type="button" data-task="edit" data-editor="acyEditor" class="acym__create__template button cell medium-auto margin-top-1">'.esc_html(
114 + acym_translation('ACYM_DD_EDITOR')
115 + ).'</button>
110 116 </div>',
111 - '',
112 - [],
113 - ['class' => 'acym_vcenter button cell medium-6 large-shrink'],
114 - true,
115 - false
117 + 'attributesButton' => [
118 + 'class' => 'acym_vcenter button cell medium-6 large-shrink',
119 + ],
120 + 'isLarge' => false,
121 + ]
116 122 );
117 - $toolbarHelper->addOtherContent($otherContent);
118 123
119 124 $data['toolbar'] = $toolbarHelper;
120 125 }
121 126
@@ -120,9 +125,9 @@
120 125 }
121 126
122 127 public function doUploadTemplate(): void
123 128 {
124 - acym_checkToken();
129 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
125 130
126 131 if (!acym_isAdmin() || !acym_isAllowed('mails')) {
127 132 die('Access denied');
128 133 }
@@ -134,10 +139,11 @@
134 139 }
135 140
136 141 public function export(): void
137 142 {
138 - acym_checkToken();
143 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
139 144
145 + // Get passed data and check if we have everything we need
140 146 $templateId = acym_getVar('int', 'templateId', 0);
141 147
142 148 if (empty($templateId)) {
143 149 exit;
@@ -145,8 +151,9 @@
145 151
146 152 $mailClass = new MailClass();
147 153 $template = $mailClass->getOneById($templateId);
148 154
155 + // We have all we need for the export, prepare the headers for the download
149 156 $exportHelper = new ExportHelper();
150 157 $exportHelper->exportTemplate($template);
151 158
152 159 exit;
@@ -153,8 +160,10 @@
153 160 }
154 161
155 162 public function installDefaultTmpl(): void
156 163 {
164 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
165 +
157 166 $updateHelper = new UpdateHelper();
158 167 $updateHelper->installTemplates();
159 168
160 169 $this->listing();
@@ -161,8 +170,10 @@
161 170 }
162 171
163 172 public function favorite(): void
164 173 {
174 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
175 +
165 176 $templateId = acym_getVar('int', 'templateId', 0);
166 177
167 178 if (empty($templateId)) {
168 179 acym_enqueueMessage(acym_translationSprintf('ACYM_NOT_FOUND', acym_translation('ACYM_TEMPLATE')), 'error');
@@ -178,8 +189,10 @@
178 189 }
179 190
180 191 public function massDuplicate(): void
181 192 {
193 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
194 +
182 195 $ids = acym_getVar('array', 'elements_checked', []);
183 196 if (!empty($ids)) {
184 197 $this->duplicate($ids);
185 198 }
@@ -187,8 +200,10 @@
187 200 }
188 201
189 202 public function oneDuplicate(): void
190 203 {
204 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
205 +
191 206 $templateId = acym_getVar('int', 'templateId', 0);
192 207
193 208 if (empty($templateId)) {
194 209 acym_enqueueMessage(acym_translation('ACYM_TEMPLATE_DUPLICATE_ERROR'), 'error');
@@ -244,9 +259,9 @@
244 259 }
245 260
246 261 public function getMailByIdAjax(): void
247 262 {
248 - acym_checkToken();
263 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
249 264 $mailId = acym_getVar('int', 'id', 0);
250 265 if (empty($mailId)) {
251 266 acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_FIND_MAIL'), [], false);
252 267 }