mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-08 08:52:23 +02:00
Adding FolderSize
new Button to activate/deactivate showing Foldersize
This commit is contained in:
parent
eb8f3d80bc
commit
cb0e05be5d
|
@ -274,7 +274,7 @@ defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') .
|
||||||
// logout
|
// logout
|
||||||
if (isset($_GET['logout'])) {
|
if (isset($_GET['logout'])) {
|
||||||
unset($_SESSION[FM_SESSION_ID]['logged']);
|
unset($_SESSION[FM_SESSION_ID]['logged']);
|
||||||
unset( $_SESSION['token']);
|
unset( $_SESSION['token']);
|
||||||
fm_redirect(FM_SELF_URL);
|
fm_redirect(FM_SELF_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,6 +720,9 @@ if (isset($_POST['newfilename'], $_POST['newfile'], $_POST['token']) && !FM_READ
|
||||||
}
|
}
|
||||||
$FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
|
$FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['foldersize'])) {
|
||||||
|
$_SESSION[FM_SESSION_ID]['foldersize'] = !($_SESSION[FM_SESSION_ID]['foldersize']??false);
|
||||||
|
}
|
||||||
|
|
||||||
// Copy folder / file
|
// Copy folder / file
|
||||||
if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
|
if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
|
||||||
|
@ -798,7 +801,7 @@ if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish'], $_POST['token'])
|
||||||
if(!verifyToken($_POST['token'])) {
|
if(!verifyToken($_POST['token'])) {
|
||||||
fm_set_msg(lng('Invalid Token.'), 'error');
|
fm_set_msg(lng('Invalid Token.'), 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
// from
|
// from
|
||||||
$path = FM_ROOT_PATH;
|
$path = FM_ROOT_PATH;
|
||||||
if (FM_PATH != '') {
|
if (FM_PATH != '') {
|
||||||
|
@ -1117,9 +1120,9 @@ if (isset($_POST['group'], $_POST['token']) && (isset($_POST['zip']) || isset($_
|
||||||
foreach($files as $file){
|
foreach($files as $file){
|
||||||
array_push($sanitized_files, fm_clean_path($file));
|
array_push($sanitized_files, fm_clean_path($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = $sanitized_files;
|
$files = $sanitized_files;
|
||||||
|
|
||||||
if (!empty($files)) {
|
if (!empty($files)) {
|
||||||
chdir($path);
|
chdir($path);
|
||||||
|
|
||||||
|
@ -1225,7 +1228,7 @@ if (isset($_POST['chmod'], $_POST['token']) && !FM_READONLY && !FM_IS_WIN) {
|
||||||
if(!verifyToken($_POST['token'])) {
|
if(!verifyToken($_POST['token'])) {
|
||||||
fm_set_msg(lng("Invalid Token."), 'error');
|
fm_set_msg(lng("Invalid Token."), 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = FM_ROOT_PATH;
|
$path = FM_ROOT_PATH;
|
||||||
if (FM_PATH != '') {
|
if (FM_PATH != '') {
|
||||||
$path .= '/' . FM_PATH;
|
$path .= '/' . FM_PATH;
|
||||||
|
@ -1448,7 +1451,7 @@ if (isset($_POST['copy']) && !FM_READONLY) {
|
||||||
<p>
|
<p>
|
||||||
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-danger"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>
|
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-danger"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
|
||||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Copy') ?></button>
|
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Copy') ?></button>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1997,7 +2000,7 @@ if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
|
||||||
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-primary"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>
|
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-primary"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b>
|
||||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Change') ?></button>
|
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Change') ?></button>
|
||||||
</p>
|
</p>
|
||||||
|
@ -2071,7 +2074,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
|
||||||
$modif = date(FM_DATETIME_FORMAT, $modif_raw);
|
$modif = date(FM_DATETIME_FORMAT, $modif_raw);
|
||||||
$date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw));
|
$date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw));
|
||||||
$filesize_raw = "";
|
$filesize_raw = "";
|
||||||
$filesize = lng('Folder');
|
$filesize = $_SESSION[FM_SESSION_ID]['foldersize']??false ? fm_get_filesize(fm_foldersize($path . '/' . $f)) : lng('Folder');
|
||||||
$perms = substr(decoct(fileperms($path . '/' . $f)), -4);
|
$perms = substr(decoct(fileperms($path . '/' . $f)), -4);
|
||||||
if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
|
if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
|
||||||
$owner = posix_getpwuid(fileowner($path . '/' . $f));
|
$owner = posix_getpwuid(fileowner($path . '/' . $f));
|
||||||
|
@ -2230,6 +2233,8 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
|
||||||
<a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a></li>
|
<a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a></li>
|
||||||
<li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
|
<li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
|
||||||
<a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a></li>
|
<a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a></li>
|
||||||
|
<li class="list-inline-item"><input type="submit" class="hidden" name="foldersize" id="a-foldersize" value="Foldersize">
|
||||||
|
<a href="javascript:document.getElementById('a-foldersize').click();" class="btn btn-small btn-outline-primary btn-2 <?php echo $_SESSION[FM_SESSION_ID]['foldersize']??false ? 'btn-active':''; ?>"><i class="fa fa-pie-chart"></i> <?php echo lng('Foldersize') ?> </a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 d-none d-sm-block"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right text-muted">Tiny File Manager <?php echo VERSION; ?></a></div>
|
<div class="col-3 d-none d-sm-block"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right text-muted">Tiny File Manager <?php echo VERSION; ?></a></div>
|
||||||
|
@ -2268,13 +2273,33 @@ function print_external($key) {
|
||||||
* @param string $token
|
* @param string $token
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function verifyToken($token)
|
function verifyToken($token)
|
||||||
{
|
{
|
||||||
if (hash_equals($_SESSION['token'], $token)) {
|
if (hash_equals($_SESSION['token'], $token)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
function fm_foldersize($path) {
|
||||||
|
$total_size = 0;
|
||||||
|
$files = scandir($path);
|
||||||
|
$cleanPath = rtrim($path, '/'). '/';
|
||||||
|
foreach($files as $t) {
|
||||||
|
if ($t<>"." && $t<>"..") {
|
||||||
|
$currentFile = $cleanPath . $t;
|
||||||
|
if (is_dir($currentFile)) {
|
||||||
|
$size = fm_foldersize($currentFile);
|
||||||
|
$total_size += $size;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$size = filesize($currentFile);
|
||||||
|
$total_size += $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $total_size;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete file or folder (recursively)
|
* Delete file or folder (recursively)
|
||||||
|
@ -3849,7 +3874,8 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
|
||||||
.float-right { float: right; }
|
.float-right { float: right; }
|
||||||
.table-hover>tbody>tr:hover>td:first-child { border-left: 1px solid #1b77fd; }
|
.table-hover>tbody>tr:hover>td:first-child { border-left: 1px solid #1b77fd; }
|
||||||
#main-table tr.even { background-color: #F8F9Fa; }
|
#main-table tr.even { background-color: #F8F9Fa; }
|
||||||
.filename>a>i {margin-right: 3px;}
|
.filename>a>i {margin-right: 3px;}
|
||||||
|
.btn-active { background-color: yellow; }
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
if (FM_THEME == "dark"): ?>
|
if (FM_THEME == "dark"): ?>
|
||||||
|
@ -4128,7 +4154,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
|
||||||
$confirmDailog.modal('show');
|
$confirmDailog.modal('show');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// on mouse hover image preview
|
// on mouse hover image preview
|
||||||
!function(s){s.previewImage=function(e){var o=s(document),t=".previewImage",a=s.extend({xOffset:20,yOffset:-20,fadeIn:"fast",css:{padding:"5px",border:"1px solid #cccccc","background-color":"#fff"},eventSelector:"[data-preview-image]",dataKey:"previewImage",overlayId:"preview-image-plugin-overlay"},e);return o.off(t),o.on("mouseover"+t,a.eventSelector,function(e){s("p#"+a.overlayId).remove();var o=s("<p>").attr("id",a.overlayId).css("position","absolute").css("display","none").append(s('<img class="c-preview-img">').attr("src",s(this).data(a.dataKey)));a.css&&o.css(a.css),s("body").append(o),o.css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px").fadeIn(a.fadeIn)}),o.on("mouseout"+t,a.eventSelector,function(){s("#"+a.overlayId).remove()}),o.on("mousemove"+t,a.eventSelector,function(e){s("#"+a.overlayId).css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px")}),this},s.previewImage()}(jQuery);
|
!function(s){s.previewImage=function(e){var o=s(document),t=".previewImage",a=s.extend({xOffset:20,yOffset:-20,fadeIn:"fast",css:{padding:"5px",border:"1px solid #cccccc","background-color":"#fff"},eventSelector:"[data-preview-image]",dataKey:"previewImage",overlayId:"preview-image-plugin-overlay"},e);return o.off(t),o.on("mouseover"+t,a.eventSelector,function(e){s("p#"+a.overlayId).remove();var o=s("<p>").attr("id",a.overlayId).css("position","absolute").css("display","none").append(s('<img class="c-preview-img">').attr("src",s(this).data(a.dataKey)));a.css&&o.css(a.css),s("body").append(o),o.css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px").fadeIn(a.fadeIn)}),o.on("mouseout"+t,a.eventSelector,function(){s("#"+a.overlayId).remove()}),o.on("mousemove"+t,a.eventSelector,function(e){s("#"+a.overlayId).css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px")}),this},s.previewImage()}(jQuery);
|
||||||
|
@ -4158,7 +4184,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE && !FM_READONLY):
|
<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE && !FM_READONLY):
|
||||||
|
|
||||||
$ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
|
$ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
|
||||||
$ext = $ext == "js" ? "javascript" : $ext;
|
$ext = $ext == "js" ? "javascript" : $ext;
|
||||||
?>
|
?>
|
||||||
|
@ -4255,11 +4281,11 @@ function lng($txt) {
|
||||||
$tr['en']['NormalEditor'] = 'Normal Editor'; $tr['en']['BackUp'] = 'Back Up';
|
$tr['en']['NormalEditor'] = 'Normal Editor'; $tr['en']['BackUp'] = 'Back Up';
|
||||||
$tr['en']['SourceFolder'] = 'Source Folder'; $tr['en']['Files'] = 'Files';
|
$tr['en']['SourceFolder'] = 'Source Folder'; $tr['en']['Files'] = 'Files';
|
||||||
$tr['en']['Move'] = 'Move'; $tr['en']['Change'] = 'Change';
|
$tr['en']['Move'] = 'Move'; $tr['en']['Change'] = 'Change';
|
||||||
$tr['en']['Settings'] = 'Settings'; $tr['en']['Language'] = 'Language';
|
$tr['en']['Settings'] = 'Settings'; $tr['en']['Language'] = 'Language';
|
||||||
$tr['en']['ErrorReporting'] = 'Error Reporting'; $tr['en']['ShowHiddenFiles'] = 'Show Hidden Files';
|
$tr['en']['ErrorReporting'] = 'Error Reporting'; $tr['en']['ShowHiddenFiles'] = 'Show Hidden Files';
|
||||||
$tr['en']['Help'] = 'Help'; $tr['en']['Created'] = 'Created';
|
$tr['en']['Help'] = 'Help'; $tr['en']['Created'] = 'Created';
|
||||||
$tr['en']['Help Documents'] = 'Help Documents'; $tr['en']['Report Issue'] = 'Report Issue';
|
$tr['en']['Help Documents'] = 'Help Documents'; $tr['en']['Report Issue'] = 'Report Issue';
|
||||||
$tr['en']['Generate'] = 'Generate'; $tr['en']['FullSize'] = 'Full Size';
|
$tr['en']['Generate'] = 'Generate'; $tr['en']['FullSize'] = 'Full Size';
|
||||||
$tr['en']['HideColumns'] = 'Hide Perms/Owner columns';$tr['en']['You are logged in'] = 'You are logged in';
|
$tr['en']['HideColumns'] = 'Hide Perms/Owner columns';$tr['en']['You are logged in'] = 'You are logged in';
|
||||||
$tr['en']['Nothing selected'] = 'Nothing selected'; $tr['en']['Paths must be not equal'] = 'Paths must be not equal';
|
$tr['en']['Nothing selected'] = 'Nothing selected'; $tr['en']['Paths must be not equal'] = 'Paths must be not equal';
|
||||||
$tr['en']['Renamed from'] = 'Renamed from'; $tr['en']['Archive not unpacked'] = 'Archive not unpacked';
|
$tr['en']['Renamed from'] = 'Renamed from'; $tr['en']['Archive not unpacked'] = 'Archive not unpacked';
|
||||||
|
|
Loading…
Reference in a new issue