diff --git a/classes/FileItem.php b/classes/FileItem.php
index 6375051..17f73c5 100644
--- a/classes/FileItem.php
+++ b/classes/FileItem.php
@@ -4,7 +4,7 @@
*
* @copyright Copyright (C) 2002-2004 Justin Hagstrom, 2019-2023 Florin C Bodin aka orynider at github.com
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
- *
+ * @version $Id: FileItem.php, v 2.2.6 2023/11/15 08:08:08 orynider Exp $
* @link http://autoindex.sourceforge.net
*/
@@ -82,42 +82,42 @@ class FileItem extends Item
public function __construct($parent_dir, $filename)
{
parent::__construct($parent_dir, $filename);
- if (!is_file($this -> parent_dir . $filename))
+ if (!is_file($this->parent_dir . $filename))
{
throw new ExceptionDisplay('File ' . Url::html_output($this->parent_dir . $filename) . ' does not exist.');
}
- global $config, $words, $downloads;
+ global $config, $words, $downloads, $request;
$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($request->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 = '
server('PHP_SELF'))
. '?thumbnail='. Url::translate_uri($this->parent_dir . $filename) . '"'
- . ' alt="' . $words -> __get('thumbnail of') . ' ' . $filename . '"'
+ . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' />';
- $this->thumb_link .= ' ' . $words -> __get('view') . ' ' . $words->__get('file') . '';
+ $this->thumb_link .= ' ' . $words->__get('view') . ' ' . $words->__get('file') . '';
}
elseif (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('thm', 'thm')))
{
- $this->thumb_link = '
server('PHP_SELF'))
. '?thm='. Url::translate_uri($this->parent_dir . $filename) . '"'
- . ' alt="' . $words -> __get('thumbnail of') . ' ' . $filename . '"'
+ . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' />';
- $this -> thumb_link .= ' ' . $words -> __get('view') . ' ' . $words->__get('file') . '';
+ $this->thumb_link .= ' ' . $words->__get('view') . ' ' . $words->__get('file') . '';
}
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')))
@@ -125,21 +125,21 @@ class FileItem extends Item
$mime = new MimeType($filename);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
//Display correct headers for media file
- $mimetype = finfo_file($finfo, $this -> parent_dir . $filename);
- $file_size = function_exists('getvideosize') ? getvideosize($this -> parent_dir . $filename) : array();
- $file_mime = function_exists('getvideosize') ? $file_size['mime'] : $mime -> __toString();
- $this -> thumb_link = '';
+ $mimetype = finfo_file($finfo, $this->parent_dir . $filename);
+ $file_size = function_exists('getvideosize') ? getvideosize($this->parent_dir . $filename) : array();
+ $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', 'xvid')))
{
$this->thumb_link .= ' Your browser does not support the video element.'
- . ''
+ . ''
. ' ';
- $this->thumb_link .= '
server('PHP_SELF'))
. '?thumbnail='. Url::translate_uri($this->parent_dir . $filename) . '"'
. ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' />';
@@ -147,8 +147,8 @@ class FileItem extends Item
}
elseif (in_array(self::ext($filename), array('avi', 'divx', 'xvid', 'mkv', 'asf', 'mov', 'wmv', '3gp', 'mp4', 'mpv', 'ogv', 'mpg', 'mpeg')))
{
- $video_href = Url::html_output($_SERVER['PHP_SELF']) . '?thm='. Url::translate_uri($this->parent_dir . $filename);
- $thumbnail = Url::html_output($_SERVER['PHP_SELF']) . '?thumbnail='. Url::translate_uri($this->parent_dir . $filename);
+ $video_href = Url::html_output($request->server('PHP_SELF')) . '?thm='. Url::translate_uri($this->parent_dir . $filename);
+ $thumbnail = Url::html_output($request->server('PHP_SELF')) . '?thumbnail='. Url::translate_uri($this->parent_dir . $filename);
$this->thumb_link .= ' '
. ''
@@ -171,12 +171,12 @@ class FileItem extends Item
';
//}
- $this -> thumb_link .= '
server('PHP_SELF'))
. '?thumbnail='. Url::translate_uri($this->parent_dir . $filename) . '"'
- . ' alt="' . $words -> __get('thumbnail of') . ' ' . $filename . '"'
+ . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' />';
- $this -> thumb_link .= ' server('PHP_SELF'))
. '?thm='. Url::translate_uri($this->parent_dir . $filename) . '"'
. ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' >' . $words->__get('view') . ' ' . $words->__get('file') . '';
@@ -184,8 +184,8 @@ class FileItem extends Item
}
elseif (in_array(self::ext($filename), array('flv', 'FLV', 'flvjs')))
{
- $video_href = Url::html_output($_SERVER['PHP_SELF']) . '?thm='. Url::translate_uri($this->parent_dir . $filename);
- $thumbnail = Url::html_output($_SERVER['PHP_SELF']) . '?thumbnail='. Url::translate_uri($this->parent_dir . $filename);
+ $video_href = Url::html_output($request->server('PHP_SELF')) . '?thm='. Url::translate_uri($this->parent_dir . $filename);
+ $thumbnail = Url::html_output($request->server('PHP_SELF')) . '?thumbnail='. Url::translate_uri($this->parent_dir . $filename);
$this->thumb_link .= '';
$this->thumb_link .='';
- $this -> thumb_link .= ' server('PHP_SELF'))
. '?thm='. Url::translate_uri($this->parent_dir . $filename) . '"'
- . ' alt="' . $words -> __get('thumbnail of') . ' ' . $filename . '"'
- . ' >' . $words -> __get('view') . ' ' . $words->__get('file') . '';
+ . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
+ . ' >' . $words->__get('view') . ' ' . $words->__get('file') . '';
}
elseif (in_array(self::ext($filename), array('MP3', 'mp3', 'ogg')))
{
//
- $this -> thumb_link .= ' Your browser does not support the audio element.'
- . ''
+ . ''
. ' ';
//
}
else
{
- $this -> thumb_link .= ' Your browser does not support the video element. ';
- $this -> thumb_link .= ' server('PHP_SELF'))
. '?thm='. Url::translate_uri($this->parent_dir . $filename) . '"'
- . ' alt="' . $words -> __get('thumbnail of') . ' ' . $filename . '"'
+ . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' >' . $words->__get('view') . ' ' . $words->__get('file') . '';
}
@@ -241,25 +241,25 @@ class FileItem extends Item
{
$icon_svg = ICON_PATH ? Url::translate_uri($config->__get('icon_path') . 'svg.png') : Url::translate_uri($this->parent_dir . $filename);
$heightwidth = in_array(self::ext($filename), array('svg', 'xml')) ? ' height="' . '150' . '" width="' . '150' . '" ' : ' ';
- $this -> thumb_link .= '
server('PHP_SELF'))
. '?thumbnail='. Url::translate_uri($icon_svg) . '"'
. ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"'
. ' />';
- //. '
';
}
- $size = $this -> size -> __get('bytes');
- if (MD5_SHOW && $size > 0 && $size / 1048576 <= $config -> __get('md5_show'))
+ $size = $this->size->__get('bytes');
+ if (MD5_SHOW && $size > 0 && $size / 1048576 <= $config->__get('md5_show'))
{
- $this -> md5_link = '[['
- . $words -> __get('calculate md5sum') . ']';
+ . $words->__get('calculate md5sum') . ']';
}
}