Source of file TrackLinkController.php
Size: 0,968 Bytes - Last Modified: 2021-12-23T10:33:22+00:00
/var/www/docs.ssmods.com/process/src/src/Control/TrackLinkController.php
123456789101112131415161718192021222324252627282930313233343536 | <?php namespace SilverStripe\Newsletter\Control; use SilverStripe\Control\Cookie; use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\Newsletter\Model\NewsletterTrackedLink; class TrackLinkController extends ContentController { public function init() { parent::init(); if ($params = $this->getURLParams()) { if (isset($params['Hash'])) { $link = NewsletterTrackedLink::get()->filter("Hash", $hash); if ($link) { // check for them visiting this link before if (!Cookie::get('ss-newsletter-link-'.$hash)) { $link->Visits++; $link->write(); Cookie::set('ss-newsletter-link-'. $hash, true); } return $this->redirect($link->Original, 301); } } } return $this->httpError(404); } } |