1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Filter social network tracking queries when determining SEF route.

This commit is contained in:
Cameron
2019-01-23 14:21:59 -08:00
parent f387fa149f
commit 9237f254c7

View File

@@ -524,7 +524,7 @@ class eFront
if(!empty($status[0]) && ($status[0] === '{')) if(!empty($status[0]) && ($status[0] === '{'))
{ {
$status = e107::getParser()->replaceConstants($status); $status = e107::getParser()->replaceConstants($status);
} }
self::$_legacy = $status; self::$_legacy = $status;
} }
return self::$_legacy; return self::$_legacy;
@@ -1027,6 +1027,9 @@ class eRouter
* @var string * @var string
*/ */
public $notFoundUrl = 'system/error/404?type=routeError'; public $notFoundUrl = 'system/error/404?type=routeError';
protected $_trackers = array('fbclid','utm_source','utm_medium','utm_content','utm_campaign');
public function __construct() public function __construct()
{ {
@@ -1085,6 +1088,12 @@ class eRouter
{ {
return $this->_urlFormat; return $this->_urlFormat;
} }
public function getTrackers()
{
return $this->_trackers;
}
/** /**
* Load config and url rules, if not available - build it on the fly * Load config and url rules, if not available - build it on the fly
@@ -1792,9 +1801,23 @@ class eRouter
$rawPathInfo = rawurldecode($request->getPathInfo()); $rawPathInfo = rawurldecode($request->getPathInfo());
//$this->_urlFormat = self::FORMAT_PATH; //$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 // 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 // front page settings will be detected and front page will be rendered
$request->setRoute('index/index/index'); $request->setRoute('index/index/index');