private function checkDownloads()
    {
        // If images are to be shown, get out.
        if ($this->getShowImages()) {
            return;
        }
        if (($file = Input::get('file')) && ($key = Input::get('fileKey'))) {
            // Check key and return 403 if mismatch.
            if (!(array_key_exists($file, $_SESSION['metaModels_downloads'])
                && $_SESSION['metaModels_downloads'][$file] === $key)) {
                $objHandler = new $GLOBALS['TL_PTY']['error_403']();
                /** @var PageError403 $objHandler */
                $objHandler->generate($file);
            }
            // Send the file to the browser if check succeeded.
            Controller::sendFileToBrowser($file);
        }
    }
private function checkDownloads()
    {
        // If images are to be shown, get out.
        if ($this->getShowImages()) {
            return;
        }
        if (($file = Input::get('file')) && ($key = Input::get('fileKey'))) {
            // Check key and return 403 if mismatch.
            if (!(array_key_exists($file, $_SESSION['metaModels_downloads'])
                && $_SESSION['metaModels_downloads'][$file] === $key)) {
                $objHandler = new $GLOBALS['TL_PTY']['error_403']();
                /** @var PageError403 $objHandler */
                $objHandler->generate($file);
            }
            // Send the file to the browser if check succeeded.
            Controller::sendFileToBrowser($file);
        }
    }
private function checkDownloads ( ) { // If images are to be shown, get out. if ( $ this -> getShowImages ( ) ) { return ; } if ( ( $ file = Input :: get ( 'file' ) ) && ( $ key = Input :: get ( 'fileKey' ) ) ) { // Check key and return 403 if mismatch. if ( ! ( array_key_exists ( $ file , $ _SESSION [ 'metaModels_downloads' ] ) && $ _SESSION [ 'metaModels_downloads' ] [ $ file ] === $ key ) ) { $ objHandler = new $ GLOBALS [ 'TL_PTY' ] [ 'error_403' ] ( ) ; /** @var PageError403 $objHandler */ $ objHandler -> generate ( $ file ) ; } // Send the file to the browser if check succeeded. Controller :: sendFileToBrowser ( $ file ) ; } }
Check if a file download is desired.

See https://github.com/MetaModels/attribute_file/issues/6
See https://github.com/MetaModels/core/issues/1014

@return void

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Check if a file download is desired .