From 676f6a8462e6139d11a01bab2a86820a0f3abbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 1 Oct 2019 12:45:18 +0200 Subject: [PATCH 1/4] Make custom redirects domain based --- .../ep_track/Classes/Hook/ItemsProcFunc.php | 26 +++++++++++++++++++ .../Classes/Middleware/TrackingMiddleware.php | 5 ++++ .../TCA/tx_eptrack_domain_model_redirect.php | 11 +++++++- public/typo3conf/ext/ep_track/ext_tables.sql | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php 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, From a4eec57fc86ae43cb1bc39a5a7519cb492c03cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 1 Oct 2019 13:18:17 +0200 Subject: [PATCH 2/4] Fix duplicate translation strings --- .../ep_events/Resources/Private/Language/de.locallang.xlf | 5 +---- .../ext/ep_events/Resources/Private/Language/locallang.xlf | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/public/typo3conf/ext/ep_events/Resources/Private/Language/de.locallang.xlf b/public/typo3conf/ext/ep_events/Resources/Private/Language/de.locallang.xlf index e106ba82..09f944c5 100644 --- a/public/typo3conf/ext/ep_events/Resources/Private/Language/de.locallang.xlf +++ b/public/typo3conf/ext/ep_events/Resources/Private/Language/de.locallang.xlf @@ -122,7 +122,7 @@ Programmidee - angebote]]> + angebot]]> Zurück zur Programm-Übersicht @@ -241,9 +241,6 @@ Bitte geben Sie einen Suchbegriff mit mindestens drei Buchstaben Länge ein. - - Beispielangebot - Mehr erfahren diff --git a/public/typo3conf/ext/ep_events/Resources/Private/Language/locallang.xlf b/public/typo3conf/ext/ep_events/Resources/Private/Language/locallang.xlf index 491b8a49..d160323e 100644 --- a/public/typo3conf/ext/ep_events/Resources/Private/Language/locallang.xlf +++ b/public/typo3conf/ext/ep_events/Resources/Private/Language/locallang.xlf @@ -122,7 +122,7 @@ Program ideas - offers]]> + offer]]> Return to program overview @@ -241,9 +241,6 @@ Please enter a search term of at least three letters. - - Example offer - More information From ebd84e0fe5085016a2c181a10eabe4df595427e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 1 Oct 2019 13:18:34 +0200 Subject: [PATCH 3/4] Fix line breaks not being exploded --- .../ep_events/Resources/Private/Partials/HerounitActivity.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_events/Resources/Private/Partials/HerounitActivity.html b/public/typo3conf/ext/ep_events/Resources/Private/Partials/HerounitActivity.html index 2825d2e8..8064b8a2 100644 --- a/public/typo3conf/ext/ep_events/Resources/Private/Partials/HerounitActivity.html +++ b/public/typo3conf/ext/ep_events/Resources/Private/Partials/HerounitActivity.html @@ -31,7 +31,7 @@
    - +
  • {keyword}
From 9767a7e97aec790b601c24fda52ea3386ddd4f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 1 Oct 2019 13:25:49 +0200 Subject: [PATCH 4/4] Fix database field type not matching data --- public/typo3conf/ext/ep_products/ext_tables.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 0a780714..d29aaf2b 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -1029,8 +1029,7 @@ CREATE TABLE tx_epproducts_domain_model_badge title varchar(255) DEFAULT '' NOT NULL, subtitle varchar(255) DEFAULT '' NOT NULL, - link int(11) unsigned NOT NULL default '0', - page int(11) unsigned DEFAULT '0', + link varchar(255) DEFAULT '' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL,