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/Classes/ListClass.php +14 -5 11.0.1 → 11.1.0 View file →
@@ -320,9 +320,12 @@
320 320 $offset = $options['offset'] ?? 0;
321 321 $limit = $options['limit'] ?? 100;
322 322 $status = $options['status'] ?? null;
323 323 $orderBy = $options['orderBy'] ?? '';
324 - $orderBySort = $options['orderBySort'] ?? '';
324 + $orderBySort = strtolower((string)($options['orderBySort'] ?? ''));
325 + if (!in_array($orderBySort, ['asc', 'desc'], true)) {
326 + $orderBySort = empty($orderBy) ? 'asc' : 'desc';
327 + }
325 328 $subscribedAfter = $options['subscribed_after'] ?? null;
326 329 $unsubscribedAfter = $options['unsubscribed_after'] ?? null;
327 330
328 331 if (empty($listIds)) {
@@ -347,11 +350,14 @@
347 350 $requestSub = 'SELECT user.*, user_list.status, user_list.subscription_date, user_list.unsubscribe_date FROM #__acym_user AS user';
348 351 $requestSub .= ' LEFT JOIN #__acym_user_has_list AS user_list ON user.id = user_list.user_id';
349 352 $requestSub .= ' WHERE user.active = 1 AND user_list.list_id IN ('.implode(', ', $listIds).')'.$statusCondition;
350 353
351 - if (!empty($orderBy)) {
352 - if (empty($orderBySort)) $orderBySort = 'desc';
353 - $requestSub .= ' ORDER BY '.acym_secureDBColumn($orderBy).' '.acym_secureDBColumn($orderBySort);
354 + $orderByColumn = empty($orderBy) ? 'user.id' : acym_secureDBColumn($orderBy);
355 + $requestSub .= ' ORDER BY '.$orderByColumn.' '.$orderBySort;
356 +
357 + // Any other column can hold duplicates, we need a unique one to break the ties
358 + if (!in_array($orderByColumn, ['id', 'user.id'], true)) {
359 + $requestSub .= ', user.id ASC';
354 360 }
355 361
356 362 return acym_loadObjectList(
357 363 $requestSub,
@@ -868,8 +874,11 @@
868 874 if (!in_array($column, $columnsList)) {
869 875 return false;
870 876 }
871 877
878 + acym_arrayToInteger($listIds);
879 + $listIds = array_filter($listIds);
880 +
872 881 if (!$this->removeWelcomeUnsubByMailId($mailId, $listIds, $column)) {
873 882 return false;
874 883 }
875 884
@@ -875,9 +884,9 @@
875 884
876 885 foreach ($listIds as $listId) {
877 886 $list = $this->getOneById($listId);
878 887 if (empty($list)) {
879 - return false;
888 + continue;
880 889 }
881 890
882 891 $list->{$column} = $mailId;
883 892