/**
* Return if there are no files
* @return string
*/
public function generate()
{
// Use the home directory of the current user as file source
if ($this->useHomeDir && FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
if ($this->User->assignDir && $this->User->homeDir) {
$this->folderSRC = $this->User->homeDir;
}
}
// Return if there is no folder defined
if (empty($this->folderSRC)) {
return '';
}
// Get the folders from the database
$this->objFolder = \FilesModel::findByUuid($this->folderSRC);
if ($this->objFolder === null) {
if (!\Validator::isUuid($this->folderSRC[0])) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser and do not send a 404 header (see #4632)
if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
if (strpos(dirname($file), $this->objFolder->path) !== FALSE) {
\Controller::sendFileToBrowser($file);
}
}
return parent::generate();
}