From 40ebbcbbb33a6145778602402c4e7a6a07570165 Mon Sep 17 00:00:00 2001 From: hppanpaliya Date: Tue, 17 Oct 2023 21:49:07 -0400 Subject: [PATCH 1/3] Added Feature to Display Disk Space Usage # Changes: - Added disk space calculation logic to the `index.php` file. - Updated the file listing footer to include total, used, and remaining disk space information. - Utilized `disk_total_space`, `disk_free_space`, and `fm_get_filesize` functions to obtain and format disk space information. - Ensured that the feature works seamlessly with existing functionalities and adheres to the project's coding standards. # Benefits: - Users with multiple mounted drives on their servers can easily see how much disk space is available, used, and remaining on each drive, facilitating better disk space management. - Enhances user experience by providing valuable disk space information, aiding in capacity planning and preventing potential issues related to disk space exhaustion. - Helps in monitoring disk space usage directly from the file manager without needing to use external tools or commands. # Use Case: - As someone managing a server with multiple mounted drives, this feature is invaluable for monitoring the disk space usage on each drive. It helps in ensuring that none of the drives are nearing capacity, which could lead to performance degradation or even system failures. Having this information readily available within Tiny File Manager streamlines the process of managing disk space and ensures that I can take timely action if needed, such as cleaning up old files or moving data to other drives with more available space. --- tinyfilemanager.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index ca73f9d..e1e7a0f 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -2202,10 +2202,25 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white + + + + '.fm_get_filesize($all_files_size).'' ?> + ' .$total_used_size.''; ?> + ' .$free_size.''; ?> '.$num_files.'' ?> '.$num_folders.'' ?> @@ -4287,6 +4302,8 @@ function lng($txt) { $tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'; $tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'; $tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'; + $tr['en']['RemainingSpace'] = 'Remaining Space'; + $tr['en']['UsedSpace'] = 'Used Space'; $i18n = fm_get_translations($tr); $tr = $i18n ? $i18n : $tr; From d2e6e003a7b6422ea68ea14f10f2c5091502bfa1 Mon Sep 17 00:00:00 2001 From: hppanpaliya Date: Tue, 17 Oct 2023 21:59:18 -0400 Subject: [PATCH 2/3] Toggleable Disk Space Usage Display This commit builds upon the previous feature of displaying disk space information by adding a toggle option in the settings to show or hide disk space usage details. #### Changes: - Added a new setting under the settings section allowing users to toggle the display of disk space usage information. - Updated the disk space display logic to check the setting before fetching and displaying disk space information. #### Code Additions: - Introduced a new checkbox under the settings section to allow users to toggle the display of disk space usage. - Implemented a check for the `show_disk_usage` setting before executing disk space calculation and display logic. #### Benefits: - Provides users with the flexibility to choose whether or not to display disk space information based on their preferences or needs. - Helps in reducing unnecessary disk space calculations when the information is not needed, potentially improving performance. - Maintains a clean and uncluttered UI by allowing users to hide disk space information when it's not required. --- tinyfilemanager.php | 52 +++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index e1e7a0f..044042d 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1,6 +1,6 @@ data['hide_Cols']) ? $cfg->data['hide_Cols'] : true; // Theme $theme = isset($cfg->data['theme']) ? $cfg->data['theme'] : 'light'; +$show_disk_usage = isset($cfg->data['show_disk_usage']) ? $cfg->data['show_disk_usage'] : true; + define('FM_THEME', $theme); //available languages @@ -539,6 +541,7 @@ if ((isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ $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; + $sdu = isset($_POST['js-show-usage']) && $_POST['js-show-usage'] == "true" ? true : false; $te3 = $_POST['js-theme-3']; if ($cfg->data['lang'] != $newLng) { @@ -557,6 +560,10 @@ if ((isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ $cfg->data['show_hidden'] = $shf; $show_hidden_files = $shf; } + if ($cfg->data['show_disk_usage'] != $sdu) { + $cfg->data['show_disk_usage'] = $sdu; + $show_disk_usage = $sdu; + } if ($cfg->data['hide_Cols'] != $hco) { $cfg->data['hide_Cols'] = $hco; $hide_Cols = $hco; @@ -1553,6 +1560,16 @@ if (isset($_GET['settings']) && !FM_READONLY) { +
+ +
+
+ /> +
+
+
+ +
@@ -2202,25 +2219,31 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white - - - - '.fm_get_filesize($all_files_size).'' ?> - ' .$total_used_size.''; ?> - ' .$free_size.''; ?> + ' .$total_used_size.''; + echo lng('RemainingSpace').': ' .$free_size.''; + } + ?> '.$num_files.'' ?> '.$num_folders.'' ?> @@ -4304,6 +4327,7 @@ function lng($txt) { $tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'; $tr['en']['RemainingSpace'] = 'Remaining Space'; $tr['en']['UsedSpace'] = 'Used Space'; + $tr['en']['ShowDiskUsage'] = 'Show Disk Usage'; $i18n = fm_get_translations($tr); $tr = $i18n ? $i18n : $tr; From f47fd087e657c2f149e6c194e7f8d48faf4e4dd2 Mon Sep 17 00:00:00 2001 From: hppanpaliya Date: Wed, 18 Oct 2023 03:14:34 -0400 Subject: [PATCH 3/3] Add translations for 'Used Space' and 'Remaining Space' This commit add translations for the terms 'Used Space' and 'Remaining Space' across all supported languages using Google Translate. --- translation.json | 128 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 32 deletions(-) diff --git a/translation.json b/translation.json index 3edda9c..44f7bb4 100644 --- a/translation.json +++ b/translation.json @@ -82,7 +82,9 @@ "password_hash not supported, Upgrade PHP version": "Generare hash parolă nesuportată, actualizați versiunea de PHP", "Theme": "Tematică", "dark": "Întunecată", - "light": "Luminoasă" + "light": "Luminoasă", + "Remaining Space": "Spațiu rămas", + "Used Space": "Spațiu utilizat" } }, { @@ -162,7 +164,9 @@ "Generate new password hash": "Új jelszó hash létrehozása", "You are logged in": "Ön sikeresen bejelentkezett", "Login failed. Invalid username or password": "Sikertelen bejelentkezés. Hibás felhasználói név vagy jelszó.", - "password_hash not supported, Upgrade PHP version": "password_hash ebben a PHP verzióban nem támogatott" + "password_hash not supported, Upgrade PHP version": "password_hash ebben a PHP verzióban nem támogatott", + "Remaining Space": "Hátralévő hely", + "Used Space": "Használt hely" } }, { @@ -242,7 +246,9 @@ "Generate new password hash": "Generer en ny passord hash", "You are logged in": "Du er innlogget", "Login failed. Invalid username or password": "Innlogging feilet. Feil brukernavn eller passord", - "password_hash not supported, Upgrade PHP version": "password_hash er ikke støttet, venligst oppdater PHP versjonen" + "password_hash not supported, Upgrade PHP version": "password_hash er ikke støttet, venligst oppdater PHP versjonen", + "Remaining Space": "Gjenstående plass", + "Used Space": "Brukt plass" } }, { @@ -316,7 +322,9 @@ "Calculate folder size": "محاسبه حجم پوشه", "Check Latest Version": "بررسی آخرین نسخه", "Generate new password hash": "ایجاد گذرواژه جدید", - "Hide Perms/Owner columns": "مخفی کردن ستون های دسترسی و مالک" + "Hide Perms/Owner columns": "مخفی کردن ستون های دسترسی و مالک", + "Remaining Space": "فضای باقی مانده", + "Used Space": "فضای استفاده شده" } }, { @@ -438,7 +446,9 @@ "UploadingFiles": "Загрузка файлов", "Username": "Пользователь", "Write": "Запись", - "You are logged in": "Вы вошли в систему" + "You are logged in": "Вы вошли в систему", + "Remaining Space": "Осталось места", + "Used Space": "Использовано места" } }, { @@ -563,7 +573,9 @@ "Write": "Scrivi", "You are logged in": "Accesso effettuato", "Zero byte file! Aborting download": "File con zero byte! Download annullato", - "Zip": "Zip" + "Zip": "Zip", + "Remaining Space": "Spazio rimanente", + "Used Space": "Spazio utilizzato" } }, { @@ -638,7 +650,9 @@ "Username": "Utilisateur", "UnZip": "Décompresser", "UnZipToFolder": "Décompresser dans un dossier", - "You are logged in": "Vous êtes authentifié(e)" + "You are logged in": "Vous êtes authentifié(e)", + "Remaining Space": "Espace restant", + "Used Space": "Espace utilisé" } }, { @@ -695,7 +709,9 @@ "Files": "Archivos", "Change": "Cambiar", "Settings": "Preferencias", - "Language": "Lenguaje" + "Language": "Lenguaje", + "Remaining Space": "Espacio restante", + "Used Space": "Espacio Usado" } }, { @@ -752,7 +768,9 @@ "Files": "Arquivos", "Change": "Cambiar", "Settings": "Preferencias", - "Language": "Linguaxe" + "Language": "Linguaxe", + "Remaining Space": "Espazo Restante", + "Used Space": "Espazo Usado" } }, { @@ -832,7 +850,9 @@ "Generate new password hash": "Crear una nou hash de contrasenya", "You are logged in": "Estàs autenticat", "Login failed. Invalid username or password": "Error d'inici de sessió. El nom d'usuari o contrasenya són incorrectes", - "password_hash not supported, Upgrade PHP version": "no és compatible password_hash. Actualitza la versió de PHP" + "password_hash not supported, Upgrade PHP version": "no és compatible password_hash. Actualitza la versió de PHP", + "Remaining Space": "Espai restant", + "Used Space": "Espai utilitzat" } }, { @@ -950,7 +970,9 @@ "Invalid characters in file or folder name": "Unzulässige Zeichen im Datei- oder Ordnernamen", "Operations with archives are not available": "Archiv-Funktionen nicht verfägbar", "File or folder with this path already exists": "Datei oder Ordner mit diesem Pfad existiert bereits", - "Moved from": "Verschoben aus" + "Moved from": "Verschoben aus", + "Remaining Space": "Verfügbarer Speicherplatz", + "Used Space": "Belegter Speicherplatz" } }, { @@ -1007,7 +1029,9 @@ "Files": "ไฟล์", "Change": "เปลี่ยน", "Settings": "การตั้งค่า", - "Language": "ภาษา" + "Language": "ภาษา", + "Remaining Space": "พื้นที่ว่าง", + "Used Space": "พื้นที่ดิสก์ที่ใช้" } }, { @@ -1169,7 +1193,9 @@ "Select Mode": "选择模式", "Select Theme": "选择主题", "Select Font Size": "选择字体大小", - "Are you sure want to rename?": "是否确实要重命名?" + "Are you sure want to rename?": "是否确实要重命名?", + "Remaining Space": "剩余空间", + "Used Space": "已用空间" } }, { @@ -1247,7 +1273,9 @@ "FullSize": "所有檔案容量", "MemoryUsed": "使用的記憶體大小", "PartitionSize": "剩餘可用空間", - "FreeOf": "硬碟容量:" + "FreeOf": "硬碟容量:", + "Remaining Space": "剩餘空間", + "Used Space": "已用空間" } }, { @@ -1330,7 +1358,9 @@ "password_hash not supported, Upgrade PHP version": "Tidak mendukung password_hash, Perbarui versi PHP", "Theme": "Tema", "dark": "Gelap", - "light": "Terang" + "light": "Terang", + "Remaining Space": "Sisa ruang", + "Used Space": "Ruang yang digunakan" } }, { @@ -1389,7 +1419,9 @@ "Settings": "Ρυθμίσεις", "Language": "Γλώσσα", "MemoryUsed": "Η μνήμη χρησιμοποιείται", - "PartitionSize": "Μέγεθος partition" + "PartitionSize": "Μέγεθος partition", + "Remaining Space": "Ελεύθερος χώρος", + "Used Space": "Χώρος που χρησιμοποιείται" } }, { @@ -1512,7 +1544,9 @@ "Moved from": "Movido de", "Created": "Criado", "You are logged in": "Você está logado", - "Login failed. Invalid username or password": "Falha na autenticação. nome de usuário ou senha inválidos" + "Login failed. Invalid username or password": "Falha na autenticação. nome de usuário ou senha inválidos", + "Remaining Space": "Espaço restante", + "Used Space": "Espaço usado" } }, { @@ -1569,7 +1603,9 @@ "Files": "Pliki", "Change": "Zmień", "Settings": "Ustawienia", - "Language": "Język" + "Language": "Język", + "Remaining Space": "Pozostała przestrzeń", + "Used Space": "Wykorzystana przestrzeń" } }, { @@ -1694,7 +1730,9 @@ "Moved from": "Chuyển từ", "Created": "đã tạo", "Login failed. Invalid username or password": "Không tìm thấy người dùng", - "Theme": "Chủ đề" + "Theme": "Chủ đề", + "Remaining Space": "Không gian còn lại", + "Used Space": "Không gian được sử dụng" } }, { @@ -1753,7 +1791,9 @@ "Settings": "הגדרות", "Language": "שפה", "MemoryUsed": "זיכרון בשימוש", - "PartitionSize": "גודל מחיצה" + "PartitionSize": "גודל מחיצה", + "Remaining Space": "שטח פנוי", + "Used Space": "שטח בשימוש" } }, { @@ -1823,7 +1863,9 @@ "Report Issue": "التبليغ بمشكلة", "Generate new password hash": "توليد هاش لكلمة المرور", "Help Documents": "وثائق المساعدة", - "Check Latest Version": "تفقد آخر الاصدارات" + "Check Latest Version": "تفقد آخر الاصدارات", + "Remaining Space": "المساحة المتبقية", + "Used Space": "المساحة المستخدمة" } }, { @@ -1901,7 +1943,9 @@ "Generate new password hash": "Vygenerovat nový hash hesla", "You are logged in": "Jste přihlášen(a)", "Login failed. Invalid username or password": "Chyba přihlášení: špatně zadané heslo nebo uživatelské jméno", - "password_hash not supported, Upgrade PHP version": "Funkce password_hash není dostupná, aktualizujte PHP na novější verzi" + "password_hash not supported, Upgrade PHP version": "Funkce password_hash není dostupná, aktualizujte PHP na novější verzi", + "Remaining Space": "Zbývající místo", + "Used Space": "Využité místo" } }, { @@ -1975,7 +2019,9 @@ "Calculate folder size": "Klasör Boyutlarını Hesapla", "Check Latest Version": "Güncel Sürümü Kontrol Et", "Generate new password hash": "Parola için Hash Üret", - "Hide Perms/Owner columns": "Yetki / Sahip Sütununu Gizle" + "Hide Perms/Owner columns": "Yetki / Sahip Sütununu Gizle", + "Remaining Space": "Kalan Alan", + "Used Space": "Kullanılan Alan" } }, { @@ -2040,7 +2086,9 @@ "Preview": "Náhľad", "Help": "Pomoc", "FullSize": "Celková veľkosť", - "FreeOf": "voľné z" + "FreeOf": "voľné z", + "Remaining Space": "Zostávajúci priestor", + "Used Space": "Využitý priestor" } }, { @@ -2100,7 +2148,9 @@ "Language": "Jezik", "You are logged in": "Ste uspešno prijavljeni", "Login failed. Invalid username or password": "Prijava je spodletela. Napačno uporabniško ime ali geslo.", - "password_hash not supported, Upgrade PHP version": "password_hash ni podprt, nadgradite različico PHP" + "password_hash not supported, Upgrade PHP version": "password_hash ni podprt, nadgradite različico PHP", + "Remaining Space": "Preostali prostor", + "Used Space": "Porabljen prostor" } }, { @@ -2169,7 +2219,9 @@ "CalculateFolderSize": "Laske kansion koko", "CheckLatestVersion": "Tarkista päivitykset", "Generate new password hash": "Luo uusi salasana-hash", - "HideColumns": "Piilota oikeudet-/omistaja-sarakkeet" + "HideColumns": "Piilota oikeudet-/omistaja-sarakkeet", + "Remaining Space": "Vapaata tilaa", + "Used Space": "Käytetty tila" } }, { @@ -2243,7 +2295,9 @@ "Calculate folder size": "폴더 용량 표시", "Check Latest Version": "최신 버전 체크", "Generate new password hash": "새 비밀번호 해시 생성", - "Hide Perms/Owner columns": "권한/소유자 숨기기" + "Hide Perms/Owner columns": "권한/소유자 숨기기", + "Remaining Space": "남은 공간", + "Used Space": "사용된 공간" } }, { @@ -2328,7 +2382,9 @@ "Other": "その他", "Read": "読み込み", "Write": "書き込み", - "Execute": "実行" + "Execute": "実行", + "Remaining Space": "残りのスペース", + "Used Space": "使用済みスペース" } }, { @@ -2413,7 +2469,9 @@ "Other": "Бусад", "Read": "Унших", "Write": "Бичих", - "Execute": "Ажиллуулах" + "Execute": "Ажиллуулах", + "Remaining Space": "Үлдсэн зай", + "Used Space": "Ашигласан зай" } }, { @@ -2558,7 +2616,9 @@ "Are you sure want to rename?": "Weet u zeker dat u de naam wilt wijzigen?", "Are you sure want to": "Verder gaan met", "dark": "donker", - "light": "licht" + "light": "licht", + "Remaining Space": "Resterende ruimte", + "Used Space": "Gebruikte ruimte" } }, { @@ -2682,7 +2742,9 @@ "not deleted": "ikke slettet", "not found!": "ikke fundet!", "password_hash not supported, Upgrade PHP version": "password_hash er ikke understøttet, opgrader PHP-versionen", - "to": "til" + "to": "til", + "Remaining Space": "Resterende plads", + "Used Space": "Brugt plads" } }, { @@ -2806,7 +2868,9 @@ "not deleted": "মুছে ফেলা হয়নি", "not found!": "পাওয়া যায় নি!", "password_hash not supported, Upgrade PHP version": "পাসওয়ার্ড_হ্যাশ সমর্থিত নয়, পিএইচপি ভার্সন আপগ্রেড করুন", - "to": "to" + "to": "to", + "Remaining Space": "অবশিষ্ট স্থান", + "Used Space": "ব্যবহৃত স্থান" } } ]