From 9237f254c78d6e5e36cd7ffff444cc92ffd6f802 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 23 Jan 2019 14:21:59 -0800 Subject: [PATCH] Filter social network tracking queries when determining SEF route. --- e107_handlers/application.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 4b80f1f5f..654dada4a 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -524,7 +524,7 @@ class eFront if(!empty($status[0]) && ($status[0] === '{')) { $status = e107::getParser()->replaceConstants($status); - } + } self::$_legacy = $status; } return self::$_legacy; @@ -1027,6 +1027,9 @@ class eRouter * @var string */ public $notFoundUrl = 'system/error/404?type=routeError'; + + protected $_trackers = array('fbclid','utm_source','utm_medium','utm_content','utm_campaign'); + public function __construct() { @@ -1085,6 +1088,12 @@ class eRouter { return $this->_urlFormat; } + + + public function getTrackers() + { + return $this->_trackers; + } /** * Load config and url rules, if not available - build it on the fly @@ -1792,9 +1801,23 @@ class eRouter $rawPathInfo = rawurldecode($request->getPathInfo()); //$this->_urlFormat = self::FORMAT_PATH; } - + + + + // Ignore social trackers when determining route. + $get = $_GET; + $trackers = $this->getTrackers(); + + foreach($trackers as $val) + { + if(isset($get[$val])) + { + unset($get[$val]); + } + } + // Route to front page - index/index/index route - if(!$rawPathInfo && (!$this->getMainModule() || empty($_GET))) + if(!$rawPathInfo && (!$this->getMainModule() || empty($get))) { // front page settings will be detected and front page will be rendered $request->setRoute('index/index/index');