Source of file SecureTrackingController.php
Size: 0,698 Bytes - Last Modified: 2021-12-23T10:26:51+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/SecureTrackingController.php
123456789101112131415161718192021222324 | <?php /** * @author marcus */ class SecureTrackingController extends Extension { public function onBeforeSendFile($file) { // check to make sure this is the actual file and not just a rendition... if that matters? $downloadRecord = new FileDownloadRecord(); // store the full filename for now $url = array_key_exists('url', $_GET) ? $_GET['url'] : $_SERVER['REQUEST_URI']; // check if it's a resampled file if (strpos($url, '_resampled') !== false) { // ignore it return; } $file_path = Director::makeRelative($url); $downloadRecord->Filename = $file_path ? $file_path : $file->getFilename(); $downloadRecord->FileID = $file->ID; $downloadRecord->write(); } } |