id?> class="title">
title;
if(strpos($file->title, ".{$file->extension}") === false && $file->extension != 'txt') $fileTitle .= ".{$file->extension}";
$fileName = substr($fileTitle, 0, strrpos($fileTitle, '.', 0));
echo $fileName;
?>
file->uploadDate . substr($file->addedDate, 0, 10);
$imageWidth = 0;
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
{
$imageSize = $this->loadModel('file')->getImageSize($file);
$imageWidth = $imageSize[0];
}
$fileSize = 0;
/* Show size info. */
if($file->size < 1024)
{
$fileSize = $file->size . 'B';
}
elseif($file->size < 1024 * 1024)
{
$file->size = round($file->size / 1024, 2);
$fileSize = $file->size . 'K';
}
elseif($file->size < 1024 * 1024 * 1024)
{
$file->size = round($file->size / (1024 * 1024), 2);
$fileSize = $file->size . 'M';
}
else
{
$file->size = round($file->size / (1024 * 1024 * 1024), 2);
$fileSize = $file->size . 'G';
}
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id");
$previewLink = $this->createLink('file', 'preview', "fileID=$file->id");
$objectType = zget($this->config->file->objectType, $file->objectType);
if(common::hasPriv($objectType, 'view', $object))
{
echo "
";
/* Determines whether the file supports preview. */
if($file->extension == 'txt')
{
$extension = 'txt';
if(($postion = strrpos($file->title, '.')) !== false) $extension = substr($file->title, $postion + 1);
if($extension != 'txt') $mode = 'down';
$file->extension = $extension;
}
/* For the open source version of the file judgment. */
if(stripos('txt|jpg|jpeg|gif|png|bmp', $file->extension) !== false and common::hasPriv('file', 'preview'))
{
echo html::a($previewLink, "", '_blank', "class='fileAction btn btn-link text-primary' title='{$lang->file->preview}' onclick=\"return downloadFile($file->id, '$file->extension', $imageWidth, '$file->title', 'preview')\"");
}
/* For the max version of the file judgment. */
if(isset($this->config->file->libreOfficeTurnon) and $this->config->file->libreOfficeTurnon == 1 and !($this->config->file->convertType == 'collabora' and $this->config->requestType == 'GET') and common::hasPriv('file', 'preview'))
{
$officeTypes = 'doc|docx|xls|xlsx|ppt|pptx|pdf';
if(stripos($officeTypes, $file->extension) !== false)
{
echo html::a($previewLink, "", '_blank', "class='fileAction btn btn-link text-primary' title='{$lang->file->preview}' onclick=\"return downloadFile($file->id, '$file->extension', $imageWidth, '$file->title', 'preview')\"");
}
}
if(common::hasPriv($objectType, 'edit', $object))
{
if($showEdit and common::hasPriv('file', 'edit')) echo html::a('###', "", '', "id='renameFile$file->id' class='fileAction btn btn-link edit text-primary' onclick='showRenameBox($file->id)' title='{$lang->file->edit}'");
}
common::printLink('file', 'download', "fileID=$file->id", "", '_blank', "class='fileAction btn btn-link text-primary' title='{$lang->file->downloadFile}'");
if(common::hasPriv($objectType, 'edit', $object))
{
if($showDelete and common::hasPriv('file', 'delete')) echo html::a('###', "", '', "class='fileAction btn btn-link text-primary' onclick='deleteFile($file->id, this)' title='$lang->delete'");
}
echo '';
}
?>
title, '.') !== false)
{
/* Fix the file name exe.exe */
$title = explode('.', $file->title);
$extension = end($title);
if($file->extension == 'txt' && $extension != $file->extension) $file->extension = $extension;
array_pop($title);
$file->title = join('.', $title);
}
?>