Skip to content

Commit b289a50

Browse files
authored
Update filemanager.php
1 parent 2843be7 commit b289a50

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

filemanager.php

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* The Kinsmen File Manager v2.2.2
4+
* The Kinsmen File Manager v2.3
55
*
66
* A comprehensive, modern file manager with cPanel styling and all essential features:
77
* - File Tree Navigation
@@ -19,8 +19,8 @@
1919
* - Sorting and filtering
2020
*/
2121

22-
$username = "joe"; // username
23-
$root_path = "/home/joe"; // root path
22+
$username = ""; //user
23+
$root_path = ""; // root path
2424

2525
// Configuration
2626
$config = [
@@ -1081,8 +1081,19 @@ function extract7Zip($source, $destination)
10811081
$status = true;
10821082
$messages = [];
10831083

1084-
// If not permanent delete, use trash function instead
1085-
if (!$permanent && $action === "delete") {
1084+
$stop = [1, 2];
1085+
foreach ($items as $item) {
1086+
if (str_contains($item, "fm-config")) {
1087+
$stop[] = $item;
1088+
}
1089+
}
1090+
1091+
if (count($stop) > 0) {
1092+
$response = [
1093+
"status" => "error",
1094+
"message" => "Cannot delete 'fm-config' file",
1095+
];
1096+
} else if (!$permanent && $action === "delete") {
10861097
// Redirect to trash action
10871098
$formData = new FormData();
10881099
$formData . append("action", "trash");
@@ -1091,8 +1102,6 @@ function extract7Zip($source, $destination)
10911102
foreach ($items as $item) {
10921103
$formData . append("items[]", $item);
10931104
}
1094-
1095-
// This is handled client-side in the JavaScript
10961105
} else {
10971106
// Permanent deletion (original delete code)
10981107
foreach ($items as $item) {
@@ -1459,7 +1468,8 @@ function extract7Zip($source, $destination)
14591468
}
14601469

14611470

1462-
function parseSize($size) {
1471+
function parseSize($size)
1472+
{
14631473
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size);
14641474
$size = preg_replace('/[^0-9\.]/', '', $size);
14651475
if ($unit) {
@@ -2257,7 +2267,7 @@ function parseSize($size) {
22572267
</div>
22582268
<div class="modal-body">
22592269
<p>Are you sure you want to delete the selected item(s)?</p>
2260-
<ul id="deleteItems" class="mb-3"></ul>
2270+
<ul id="deleteItems" class="mb-3 text-small"></ul>
22612271

22622272
<div class="form-check mb-3">
22632273
<input class="form-check-input" type="checkbox" id="permanentDeleteCheck">
@@ -2522,8 +2532,6 @@ function getMimeType(filename) {
25222532
return mimeTypes[extension] || 'text/x-generic';
25232533
}
25242534

2525-
2526-
25272535
// Show files in table
25282536
function showFiles(files) {
25292537
const filesList = document.getElementById('files-list');
@@ -3048,7 +3056,7 @@ function deleteItems() {
30483056
document.getElementById('permanentDeleteCheck').checked = false;
30493057

30503058
// Update alert visibility and button text
3051-
updateDeleteModalState();
3059+
//updateDeleteModalState();
30523060

30533061
const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
30543062
deleteModal.show();
@@ -3067,7 +3075,6 @@ function confirmDelete() {
30673075
const isPermanentDelete = document.getElementById('permanentDeleteCheck').checked;
30683076

30693077
if (isPermanentDelete) {
3070-
// Permanent delete
30713078
const formData = new FormData();
30723079
formData.append('action', 'delete');
30733080
formData.append('path', currentPath);
@@ -3083,7 +3090,7 @@ function confirmDelete() {
30833090
})
30843091
.then(response => response.json())
30853092
.then(data => {
3086-
bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
3093+
//bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
30873094

30883095
if (data.status === 'success') {
30893096
loadFileList();
@@ -3092,6 +3099,10 @@ function confirmDelete() {
30923099
} else {
30933100
showAlert('Error', data.message || 'Failed to delete items');
30943101
}
3102+
3103+
setTimeout(() => {
3104+
window.location.reload();
3105+
}, 1000);
30953106
})
30963107
.catch(error => {
30973108
showAlert('Error', 'Failed to delete items');
@@ -3112,7 +3123,7 @@ function confirmDelete() {
31123123
})
31133124
.then(response => response.json())
31143125
.then(data => {
3115-
bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
3126+
//bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
31163127

31173128
if (data.status === 'success') {
31183129
loadFileList();
@@ -3121,6 +3132,9 @@ function confirmDelete() {
31213132
} else {
31223133
showAlert('Error', data.message || 'Failed to move items to trash');
31233134
}
3135+
setTimeout(() => {
3136+
window.location.reload();
3137+
}, 1000);
31243138
})
31253139
.catch(error => {
31263140
showAlert('Error', 'Failed to move items to trash');

0 commit comments

Comments
 (0)