Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
778e440
structure
Dalamov Nov 3, 2021
aeb5706
Modal to upload files, and table
Dalamov Nov 3, 2021
f1a82ac
Added Mockup.drawio
Dalamov Nov 4, 2021
670e280
Create Mockup.drawio
Dalamov Nov 4, 2021
f8f0270
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
Dalamov Nov 4, 2021
387035f
build:-> modularized
ParisArcos Nov 4, 2021
537ef8f
Update Mockup.drawio
AranBeitia Nov 4, 2021
ba884ae
Update Mockup.drawio
AranBeitia Nov 4, 2021
db4192a
Merge branch 'master' into paris
ParisArcos Nov 4, 2021
512957f
Merge branch 'master' into paris
ParisArcos Nov 4, 2021
7066dd9
fix-> datatables()
ParisArcos Nov 4, 2021
6b9e732
delete unnecessary packages
Dalamov Nov 4, 2021
5236d3f
feat-> rows (folder & size) added
ParisArcos Nov 4, 2021
8e83a8a
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
ParisArcos Nov 4, 2021
7ccaba7
Update modal.php
Dalamov Nov 4, 2021
a1d9e2b
Completed table
Dalamov Nov 4, 2021
cad1983
bug
Dalamov Nov 4, 2021
fbb4192
add gitignore file
AranBeitia Nov 4, 2021
e2ce748
delete duplicated code
AranBeitia Nov 4, 2021
19fb4ea
fix-> send ajax file
ParisArcos Nov 4, 2021
a2cee4b
feat->manager table & modal , modularized
ParisArcos Nov 4, 2021
1a29f31
feat-> php encapsulate
ParisArcos Nov 5, 2021
9e6d136
fix->upload.php bug
ParisArcos Nov 5, 2021
d0cc509
Merge branch 'master' into paris
ParisArcos Nov 5, 2021
a07b426
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
ParisArcos Nov 5, 2021
bc56cc6
add gitignore
AranBeitia Nov 5, 2021
a0522b9
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
AranBeitia Nov 5, 2021
0436239
delete file
AranBeitia Nov 5, 2021
a654170
rename file
AranBeitia Nov 5, 2021
9fc6eaa
rename file
AranBeitia Nov 5, 2021
b3a96e7
rename maldita url
AranBeitia Nov 5, 2021
68ab10f
fix-> rename path problem
ParisArcos Nov 5, 2021
f067498
delete
ParisArcos Nov 6, 2021
7d20d4b
script handle edit removed
ParisArcos Nov 6, 2021
64d6cc5
feat->modularize
ParisArcos Nov 6, 2021
69dd5cf
build-> utils folder added
ParisArcos Nov 6, 2021
7e4f05c
feat->purpurina
ParisArcos Nov 6, 2021
dba028d
Merge branch 'master' into dani
Dalamov Nov 6, 2021
692f254
build->sidebar
ParisArcos Nov 6, 2021
76c5846
feat-> sideFillContent
ParisArcos Nov 7, 2021
4697ab8
build->footer
ParisArcos Nov 7, 2021
5811d4a
bug
Dalamov Nov 8, 2021
e3971f8
styles
AranBeitia Nov 8, 2021
eede235
fix-> OS bug
ParisArcos Nov 8, 2021
49ced06
fix->filePath bug
ParisArcos Nov 8, 2021
6b27573
fix->getFileSize
ParisArcos Nov 8, 2021
f016ca3
fix-> Mac problema
ParisArcos Nov 8, 2021
0e52103
fix-> maldito mac
AranBeitia Nov 8, 2021
eaf0a2a
fix-> actions event
AranBeitia Nov 8, 2021
c0c2bf8
fix->datatable loop
AranBeitia Nov 8, 2021
d95f987
fix-> hell of bugs
ParisArcos Nov 8, 2021
91263d9
Merge branch 'paris' of https://github.com/Dalamov/filesystem-explore…
ParisArcos Nov 8, 2021
b602457
fix-> hell of loops
ParisArcos Nov 8, 2021
c8fc791
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
ParisArcos Nov 8, 2021
ee6ab9e
Merge branch 'master' into dani
Dalamov Nov 8, 2021
a47fee3
Update Mockup.drawio
AranBeitia Nov 9, 2021
99baa5b
fix-> loop heaven
ParisArcos Nov 9, 2021
54090bc
Merge branch 'master' into paris
ParisArcos Nov 9, 2021
f53ae2e
Merge branch 'master' into paris
ParisArcos Nov 9, 2021
8070fd7
open file
Dalamov Nov 9, 2021
85fa0cc
Merge branch 'master' into dani
Dalamov Nov 9, 2021
d29c39d
styles
AranBeitia Nov 9, 2021
c35f255
feat-> getCurrentFolder
ParisArcos Nov 9, 2021
cad9db6
Merge branch 'master' into paris
ParisArcos Nov 9, 2021
e8b2399
fix-> echo row
ParisArcos Nov 9, 2021
904bbd7
Add documentation
Dalamov Nov 9, 2021
49ed5bc
All Done!
ParisArcos Nov 9, 2021
19ae544
Merge branch 'master' of https://github.com/Dalamov/filesystem-explorer
Dalamov Nov 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
413 changes: 413 additions & 0 deletions app/Mockup.drawio

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions app/js/ajaxCreateFolder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function ajaxCreateFolder($newFolderName) {
$.ajax({
url: "../../app/php/createFolder.php",
type: "post",
data: {
newFolderName: $newFolderName,
},
success: function (response) {
if (response) {
Swal.fire({
icon: "success",
title: "Folder created",
showConfirmButton: false,
timer: 1500,
});
//?recharge table
$("#folderName").trigger("reset");
loadSidebar();
} else {
Swal.fire({
icon: "error",
title: "Oops...",
text: "Something went wrong!",
});
}
},
});
}
21 changes: 21 additions & 0 deletions app/js/ajaxDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function ajaxDelete(fileUrl) {
$.ajax({
url: "../../app/php/deleteFile.php",
type: "post",
data: {
filePath: fileUrl,
},
success: function (response) {
if (response) {
Swal.fire({
icon: "success",
title: "File deleted",
showConfirmButton: false,
timer: 1500,
});
//?recharge table
loadTable();
}
},
});
}
16 changes: 16 additions & 0 deletions app/js/ajaxGetCurrentFolder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function ajaxGetCurrentFolder(fileUrl) {
$.ajax({
url: "../../app/php/utils/getCurrentFolder.php",
type: "post",
data: {
filePath: fileUrl,
},
success: function (response) {
if (response) {
console.log(response);
//?recharge table
loadTable();
}
},
});
}
24 changes: 24 additions & 0 deletions app/js/ajaxOpenFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function ajaxOpenFile(fileUrl) {
$.ajax({
url: "../../app/php/openFile.php",
type: "post",
data: {
filePath: fileUrl,
},
success: function (response) {
if (response) {
console.log(response)
Swal.fire({
html:`${response}`
});
} else {
console.log(response)
Swal.fire({
icon: "error",
title: "Oops...",
text: "Something went wrong!",
});
}
},
});
}
29 changes: 29 additions & 0 deletions app/js/ajaxRename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function ajaxRename(oldName, newName, file) {
$.ajax({
url: "../../app/php/renameFile.php",
type: "post",
data: {
oldName: oldName,
newName: newName,
file: file,
},
success: function (response) {
if (response) {
Swal.fire({
icon: "success",
title: "File renamed",
showConfirmButton: false,
timer: 1500,
});
//?recharge table
loadTable();
} else {
Swal.fire({
icon: "error",
title: "Oops...",
text: "Something went wrong!",
});
}
},
});
}
15 changes: 15 additions & 0 deletions app/js/ajaxSetCurrentFolder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function ajaxSetCurrentFolder(fileUrl) {
$.ajax({
url: "../../app/php/tableFillContent.php",
type: "post",
data: {
filePath: fileUrl,
},
success: function (response) {
if (response) {
console.log(response);
//?recharge table
}
},
});
}
42 changes: 42 additions & 0 deletions app/js/ajaxUpload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function ajaxUpload() {
event.preventDefault();
var fd = new FormData();
var files = $("#file")[0].files;

if (files.length > 0) {
fd.append("file", files[0]);

$.ajax({
url: "../../app/php/uploadFile.php",
type: "post",
data: fd,
contentType: false,
processData: false,
success: function (response) {
console.log(response);
if (response) {
Swal.fire({
icon: "success",
title: "File updated",
showConfirmButton: false,
timer: 1500,
});
//?recharge table
loadTable();
} else {
Swal.fire({
icon: "error",
title: "Oops...",
text: "Something went wrong!",
});
}
},
});
} else {
Swal.fire({
icon: "error",
title: "Oops...",
text: "Something went wrong!",
});
}
}
7 changes: 7 additions & 0 deletions app/js/loadSidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function loadSidebar() {
$(document).ready(function () {
$("#folderSidebar").load("sidebar.php");
});
}

loadSidebar();
7 changes: 7 additions & 0 deletions app/js/loadTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function loadTable() {
$(document).ready(function () {
$("#fileDataTable").load("table.php");
});
}

loadTable();
13 changes: 13 additions & 0 deletions app/php/createFolder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
include "utils/getFilePath.php";
session_start();
if (isset($_POST['newFolderName'])) {
$newFolderName = $_POST['newFolderName'];
$path = $_SESSION['folderPath'];
$path = getFilePath($path);
$path = $path . '/' . $newFolderName;
mkdir($path, 0777, true);
echo $response;
} else {
$response = false;
}
9 changes: 9 additions & 0 deletions app/php/deleteFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

if(file_exists($_POST['filePath'])) {
unlink($_POST['filePath']);
echo $response;
} else {
$response = false;
}

28 changes: 28 additions & 0 deletions app/php/openFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
$file = $_POST['filePath'];
$fileExtension = mime_content_type($file);
$fileExtension = explode('/', $fileExtension)[0];
switch ($fileExtension) {
case 'image':
echo "<img src='$file' style='width:150px;'>";
break;
case 'audio':
echo "<audio controls> <source src='$file' type='audio/mpeg'> No audio support. </audio>";
break;
case 'video':
echo "<video width='320' height='240' controls autoplay> <source src='$file' type='video/mp4'> Your browser does not support the video tag. </video>";
break;
case 'text':
$file = fopen($file, "r");
$content = fread($file, filesize($file));
echo "<p>'$content' </p>";
fclose($file);
break;
default:
# code...
break;
}


// fclose($file);
//txt -> // echo file_get_contents($file);
32 changes: 32 additions & 0 deletions app/php/renameFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
include "./utils/getFilePath.php";

//? incoming file
$file = '/' . $_POST['file'];
$newName = $_POST['newName'];

$fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION));
$newName = substr($newName, 1);


//? File path
$oldFilePath = getFilePath($file);
$newFilePath = dirname($oldFilePath) . '/' . $newName . '.' . $fileType;

//? New file path
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$oldFilePath = str_replace('/', '\\', $oldFilePath);
$newFilePath = str_replace('/', '\\', $newFilePath);
} else {
$newName = substr($newName, 1);
$oldFilePath = getFilePath($file);
$newFilePath = dirname($oldFilePath) . '/' . $newName . '.' . $fileType;
}

//? Change Name
if ($_POST['oldName'] !== $_POST['newName']) {
rename($oldFilePath, $newFilePath);
echo $response = true;
} else {
$response = false;
}
59 changes: 59 additions & 0 deletions app/php/sidebarFillContent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
include "utils/fileBrowser.php";
include "utils/getFileSize.php";
function sidebarFillContent($initFolder = "", $id = -1)
{
$id++;
//?loop 0 $initFolder="/storage/*"
foreach (fileBrowser($initFolder) as $secondFolder) {
//!is_dir trouble solution
if (pathinfo($secondFolder, PATHINFO_EXTENSION) === "") {
$id++;
$secondFolderName = basename($secondFolder);
echo
"<li class='mb-1 p-2' id='folder-$id' data-file='$secondFolder'>" .
"<button id='folderButton' class='btn btn-toggle align-items-center rounded collapsed' data-bs-toggle='collapse' data-bs-target='#folder-$id-collapse' aria-expanded='false'>" .
"<h5>$secondFolderName </h5>" .
'</button>' .
"<div class='collapse' id='folder-$id-collapse'>";
if (fileBrowser("$secondFolder/*")) {
echo
"<ul class='btn-toggle-nav list-unstyled fw-normal pb-1 small'>";
//?loop 1 $secondFolder="/storage/insideFolder/*"
foreach (fileBrowser("$secondFolder/*") as $thirdFolder) {
if (pathinfo($thirdFolder, PATHINFO_EXTENSION) === "") {
$thirdFolderName = basename($thirdFolder);
$id++;
echo "<li class='mb-1 p-2' id='folder-$id' data-file='$thirdFolder'>" .
"<button id='folderButton' class='btn btn-toggle align-items-center rounded collapsed' data-bs-toggle='collapse' data-bs-target='#folder-$id-collapse' aria-expanded='false'>" .
"<h5>$thirdFolderName</h5>" .
'</button>' .
"<div class='collapse' id='folder-$id-collapse'>" .
"<ul class='btn-toggle-nav list-unstyled fw-normal pb-1 small'>";
//?loop 2 $thirdFolder="/storage/insideFolder/insideFolder/*"
sidebarFillContent("$thirdFolder/*", $id);
echo '</ul>
</div>
</li>';
}
}
echo '</ul>';
} else {
echo '<h5>empty!! </h5><br/> <br/>';
}
echo '</div>
</li>';
}
}
}
?>
<script>
$(document).on('click', '#folderButton', function(e) {

$('.class-toggle').toggle();
//$('.class-toggle').toggleClass('add-class'); })

$file = e.target.parentElement.parentElement.dataset.file ? e.target.parentElement.parentElement.dataset.file : e.target.parentElement.dataset.file;
ajaxGetCurrentFolder($file)
})
</script>
Loading