Skip to content

Commit 7e1ad39

Browse files
authored
Update filemanager.php
1 parent 96ff40e commit 7e1ad39

File tree

1 file changed

+47
-28
lines changed

1 file changed

+47
-28
lines changed

filemanager.php

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

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

22-
$username = ""; // user
22+
$username = ""; //username
2323
$root_path = ""; // root path
2424

2525
// Configuration
@@ -28,7 +28,7 @@
2828
"allowed_extensions" => ["*"],
2929
"timezone" => "Africa/Lagos",
3030
"date_format" => "M j Y, g:i A",
31-
"font_size" => "20px",
31+
"font_size" => "16px",
3232
];
3333

3434
if (file_exists("$root_path/.fm-config")) {
@@ -1099,7 +1099,7 @@ function extract7Zip($source, $destination)
10991099
];
11001100
header('Content-Type: application/json');
11011101
echo json_encode($response);
1102-
exit;
1102+
exit;
11031103
}
11041104
if (!$permanent && $action === "delete") {
11051105
$formData = new FormData();
@@ -1929,6 +1929,11 @@ function parseSize($size)
19291929
.modal-header {
19301930
padding: 10px;
19311931
}
1932+
1933+
#deleteItems li {
1934+
font-size: 0.5rem;
1935+
1936+
}
19321937
</style>
19331938
</head>
19341939

@@ -2294,7 +2299,7 @@ function parseSize($size)
22942299
</div>
22952300
<div class="modal-body">
22962301
<p>Are you sure you want to delete the selected item(s)?</p>
2297-
<ul id="deleteItems" class="mb-3 text-small"></ul>
2302+
<ul id="deleteItems" class="mb-3"></ul>
22982303

22992304
<div class="form-check mb-3">
23002305
<input class="form-check-input" type="checkbox" id="permanentDeleteCheck">
@@ -2936,6 +2941,8 @@ function showAlert(title, message) {
29362941
modal.hide();
29372942
}
29382943
});
2944+
2945+
29392946
}
29402947

29412948
// Create new folder
@@ -3094,7 +3101,7 @@ function deleteItems() {
30943101
document.getElementById('permanentDeleteCheck').checked = false;
30953102

30963103
// Update alert visibility and button text
3097-
//updateDeleteModalState();
3104+
updateDeleteModalState();
30983105

30993106
const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
31003107
deleteModal.show();
@@ -3103,9 +3110,18 @@ function deleteItems() {
31033110
// Update delete modal state based on checkbox
31043111
function updateDeleteModalState() {
31053112
const isPermanentDelete = document.getElementById('permanentDeleteCheck').checked;
3106-
document.getElementById('deleteInfoAlert').style.display = isPermanentDelete ? 'none' : 'block';
3107-
document.getElementById('permanentDeleteAlert').style.display = isPermanentDelete ? 'block' : 'none';
3108-
document.getElementById('deleteButtonText').textContent = isPermanentDelete ? 'Delete Permanently' : 'Move to Trash';
3113+
if (document.getElementById('deleteInfoAlert')) {
3114+
document.getElementById('deleteInfoAlert').style.display = isPermanentDelete ? 'none' : 'block';
3115+
}
3116+
3117+
if (document.getElementById('permanentDeleteAlert')) {
3118+
document.getElementById('permanentDeleteAlert').style.display = isPermanentDelete ? 'block' : 'none';
3119+
}
3120+
3121+
if (document.getElementById('deleteButtonText')) {
3122+
document.getElementById('deleteButtonText').textContent = isPermanentDelete ? 'Delete Permanently' : 'Move to Trash';
3123+
}
3124+
31093125
}
31103126

31113127
// Confirm delete or move to trash
@@ -3128,7 +3144,7 @@ function confirmDelete() {
31283144
})
31293145
.then(response => response.json())
31303146
.then(data => {
3131-
//bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
3147+
bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
31323148

31333149
if (data.status === 'success') {
31343150
loadFileList();
@@ -3138,9 +3154,6 @@ function confirmDelete() {
31383154
showAlert('Error', data.message || 'Failed to delete items');
31393155
}
31403156

3141-
setTimeout(() => {
3142-
window.location.reload();
3143-
}, 1000);
31443157
})
31453158
.catch(error => {
31463159
showAlert('Error', 'Failed to delete items');
@@ -3161,7 +3174,7 @@ function confirmDelete() {
31613174
})
31623175
.then(response => response.json())
31633176
.then(data => {
3164-
//bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
3177+
bootstrap.Modal.getInstance(document.getElementById('deleteModal')).hide();
31653178

31663179
if (data.status === 'success') {
31673180
loadFileList();
@@ -3170,17 +3183,15 @@ function confirmDelete() {
31703183
} else {
31713184
showAlert('Error', data.message || 'Failed to move items to trash');
31723185
}
3173-
setTimeout(() => {
3174-
window.location.reload();
3175-
}, 1000);
31763186
})
31773187
.catch(error => {
31783188
showAlert('Error', 'Failed to move items to trash');
31793189
});
31803190
}
31813191
}
3182-
3183-
document.getElementById('permanentDeleteCheck').addEventListener('change', updateDeleteModalState);
3192+
if (document.getElementById('permanentDeleteCheck')) {
3193+
document.getElementById('permanentDeleteCheck').addEventListener('change', updateDeleteModalState);
3194+
}
31843195

31853196
// File operation (copy/move)
31863197
function performFileOperation(operation) {
@@ -3615,8 +3626,9 @@ function init() {
36153626
deleteItems();
36163627
}
36173628
});
3618-
3619-
document.getElementById('confirmDeleteBtn').addEventListener('click', confirmDelete);
3629+
if (document.getElementById('confirmDeleteBtn')) {
3630+
document.getElementById('confirmDeleteBtn').addEventListener('click', confirmDelete);
3631+
}
36203632

36213633
document.getElementById('download-btn').addEventListener('click', function(e) {
36223634
e.preventDefault();
@@ -4112,23 +4124,30 @@ function confirmRestore() {
41124124
});
41134125
}
41144126

4115-
document.querySelectorAll('.action-btns').forEach(btn => {
4127+
const actionButtons = document.querySelectorAll('.action-btns');
4128+
actionButtons.forEach(btn => {
4129+
const content = btn.textContent.replace(/\s+/g, ' ').trim();
4130+
btn.innerHTML = content;
41164131
btn.addEventListener('click', function(e) {
41174132
e.preventDefault();
41184133

41194134
btn.disabled = true;
4120-
btn.innerHTML = `<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> ${btn.textContent}`;
4135+
btn.innerHTML = `<span class="spinner-border spinner-border-sm"></span> ${content}`;
41214136

41224137
const siblingButtons = btn.closest('.modal-footer').querySelectorAll('button');
4123-
siblingButtons.forEach(sibling => {
4124-
if (sibling !== btn) {
4125-
sibling.disabled = true;
4126-
}
4127-
});
4138+
if (siblingButtons) {
4139+
siblingButtons.forEach(sibling => {
4140+
if (sibling !== btn) {
4141+
sibling.disabled = true;
4142+
}
4143+
});
4144+
}
41284145
});
4146+
41294147
});
41304148

41314149

4150+
41324151
// Initialize the application
41334152
init();
41344153
});

0 commit comments

Comments
 (0)