public function prepareFile($varUuid)
 {
     if (($objFile = Files::getFileFromUuid($varUuid, true)) !== null && $objFile->exists()) {
         static::addAllowedDownload($objFile->value);
         $arrReturn = array('name' => StringUtil::preg_replace_last('@_[a-f0-9]{13}@', $objFile->name), 'uuid' => \StringUtil::binToUuid($objFile->getModel()->uuid), 'size' => $objFile->filesize);
         if (($strImage = $this->getPreviewImage($objFile)) !== null) {
             $arrReturn['url'] = $strImage;
         }
         if (($strInfoUrl = $this->getInfoAction($objFile)) !== null) {
             $arrReturn['info'] = $strInfoUrl;
         }
         return $arrReturn;
     }
     return false;
 }
 /**
  * Handle downloads
  * @return bool return true, or false if the file does not exist
  */
 protected function handleDownload()
 {
     $objFile = \HeimrichHannot\Haste\Util\Files::getFileFromUuid($this->fileSRC);
     if ($objFile === null) {
         return false;
     }
     $allowedDownload = trimsplit(',', strtolower(\Config::get('allowedDownload')));
     // Return if the file type is not allowed
     if (!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\\.txt$/', $objFile->basename)) {
         return false;
     }
     $arrMeta = $this->getMetaFromFile($objFile);
     $file = \Input::get('file', true);
     // Send the file to the browser and do not send a 404 header (see #4632)
     if ($file != '' && $file == $objFile->path) {
         \Controller::sendFileToBrowser($file);
     }
     $this->setHref(\Environment::get('request'));
     // Remove an existing file parameter (see #5683)
     if (preg_match('/(&(amp;)?|\\?)file=/', $this->getHref())) {
         $this->setHref(preg_replace('/(&(amp;)?|\\?)file=[^&]+/', '', $this->getHref()));
     }
     $this->setHref($this->getHref() . (\Config::get('disableAlias') || strpos($this->getHref(), '?') !== false ? '&' : '?') . 'file=' . \System::urlEncode($objFile->path));
     $this->setTitle(sprintf($GLOBALS['TL_LANG']['MSC']['linkteaser']['downloadTitle'], $arrMeta['title']));
     $this->setLink(sprintf($this->getLink(), $arrMeta['title']));
     return true;
 }
 public function deleteScheduledFiles($arrScheduledFiles)
 {
     $arrFiles = array();
     if (empty($arrScheduledFiles)) {
         return $arrFiles;
     }
     foreach ($arrScheduledFiles as $strUuid) {
         if (($objFile = Files::getFileFromUuid($strUuid, true)) !== null && $objFile->exists()) {
             if ($objFile->delete() === true) {
                 $arrFiles[] = $strUuid;
             }
         }
     }
 }