mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2025-05-04 14:30:57 +02:00
Add configurable path display modes for better privacy and clarity (#1034)
This commit is contained in:
parent
8194249b66
commit
8486c7a240
@ -77,6 +77,12 @@ $iconv_input_encoding = 'UTF-8';
|
||||
// Doc - https://www.php.net/manual/en/function.date.php
|
||||
$datetime_format = 'm/d/Y g:i A';
|
||||
|
||||
// Path display mode when viewing file information
|
||||
// 'full' => show full path
|
||||
// 'relative' => show path relative to root_path
|
||||
// 'host' => show path on the host
|
||||
$path_display_mode = 'full';
|
||||
|
||||
// Allowed file extensions for create and rename files
|
||||
// e.g. 'txt,html,css,js'
|
||||
$allowed_file_extensions = '';
|
||||
@ -1684,7 +1690,8 @@ if (isset($_GET['view'])) {
|
||||
<div class="col-12">
|
||||
<p class="break-word"><b><?php echo lng($view_title) ?> "<?php echo fm_enc(fm_convert_win($file)) ?>"</b></p>
|
||||
<p class="break-word">
|
||||
<strong>Full path:</strong> <?php echo fm_enc(fm_convert_win($file_path)) ?><br>
|
||||
<?php $display_path = fm_get_display_path($file_path); ?>
|
||||
<strong><?php echo $display_path['label']; ?>:</strong> <?php echo $display_path['path']; ?><br>
|
||||
<strong>File size:</strong> <?php echo ($filesize_raw <= 1000) ? "$filesize_raw bytes" : $filesize; ?><br>
|
||||
<strong>MIME-type:</strong> <?php echo $mime_type ?><br>
|
||||
<?php
|
||||
@ -1943,7 +1950,8 @@ if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
Full path: <?php echo $file_path ?><br>
|
||||
<?php $display_path = fm_get_display_path($file_path); ?>
|
||||
<?php echo $display_path['label']; ?>: <?php echo $display_path['path']; ?><br>
|
||||
</p>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="p" value="<?php echo fm_enc(FM_PATH) ?>">
|
||||
@ -2514,6 +2522,30 @@ function fm_get_parent_path($path)
|
||||
return false;
|
||||
}
|
||||
|
||||
function fm_get_display_path($file_path)
|
||||
{
|
||||
global $path_display_mode, $root_path, $root_url;
|
||||
switch ($path_display_mode) {
|
||||
case 'relative':
|
||||
return array(
|
||||
'label' => 'Path',
|
||||
'path' => fm_enc(fm_convert_win(str_replace($root_path, '', $file_path)))
|
||||
);
|
||||
case 'host':
|
||||
$relative_path = str_replace($root_path, '', $file_path);
|
||||
return array(
|
||||
'label' => 'Host Path',
|
||||
'path' => fm_enc(fm_convert_win('/' . $root_url . '/' . ltrim(str_replace('\\', '/', $relative_path), '/')))
|
||||
);
|
||||
case 'full':
|
||||
default:
|
||||
return array(
|
||||
'label' => 'Full Path',
|
||||
'path' => fm_enc(fm_convert_win($file_path))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check file is in exclude list
|
||||
* @param string $file
|
||||
|
Loading…
x
Reference in New Issue
Block a user