diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 7ef7bab..895299b 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1,15 +1,15 @@ data['show_hidden']) ? $cfg->data['show_hidden' // PHP error reporting - false = Turns off Errors, true = Turns on Errors $report_errors = isset($cfg->data['error_reporting']) ? $cfg->data['error_reporting'] : true; +// Hide Permissions and Owner cols in file-listing +$hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true; + +// Show Dirsize: true or speedup output: false +$calc_folder = isset($cfg->data['calc_folder']) ? $cfg->data['calc_folder'] : true; + //available languages $lang_list = array( 'en' => 'English' @@ -144,9 +150,6 @@ if ($report_errors == true) { @ini_set('display_errors', 0); } -// Set Cookie -setcookie('fm_cache', true, 2147483647, "/"); - // if fm included if (defined('FM_EMBED')) { $use_auth = false; @@ -303,7 +306,6 @@ if ($use_auth) { @@ -409,7 +411,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) { // Save Config if (isset($_POST['type']) && $_POST['type'] == "settings") { - global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list; + global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $calc_folder; $newLng = $_POST['js-language']; fm_get_translations([]); if (!array_key_exists($newLng, $lang_list)) { @@ -418,6 +420,8 @@ if (isset($_POST['ajax']) && !FM_READONLY) { $erp = isset($_POST['js-error-report']) && $_POST['js-error-report'] == "true" ? true : false; $shf = isset($_POST['js-show-hidden']) && $_POST['js-show-hidden'] == "true" ? true : false; + $hco = isset($_POST['js-hide-cols']) && $_POST['js-hide-cols'] == "true" ? true : false; + $caf = isset($_POST['js-calc-folder']) && $_POST['js-calc-folder'] == "true" ? true : false; if ($cfg->data['lang'] != $newLng) { $cfg->data['lang'] = $newLng; @@ -431,6 +435,18 @@ if (isset($_POST['ajax']) && !FM_READONLY) { $cfg->data['show_hidden'] = $shf; $show_hidden_files = $shf; } + if ($cfg->data['show_hidden'] != $shf) { + $cfg->data['show_hidden'] = $shf; + $show_hidden_files = $shf; + } + if ($cfg->data['hide_Cols'] != $hco) { + $cfg->data['hide_Cols'] = $hco; + $hide_Cols = $hco; + } + if ($cfg->data['calc_folder'] != $caf) { + $cfg->data['calc_folder'] = $caf; + $calc_folder = $caf; + } $cfg->save(); echo true; } @@ -675,7 +691,7 @@ if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) { $old = str_replace('/', '', $old); // new name $new = $_GET['to']; - $new = fm_clean_path($new); + $new = fm_clean_path(strip_tags($new)); $new = str_replace('/', '', $new); // path $path = FM_ROOT_PATH; @@ -1229,6 +1245,34 @@ if (isset($_GET['settings']) && !FM_READONLY) { +
+ +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+
+
@@ -1267,10 +1311,10 @@ if (isset($_GET['help'])) {
@@ -1306,7 +1350,7 @@ if (isset($_GET['view'])) { $quickView = (isset($_GET['quickView']) && $_GET['quickView'] == 1) ? true : false; $file = fm_clean_path($file); $file = str_replace('/', '', $file); - if ($file == '' || !is_file($path . '/' . $file)) { + if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) { fm_set_msg('File not found', 'error'); fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH)); } @@ -1690,7 +1734,7 @@ $all_files_size = 0; - + @@ -1706,7 +1750,7 @@ $all_files_size = 0; - + @@ -1739,9 +1783,9 @@ $all_files_size = 0;
' . readlink($path . '/' . $f) . '' : '') ?>
- + - + @@ -1788,9 +1832,11 @@ $all_files_size = 0;
' . readlink($path . '/' . $f) . '' : '') ?>
- + + + - + @@ -1827,7 +1873,7 @@ $all_files_size = 0; - '.fm_get_filesize($all_files_size).'' ?> + '.fm_get_filesize($all_files_size).'' ?> '.$num_files.'' ?> '.$num_folders.'' ?> '.fm_get_filesize(@memory_get_usage(true)).'' ?> @@ -2209,6 +2255,27 @@ function fm_get_filesize($size) } } +/** + * Get director total size + * @param string $directory + * @return string + */ +function fm_get_directorysize($directory) { + global $calc_folder; + if ($calc_folder==true) { // Slower output + $size = 0; $count= 0; $dirCount= 0; + foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) + if ($file->isFile()) + { $size+=$file->getSize(); + $count++; + } + else if ($file->isDir()) { $dirCount++; } + // return [$size, $count, $dirCount]; + return fm_get_filesize($size); + } + else return 'Folder'; // Quick output +} + /** * Get info about zip archive * @param string $path @@ -3487,11 +3554,14 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; }); }); - +