Skip to content

Commit

Permalink
Version 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bihor committed Mar 25, 2024
1 parent 60bc492 commit 866739d
Show file tree
Hide file tree
Showing 35 changed files with 241 additions and 253 deletions.
10 changes: 5 additions & 5 deletions Classes/Backend/EventListener/PreviewEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ final class PreviewEventListener
*
* @var string
*/
const KEY = 'fpnewsletter';
public const KEY = 'fpnewsletter';

/**
* Path to the locallang file
*
* @var string
*/
const LLPATH = 'LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:';
public const LLPATH = 'LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:';

/**
* Max shown settings
*/
const SETTINGS_IN_PREVIEW = 10;
public const SETTINGS_IN_PREVIEW = 10;

protected $recordMapping = [
'subscribeUid' => [
Expand Down Expand Up @@ -117,8 +117,8 @@ public function __invoke(PageContentPreviewRenderingEvent $event): void
}

if ($event->getRecord()['CType'] === 'list' && in_array($event->getRecord()['list_type'], $this->pis)) {
$pi = substr($event->getRecord()['list_type'], strpos($event->getRecord()['list_type'], '_')+1);
$header = '<strong>' . htmlspecialchars($this->getLanguageService()->sL(self::LLPATH . 'template.' . $pi)) . '</strong>';
$pi = substr((string) $event->getRecord()['list_type'], strpos((string) $event->getRecord()['list_type'], '_')+1);
$header = '<strong>' . htmlspecialchars((string) $this->getLanguageService()->sL(self::LLPATH . 'template.' . $pi)) . '</strong>';
$this->flexformData = GeneralUtility::xml2array($event->getRecord()['pi_flexform']);

$this->getStartingPoint($event->getRecord()['pages']);
Expand Down
17 changes: 10 additions & 7 deletions Classes/Command/ImportFEUsersScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
declare(strict_types = 1);
namespace Fixpunkt\FpNewsletter\Command;

use TYPO3\CMS\Core\Crypto\Random;
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
use TYPO3\CMS\Core\Database\ConnectionPool;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -55,15 +58,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$group = intval($input->getArgument('group'));
$password = $input->getArgument('password');
if ($password == 'random') {
$password = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Crypto\Random::class)->generateRandomBytes(20);
$password = GeneralUtility::makeInstance(Random::class)->generateRandomBytes(20);
}
$hashInstance = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::class)->getDefaultHashInstance('FE');
$hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance('FE');
$hashedPassword = $hashInstance->getHashedPassword($password);
$addresses = [];
$count = 0;

// Alle tt_address-Elemente holen
$connection = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('tt_address');
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_address');
$queryBuilder = $connection->createQueryBuilder();
if ($pid) {
$statement = $queryBuilder->select('*')->from('tt_address')->where(
Expand All @@ -83,17 +86,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$affectedRows = $queryBuilder
->insert('fe_users')
->values([
'name' => (($address['name']) ? trim($address['name']) : ''),
'first_name' => (($address['first_name']) ? trim($address['first_name']) : ''),
'last_name' => (($address['last_name']) ? trim($address['last_name']) : ''),
'name' => (($address['name']) ? trim((string) $address['name']) : ''),
'first_name' => (($address['first_name']) ? trim((string) $address['first_name']) : ''),
'last_name' => (($address['last_name']) ? trim((string) $address['last_name']) : ''),
'email' => $address['email'],
'username' => $address['email'],
'password' => $hashedPassword,
'usergroup' => $group,
'description' => 'Imported by fp_newsletter',
'pid' => $pid,
'tstamp' => $address['tstamp'],
'crdate' => (($address['crdate']) ? $address['crdate'] : $address['tstamp'])
'crdate' => ($address['crdate'] ?: $address['tstamp'])
])
->executeStatement();
$count++;
Expand Down
Loading

0 comments on commit 866739d

Please sign in to comment.