diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-10-02 03:20:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-02 03:20:20 +0300 |
commit | 2807e94baaa9b545f27a55a7dd071ba187799491 (patch) | |
tree | 9fa5722fe414e7f1e664d4226b2620d215fd1987 /core/Tracker/Request.php | |
parent | 06d43857c48ada2fa7f1ad18a8309e8826c0e413 (diff) |
JS Offline tracking (#15970)
* JS Offline tracking
* minor tweaks
* add some tests
* add some tests
* apply review feedback
Diffstat (limited to 'core/Tracker/Request.php')
-rw-r--r-- | core/Tracker/Request.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index 93d64d0781..0d6c449ab7 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -398,6 +398,7 @@ class Request // some visitor attributes can be overwritten 'cip' => array('', 'string'), 'cdt' => array('', 'string'), + 'cdo' => array('', 'int'), 'cid' => array('', 'string'), 'uid' => array('', 'string'), @@ -484,11 +485,16 @@ class Request protected function getCustomTimestamp() { - if (!$this->hasParam('cdt')) { + if (!$this->hasParam('cdt') && !$this->hasParam('cdo')) { return false; } $cdt = $this->getParam('cdt'); + $cdo = $this->getParam('cdo'); + + if (empty($cdt) && $cdo) { + $cdt = $this->timestamp; + } if (empty($cdt)) { return false; @@ -498,6 +504,10 @@ class Request $cdt = strtotime($cdt); } + if (!empty($cdo)) { + $cdt = $cdt - abs($cdo); + } + if (!$this->isTimestampValid($cdt, $this->timestamp)) { Common::printDebug(sprintf("Datetime %s is not valid", date("Y-m-d H:i:m", $cdt))); return false; |