diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 0995744..b27727f 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -30,7 +30,7 @@ public function getNumberOfReceivers(Filter $filter): int . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' . ' where l.deleted=0 and l.status=' . Log::STATUS_DISPATCH - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() . ' limit 1'; return (int)$connection->executeQuery($sql)->fetchOne(); @@ -57,7 +57,7 @@ public function getGroupedLinksByHref(Filter $filter): array . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' . ' where l.deleted=0 and l.status=' . Log::STATUS_LINKOPENING - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() . ' group by l.properties, l.newsletter' . ' order by count desc' @@ -79,13 +79,13 @@ public function getGroupedLinksByHref(Filter $filter): array public function getOverallOpenings(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(distinct newsletter, user)' + $sql = 'select count(distinct (newsletter, user))' . ' from ' . Log::TABLE_NAME . ' l' . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' . ' where l.deleted = 0' . ' and l.status IN (' . Log::STATUS_NEWSLETTEROPENING . ',' . Log::STATUS_LINKOPENING . ')' - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -98,12 +98,12 @@ public function getOverallOpenings(Filter $filter): int public function getOpeningsByClickers(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(distinct newsletter, user)' + $sql = 'select count(distinct (newsletter, user))' . ' from ' . Log::TABLE_NAME . ' l' . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' . ' where l.deleted = 0 and l.status=' . Log::STATUS_LINKOPENING - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -152,7 +152,7 @@ protected function getOverallAmountByLogStatus(array $status, Filter $filter): i . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' . ' where l.deleted = 0 and l.status in (' . ArrayUtility::convertArrayToIntegerList($status) . ')' - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -275,7 +275,7 @@ public function isLogRecordExisting(int $newsletterIdentifier, int $userIdentifi $uid = (int)$queryBuilder ->select('uid') ->from(Log::TABLE_NAME) - ->where('newsletter=' . $newsletterIdentifier . ' and user=' . $userIdentifier . ' and status=' . $status) + ->where('newsletter=' . (int)$newsletterIdentifier . " and user='" . (int)$userIdentifier . "' and status='" . (int)$status . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne(); @@ -294,11 +294,11 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); $sqlSelectColumns = '*'; if ($distinctMails === true) { - $sqlSelectColumns = 'distinct newsletter, user'; + $sqlSelectColumns = 'distinct (newsletter, user)'; } return $connection->executeQuery( 'select ' . $sqlSelectColumns . ' from ' . Log::TABLE_NAME . - ' where deleted=0 and status in (' . implode(',', $status) . ') and newsletter=' . $newsletter->getUid() + ' where deleted=0 and status in (' . implode(',', $status) . ') and newsletter=' . (int)$newsletter->getUid() )->fetchAllAssociative(); } @@ -312,7 +312,7 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, public function findRawByUser(User $user, array $statusWhitelist = [], array $statusBlacklist = []): array { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select * from ' . Log::TABLE_NAME . ' where deleted=0 and user=' . $user->getUid(); + $sql = 'select * from ' . Log::TABLE_NAME . " where deleted=0 and user='" . (int)$user->getUid() . "'"; if ($statusWhitelist !== []) { $sql .= ' and status in (' . implode(',', $statusWhitelist) . ')'; } elseif ($statusBlacklist !== []) { diff --git a/Classes/Domain/Repository/QueueRepository.php b/Classes/Domain/Repository/QueueRepository.php index 2d4e2db..0ee20a7 100644 --- a/Classes/Domain/Repository/QueueRepository.php +++ b/Classes/Domain/Repository/QueueRepository.php @@ -94,7 +94,7 @@ public function isUserAndNewsletterAlreadyAddedToQueue(User $user, Newsletter $n return (int)$queryBuilder ->select('uid') ->from(Queue::TABLE_NAME) - ->where('newsletter=' . $newsletter->getUid() . ' and user=' . $user->getUid()) + ->where('newsletter=' . (int)$newsletter->getUid() . " and user='" . (int)$user->getUid() . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne() > 0; diff --git a/Classes/Domain/Repository/UserRepository.php b/Classes/Domain/Repository/UserRepository.php index 176ecdf..288dd63 100644 --- a/Classes/Domain/Repository/UserRepository.php +++ b/Classes/Domain/Repository/UserRepository.php @@ -94,9 +94,9 @@ public function getUserAmountFromGroups(array $groupIdentifiers): int if ($sub !== '') { $sub .= ' or '; } - $sub .= 'find_in_set(' . (int)$identifier . ',usergroup)'; + $sub = "((',' || usergroup || ',') LIKE '%," . (int)$identifier . ",%')"; } - $sql .= ' where deleted=0 and disable=0 and email like "%@%" and (' . $sub . ')'; + $sql .= " where deleted=0 and disable=0 and email like '%@%' and (" . $sub . ')'; return (int)$connection->executeQuery($sql)->fetchOne(); } return 0; diff --git a/ext_emconf.php b/ext_emconf.php index 15470c4..9d6474f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,14 +11,14 @@ 'state' => 'stable', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.0-13.4.99' + 'typo3' => '12.4.0-13.4.99', ], 'conflicts' => [ - 'news' => '9.0.0-10.99.99' + 'news' => '9.0.0-10.99.99', ], 'suggests' => [ 'lux' => '0.0.0-0.0.0', - 'dashboard' => '0.0.0-0.0.0' - ] - ] + 'dashboard' => '0.0.0-0.0.0', + ], + ], ];