diff --git a/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php b/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php new file mode 100644 index 00000000..03076c3a --- /dev/null +++ b/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php @@ -0,0 +1,26 @@ +getAllSites() as $site) { + /** @var Site $site */ + $domains[] = [$site->getBase()->getHost(), $site->getBase()->getHost()]; + } + $config['items'] = $domains; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php b/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php index 9221796b..a2502cfe 100644 --- a/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php +++ b/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php @@ -76,6 +76,7 @@ class TrackingMiddleware implements MiddlewareInterface { /** @var NormalizedParams $params */ $params = $request->getAttribute('normalizedParams'); + $sourceHost = $params->getHttpHost(); $uri = strtok(strtolower($params->getRequestUri()), '?'); if (substr($uri, -1) !== '/') { @@ -88,6 +89,10 @@ class TrackingMiddleware implements MiddlewareInterface ->select('*') ->from('tx_eptrack_domain_model_redirect') ->where('redirect_from = LOWER(:uri)') + ->andWhere($qb->expr()->orX( + $qb->expr()->eq('source_host', $qb->createNamedParameter('*')), + $qb->expr()->eq('source_host', $qb->createNamedParameter($sourceHost)) + )) ->andWhere('deleted = 0') ->andWhere('hidden = 0') ->setParameter('uri', $uri) diff --git a/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php b/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php index b1925173..61732d16 100644 --- a/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php +++ b/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php @@ -28,7 +28,8 @@ return [ ], 'types' => [ '1' => [ - 'showitem' => 'hidden, label, redirect_from, target_page_uid, --palette--;;codes, --palette--;UTM;utm', + 'showitem' => 'hidden, label, source_host, redirect_from, target_page_uid, --palette--;;codes, + --palette--;UTM;utm', ], ], 'palettes' => [ @@ -129,6 +130,14 @@ return [ ], ], + 'source_host' => [ + 'label' => 'Domain', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'itemsProcFunc' => \EP\EpTrack\Hook\ItemsProcFunc::class.'->user_domainItems', + ], + ], 'label' => [ 'exclude' => 0, 'label' => 'LLL:EXT:ep_track/Resources/Private/Language/locallang.xlf:tx_eptrack_domain_model_redirect.label', diff --git a/public/typo3conf/ext/ep_track/ext_tables.sql b/public/typo3conf/ext/ep_track/ext_tables.sql index 35a4a6cb..e47873eb 100644 --- a/public/typo3conf/ext/ep_track/ext_tables.sql +++ b/public/typo3conf/ext/ep_track/ext_tables.sql @@ -8,6 +8,7 @@ CREATE TABLE tx_eptrack_domain_model_redirect ( pid int(11) DEFAULT '0' NOT NULL, label varchar(255) DEFAULT '' NOT NULL, + source_host varchar(255) DEFAULT '' NOT NULL, redirect_from varchar(255) DEFAULT '' NOT NULL, target_page_uid varchar(255) DEFAULT '' NOT NULL, tracking_code varchar(255) DEFAULT '' NOT NULL,