From: Vincent Vanwaelscappel Date: Tue, 30 Apr 2024 16:24:12 +0000 (+0200) Subject: wip #6889 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=718b9506d66c1600954ed03c107c9453e7cd8271;p=bastide-resah.git wip #6889 @0.5 --- diff --git a/app/Http/Controllers/CatalogController.php b/app/Http/Controllers/CatalogController.php index 6bfff96..231ce90 100644 --- a/app/Http/Controllers/CatalogController.php +++ b/app/Http/Controllers/CatalogController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers; use Cubist\Backpack\Http\Controllers\Base\XSendFileController; -use Cubist\Util\PHP; +use Illuminate\Support\Facades\Auth; class CatalogController extends Controller { @@ -19,6 +19,15 @@ class CatalogController extends Controller $cpath = $forceGuest || auth()->guard('client')->guest() ? 'fluidbooks/catalogue_invite' : 'fluidbooks/catalogue'; $relayPath = base_path($cpath) . '/' . $path; + + $user = Auth::guard('client')->user(); + if ($path === 'index.html' && $user) { + $html = file_get_contents($relayPath); + $html = str_replace('', '', $html); + return response($html)->header('Content-Type', 'text/html'); + + } + return XSendFileController::sendfileNoCache($relayPath); } diff --git a/app/Http/Controllers/LandingController.php b/app/Http/Controllers/LandingController.php index 461603d..ecbd126 100644 --- a/app/Http/Controllers/LandingController.php +++ b/app/Http/Controllers/LandingController.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Auth; class LandingController extends Controller { - use ForgotPassword; + use ForgotPassword; public function catchall($path = '') { @@ -22,7 +22,7 @@ class LandingController extends Controller $relayPath = resource_path('webflow') . '/' . $path; if (str_ends_with($path, '.html')) { $html = file_get_contents($relayPath); - $html = str_replace('', '', $html); + $html = str_replace('', '' . self::matomoTag() . '', $html); $user = Auth::guard('client')->user(); if ($user) { $html = str_replace('Prénom Nom', $user->firstname . ' ' . $user->name, $html); @@ -33,6 +33,33 @@ class LandingController extends Controller return XSendFileController::sendfile($relayPath); } + public static function matomoTag() + { + $guard = Auth::guard('client'); + + $user = ''; + if (!$guard->guest()) { + $user = "_paq.push(['setUserId', '" . $guard->user()->email . "']);"; + } + + return " + +"; + } + public function login() { $request = request();