| @@ -19,14 +19,14 @@ | ||
| 19 | 19 | acym_setVar('layout', 'settings'); |
| 20 | 20 | |
| 21 | 21 | $tab = acym_getVar('string', 'step', ListsController::LIST_EDITION_TABS_GENERAL); |
| 22 | 22 | |
| 23 | + // In the front with the SEF activated, the tab is not always set | |
| 23 | 24 | if (empty($tab)) { |
| 24 | 25 | $tab = ListsController::LIST_EDITION_TABS_GENERAL; |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | $data = []; |
| 28 | - $data['svg'] = acym_loaderLogo(false); | |
| 29 | 29 | $data['workflowHelper'] = new WorkflowHelper(); |
| 30 | 30 | $data['currentTab'] = $tab; |
| 31 | 31 | $data['tabs'] = [ |
| 32 | 32 | 'general' => ListsController::LIST_EDITION_TABS_GENERAL, |
| @@ -64,14 +64,14 @@ | ||
| 64 | 64 | $listInformation->description = ''; |
| 65 | 65 | $listInformation->active = 1; |
| 66 | 66 | $listInformation->visible = 1; |
| 67 | 67 | $listInformation->color = '#'.implode('', [ |
| 68 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 69 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 70 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 71 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 72 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 73 | - ListClass::COLOR_PARTS[rand(0, 15)], | |
| 68 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 69 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 70 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 71 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 72 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 73 | + ListClass::COLOR_PARTS[acym_rand(0, 15)], | |
| 74 | 74 | ]); |
| 75 | 75 | $listInformation->welcome_id = ''; |
| 76 | 76 | $listInformation->unsubscribe_id = ''; |
| 77 | 77 | $listInformation->access = []; |
| @@ -92,9 +92,9 @@ | ||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | $subscribersCount = $listClass->getSubscribersCountPerStatusByListIds([$listId]); |
| 95 | 95 | |
| 96 | - $this->breadcrumb[acym_escape($listInformation->name)] = acym_completeLink('lists&task=settings&listId='.$listId); | |
| 96 | + $this->breadcrumb[$listInformation->name] = acym_completeLink('lists&task=settings&listId='.$listId); | |
| 97 | 97 | |
| 98 | 98 | $listInformation->access = empty($listInformation->access) ? [] : explode(',', $listInformation->access); |
| 99 | 99 | |
| 100 | 100 | $currentUser = acym_currentUserId(); |
| @@ -177,25 +177,9 @@ | ||
| 177 | 177 | |
| 178 | 178 | return; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $entityHelper = new EntitySelectHelper(); | |
| 182 | - | |
| 183 | - $data['subscribersEntitySelect'] = acym_modal( | |
| 184 | - acym_translation('ACYM_MANAGE_SUBSCRIBERS'), | |
| 185 | - $entityHelper->entitySelect( | |
| 186 | - 'user', | |
| 187 | - ['join' => 'join_list-'.$listId], | |
| 188 | - $entityHelper->getColumnsForUser('userlist.user_id'), | |
| 189 | - ['text' => acym_translation('ACYM_CONFIRM'), 'action' => 'saveSubscribers'], | |
| 190 | - true, | |
| 191 | - '', | |
| 192 | - 'subscriber' | |
| 193 | - ), | |
| 194 | - 'acym__lists__settings__subscribers__entity__modal', | |
| 195 | - [], | |
| 196 | - ['class' => 'cell medium-6 large-shrink button button-secondary'] | |
| 197 | - ); | |
| 181 | + $data['subscribersEntitySelect'] = $listId; | |
| 198 | 182 | } |
| 199 | 183 | |
| 200 | 184 | private function prepareListStat(array &$data, int $listId): void |
| 201 | 185 | { |
| @@ -231,9 +215,10 @@ | ||
| 231 | 215 | $listClass = new ListClass(); |
| 232 | 216 | $subEvolStat = $listClass->getYearSubEvolutionPerList($listId); |
| 233 | 217 | if (empty($subEvolStat['subscribers']) && empty($subEvolStat['unsubscribers'])) return; |
| 234 | 218 | |
| 235 | - $firstMonth = date('n') + 1; | |
| 219 | + // Init tables ordered by month number starting on month from one year ago | |
| 220 | + $firstMonth = gmdate('n') + 1; | |
| 236 | 221 | $zeroReached = false; |
| 237 | 222 | $evolSub = []; |
| 238 | 223 | $evolUnsub = []; |
| 239 | 224 | for ($i = 0; $i < 12; $i++) { |
| @@ -277,9 +262,9 @@ | ||
| 277 | 262 | } |
| 278 | 263 | } |
| 279 | 264 | |
| 280 | 265 | $returnLink = acym_completeLink('lists&task=settings&listId='.$data['listInformation']->id.'&edition=1&'.$short.'mailid={mailid}'); |
| 281 | - $favoriteTemplate = $this->config->get('favorite_template', 0); | |
| 266 | + $favoriteTemplate = $mailClass->getFavoriteTemplateId(); | |
| 282 | 267 | $startFrom = empty($favoriteTemplate) ? '' : '&from='.$favoriteTemplate; |
| 283 | 268 | |
| 284 | 269 | if (empty($data['listInformation']->{$full.'_id'})) { |
| 285 | 270 | $data['tmpls'][$short.'TmplUrl'] = acym_completeLink( |
| @@ -300,8 +285,10 @@ | ||
| 300 | 285 | } |
| 301 | 286 | |
| 302 | 287 | public function unsetMail(string $type): void |
| 303 | 288 | { |
| 289 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 290 | + | |
| 304 | 291 | $listClass = new ListClass(); |
| 305 | 292 | $id = acym_getVar('int', 'listId', 0); |
| 306 | 293 | $list = $listClass->getOneById($id); |
| 307 | 294 | |
| @@ -312,9 +299,9 @@ | ||
| 312 | 299 | return; |
| 313 | 300 | } |
| 314 | 301 | |
| 315 | 302 | if (!$listClass->hasUserAccess($id)) { |
| 316 | - die('Access denied for list '.acym_escape($id)); | |
| 303 | + die('Access denied for list '.esc_html($id)); | |
| 317 | 304 | } |
| 318 | 305 | |
| 319 | 306 | $list->$type = null; |
| 320 | 307 | |
| @@ -344,9 +331,9 @@ | ||
| 344 | 331 | } |
| 345 | 332 | |
| 346 | 333 | public function save(bool $goToListing = true): void |
| 347 | 334 | { |
| 348 | - acym_checkToken(); | |
| 335 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 349 | 336 | |
| 350 | 337 | $step = acym_getVar('string', 'step'); |
| 351 | 338 | if ($step === self::LIST_EDITION_TABS_GENERAL) { |
| 352 | 339 | $listClass = new ListClass(); |
| @@ -372,9 +359,9 @@ | ||
| 372 | 359 | |
| 373 | 360 | if (acym_isAdmin()) { |
| 374 | 361 | $listInformation->access = empty($listInformation->access) ? '' : ','.implode(',', $listInformation->access).','; |
| 375 | 362 | } elseif (!empty($formData->id) && !$listClass->hasUserAccess($formData->id)) { |
| 376 | - die('Cannot save list '.acym_escape($formData->id)); | |
| 363 | + die('Cannot save list '.esc_html($formData->id)); | |
| 377 | 364 | } |
| 378 | 365 | |
| 379 | 366 | $listId = $listClass->save($listInformation); |
| 380 | 367 | |
| @@ -431,9 +418,9 @@ | ||
| 431 | 418 | } |
| 432 | 419 | |
| 433 | 420 | public function saveSubscribers(): void |
| 434 | 421 | { |
| 435 | - acym_checkToken(); | |
| 422 | + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 436 | 423 | |
| 437 | 424 | $this->saveSubscribersTolist(); |
| 438 | 425 | $listId = acym_getVar('int', 'listId', 0); |
| 439 | 426 | acym_setVar('listId', $listId); |