From fc48c83ccd961ce7a80cfb5911094a98076fbd76 Mon Sep 17 00:00:00 2001 From: Florin-Ciprian Bodin Date: Tue, 31 Oct 2023 18:32:54 +0200 Subject: [PATCH] Update FileItem.php --- classes/FileItem.php | 103 +++++++++++++++++++++++++++---------------- 1 file changed, 65 insertions(+), 38 deletions(-) diff --git a/classes/FileItem.php b/classes/FileItem.php index e9c8fc9..af3a3b3 100644 --- a/classes/FileItem.php +++ b/classes/FileItem.php @@ -3,7 +3,7 @@ /** * @package AutoIndex * - * @copyright Copyright (C) 2002-2004 Justin Hagstrom + * @copyright Copyright (C) 2002-2004 Justin Hagstrom, 2019-2023 Florin C. Bodin aka OryNider * @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL) * * @link http://autoindex.sourceforge.net @@ -67,43 +67,43 @@ class FileItem extends Item parent::__construct($parent_dir, $filename); if (!is_file($this -> parent_dir . $filename)) { - throw new ExceptionDisplay('File ' . Url::html_output($this -> parent_dir . $filename) . ' does not exist.'); + throw new ExceptionDisplay('File ' . Url::html_output($this->parent_dir . $filename) . ' does not exist.'); } global $config, $words, $downloads; - $this -> filename = $filename; - $this -> size = new Size(filesize($this -> parent_dir . $filename)); + $this->filename = $filename; + $this->size = new Size(filesize($this->parent_dir . $filename)); if (ICON_PATH) { $file_icon = new Icon($filename); - $this -> icon = $file_icon -> __toString(); + $this -> icon = $file_icon->__toString(); } - $this -> downloads = (DOWNLOAD_COUNT && $downloads -> is_set($parent_dir . $filename) ? (int)($downloads -> __get($parent_dir . $filename)) : 0); - $this -> link = Url::html_output($_SERVER['PHP_SELF']) . '?dir=' . Url::translate_uri(substr($this -> parent_dir, strlen($config -> __get('base_dir')))) . '&file=' . Url::translate_uri($filename); + $this->downloads = (DOWNLOAD_COUNT && $downloads -> is_set($parent_dir . $filename) ? (int)($downloads -> __get($parent_dir . $filename)) : 0); + $this->link = Url::html_output($_SERVER['PHP_SELF']) . '?dir=' . Url::translate_uri(substr($this->parent_dir, strlen($config->__get('base_dir')))) . '&file=' . Url::translate_uri($filename); if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('png', 'jpg', 'jpeg', 'jfif', 'gif', 'bmp'))) { - $this -> thumb_link = ' thumb_link = ' ' . $words -> __get('thumbnail of') . ' ' . $filename . ''; - $this -> thumb_link .= ' ' . $words -> __get('view') . ' ' . $words -> __get('file') . ''; + . ' >' . $words -> __get('view') . ' ' . $words->__get('file') . ''; } elseif (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('thm', 'thm'))) { - $this -> thumb_link = ' thumb_link = ' ' . $words -> __get('thumbnail of') . ' ' . $filename . ''; $this -> thumb_link .= ' ' . $words -> __get('view') . ' ' . $words -> __get('file') . ''; + . ' >' . $words -> __get('view') . ' ' . $words->__get('file') . ''; } - if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('avi', 'divx', 'mkv', 'asf', 'mov', 'wmv', '3gp', 'mp3', 'mp4', 'mpv', 'ogg', 'ogv','mpg', 'mpeg'))) + if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('avi', 'divx', 'xvid', 'mkv', 'asf', 'mov', 'wmv', '3gp', 'mp3', 'mp4', 'mpv', 'ogg', 'ogv','mpg', 'mpeg', 'flv', 'FLV', 'flvjs'))) { $mime = new MimeType($filename); $finfo = finfo_open(FILEINFO_MIME_TYPE); @@ -113,36 +113,35 @@ class FileItem extends Item $file_mime = function_exists('getvideosize') ? $file_size['mime'] : $mime -> __toString(); $this -> thumb_link = ''; - if (function_exists('imagecreatefromavi') && in_array(self::ext($filename), array('avi', 'divx', 'mkv', 'asf', 'mov', 'wmv', '3gp', 'mp4', 'mpv', 'ogv','mpg', 'mpeg'))) + if (function_exists('imagecreatefromavi') && in_array(self::ext($filename), array('avi', 'divx', 'xvid'))) { - $this -> thumb_link .= '