diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cef626f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/modules/uploads/* \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 00000000..30a9dcb4 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,292 @@ +@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"); + +body { + height: 100vh; + font-size: 14px; + font-family: Roboto !important; +} + +a{ + color: black !important; + text-decoration: none !important; + font-weight: 400 !important; +} +a:hover{ + font-weight: 600 !important; +} + +header { + background: #4285f4; + margin-bottom: 20px; + justify-content: space-between; + align-items: center; + padding: 0px 10px; + color: white; +} +.header-logo { + position: absolute; + left: 25px; +} + +.text-logo { + color: #ffa000; + font-family: fantasy; + font-size: 2rem; + vertical-align: middle; +} + +.general-button-container { + width: 10%; +} + +.general-button { + width: 30px; + height: 30px; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; +} + +.general-button-img { + width: 20px; +} + +.actions-button { + width: 20px; +} + +.type-icon { + width: 30px; +} +.th-width { + max-width: 200px; +} + +.tree-max { + max-width: 300px; + overflow: hidden; +} + +.background-alert { + background: #c21500; /* fallback for old browsers */ + background: -webkit-linear-gradient(to right, #ffc500, #c21500); /* Chrome 10-25, Safari 5.1-6 */ + background: linear-gradient(to right, #ffc500, #c21500); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ +} + +.background-input-create { + background-color: rgb(13, 179, 13); +} +.background-input-create:focus { + border: none; +} + +.background-input-create:active { + border: none; +} + +.input-search { + padding: 5px 10px; + border-radius: 10px; + border: none; + outline: none; +} + +.button-search { + color: #fff; + background-color: #0d6efd; + border: none; + border-radius: 25%; + padding: 0.3rem 0.6rem; +} + +.button-options { + height: 45px; + margin: 0px 2px; +} + +.margin-35 { + margin-right: 35px; +} + +.button-trash { + border-radius: 15px 15px 15px 15px; + width: 100%; + margin-top: 5px; +} + +.button-trash__message{ + vertical-align: middle; + margin-left: 5px; +} +footer { + height: 100px; + background-color: #4285f4; + color: white; + display: flex; + justify-content: center; + line-height: 100px; + margin-top: 20px; + position: fixed; + width: 100%; + bottom: 0; +} + +/* BREADCRUMBS */ + +h1 { + text-align: center; + margin-top: 30px; + margin-bottom: 50px; +} +ol { + list-style: none; +} +.breadcrumb { + width: 100%; + float: left; + margin: 20px 0; + padding: 7px; + position: relative; + display: block; + background: rgba(0, 0, 0, 0.05); + border-radius: 5px; +} +.breadcrumb ol { + list-style: none; +} +.breadcrumb li { + height: 40px; + line-height: 40px; + float: left; + padding: 0 12px; +} +.breadcrumb li a { + text-decoration: none; +} +.breadcrumb li .fa { + width: 30px; + height: 30px; + line-height: 30px; +} +.breadcrumb a:hover { + text-decoration: none; +} + +/* Bredcrumb Fill 0 */ +.breadcrumb-fill0 { + padding: 15px; + background: #ffffff; + border-radius: 5px; + box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 0.2); +} + +/* Bredcrumb Fill 1 */ +.breadcrumb-fill1 { + padding: 15px; + background: #135fb4; + color: #ffffff; + border-radius: 5px; + box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 0.2); +} +.breadcrumb-fill1, +.breadcrumb-fill1 li, +.breadcrumb-fill1 li.active, +.breadcrumb-fill1 li a { + color: #ffffff; +} + +/* Bredcrumb Fill 2 - style 1 */ +.breadcrumb-fill2 { + padding: 15px; + background: #135fb4; + color: #ffffff; + border-radius: 15px; + box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 0.2); +} +.breadcrumb-fill2 .fa { + position: absolute; + background: #135fb4; + padding: 25px; + border-radius: 50%; + left: -10px; + top: -10px; + font-size: 30px; + line-height: 1; + box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 0.2); +} +.breadcrumb-fill2, +.breadcrumb-fill2 li, +.breadcrumb-fill2 li.active, +.breadcrumb-fill2 li a { + color: #ffffff; +} +.breadcrumb-fill2 li:first-child { + margin-right: 30px; +} + +/* Bredcrumb Fill 2 - style 2 */ +.breadcrumb-fill2.style2 { + border-radius: 30px; + background: #ff6407; +} +.breadcrumb-fill2.style2 .fa { + background: #ff6407; +} + +/* Bredcrumb Fill 2 - style 3 */ +.breadcrumb-fill2.style3 { + border-radius: 30px; + background: #bb123c; +} +.breadcrumb-fill2.style3 .fa { + background: #f62459; +} + +/* Bredcrumb Fill 2 - style 4 */ +.breadcrumb-fill2.style4 { + border-radius: 30px; + background: #1f3a93; + padding: 0; + width: 100%; + float: left; +} +.breadcrumb-fill2.style4 .fa { + border: 5px solid #ffffff; + text-align: center; + padding: 15px; +} +.breadcrumb-fill2.style4 li { + height: 50px; + line-height: 50px; + float: left; + padding: 0 12px; +} +.breadcrumb-fill2.style4 li:before { + display: none; +} +.breadcrumb-fill2.style4 li:first-child { + background: rgba(0, 0, 0, 0.3); +} +.breadcrumb-fill2.style4 li:nth-child(2n) { + background: rgba(0, 0, 0, 0.4); +} +.breadcrumb-fill2.style4 li:nth-child(3n) { + background: rgba(0, 0, 0, 0.3); +} +.breadcrumb-fill2.style4 li:nth-child(4n) { + background: rgba(0, 0, 0, 0.2); +} +.breadcrumb-fill2.style4 li:nth-child(5n) { + background: rgba(0, 0, 0, 0.1); +} +.breadcrumb-fill2.style4 li:last-child { + background: transparent; +} + +.breadcrumb .fa:hover { + transform: scale(1.15); +} +.primary-color { + background-color: #4285f4 !important; +} diff --git a/assets/img/icons/alert.svg b/assets/img/icons/alert.svg new file mode 100644 index 00000000..7cd2c29a --- /dev/null +++ b/assets/img/icons/alert.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assets/img/icons/create.svg b/assets/img/icons/create.svg new file mode 100644 index 00000000..d1c3f0a5 --- /dev/null +++ b/assets/img/icons/create.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/img/icons/csv.svg b/assets/img/icons/csv.svg new file mode 100644 index 00000000..ce7034ef --- /dev/null +++ b/assets/img/icons/csv.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/delete.svg b/assets/img/icons/delete.svg new file mode 100644 index 00000000..c5a1e848 --- /dev/null +++ b/assets/img/icons/delete.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/img/icons/doc.svg b/assets/img/icons/doc.svg new file mode 100644 index 00000000..91918ef6 --- /dev/null +++ b/assets/img/icons/doc.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/edit-modal.svg b/assets/img/icons/edit-modal.svg new file mode 100644 index 00000000..59469a3a --- /dev/null +++ b/assets/img/icons/edit-modal.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/img/icons/edit.svg b/assets/img/icons/edit.svg new file mode 100644 index 00000000..b5b2da9c --- /dev/null +++ b/assets/img/icons/edit.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/img/icons/exe.svg b/assets/img/icons/exe.svg new file mode 100644 index 00000000..6478f77a --- /dev/null +++ b/assets/img/icons/exe.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/folder-alert.svg b/assets/img/icons/folder-alert.svg new file mode 100644 index 00000000..f8ebaa09 --- /dev/null +++ b/assets/img/icons/folder-alert.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/img/icons/folder.svg b/assets/img/icons/folder.svg new file mode 100644 index 00000000..23a23fd5 --- /dev/null +++ b/assets/img/icons/folder.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/globalTrash.svg b/assets/img/icons/globalTrash.svg new file mode 100644 index 00000000..eb4ce5e6 --- /dev/null +++ b/assets/img/icons/globalTrash.svg @@ -0,0 +1,640 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Trash Full + + + Jakub Steiner + + + + + + trash + delete + wastebasket + full + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/jpg.svg b/assets/img/icons/jpg.svg new file mode 100644 index 00000000..e4fa39cb --- /dev/null +++ b/assets/img/icons/jpg.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/logo.svg b/assets/img/icons/logo.svg new file mode 100644 index 00000000..3fc9a1d0 --- /dev/null +++ b/assets/img/icons/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/img/icons/mp3.svg b/assets/img/icons/mp3.svg new file mode 100644 index 00000000..611184c6 --- /dev/null +++ b/assets/img/icons/mp3.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/mp4.svg b/assets/img/icons/mp4.svg new file mode 100644 index 00000000..07a6efa2 --- /dev/null +++ b/assets/img/icons/mp4.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/odt.svg b/assets/img/icons/odt.svg new file mode 100644 index 00000000..55592089 --- /dev/null +++ b/assets/img/icons/odt.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/pdf.svg b/assets/img/icons/pdf.svg new file mode 100644 index 00000000..118e93ac --- /dev/null +++ b/assets/img/icons/pdf.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/png.svg b/assets/img/icons/png.svg new file mode 100644 index 00000000..cb229511 --- /dev/null +++ b/assets/img/icons/png.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/ppt.svg b/assets/img/icons/ppt.svg new file mode 100644 index 00000000..337f2461 --- /dev/null +++ b/assets/img/icons/ppt.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/rar.svg b/assets/img/icons/rar.svg new file mode 100644 index 00000000..d6485660 --- /dev/null +++ b/assets/img/icons/rar.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/search.svg b/assets/img/icons/search.svg new file mode 100644 index 00000000..69b293bc --- /dev/null +++ b/assets/img/icons/search.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assets/img/icons/trash.svg b/assets/img/icons/trash.svg new file mode 100644 index 00000000..d56e3f81 --- /dev/null +++ b/assets/img/icons/trash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/img/icons/txt.svg b/assets/img/icons/txt.svg new file mode 100644 index 00000000..bbaf6939 --- /dev/null +++ b/assets/img/icons/txt.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/icons/upload-white.svg b/assets/img/icons/upload-white.svg new file mode 100644 index 00000000..9d960d59 --- /dev/null +++ b/assets/img/icons/upload-white.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/img/icons/upload.svg b/assets/img/icons/upload.svg new file mode 100644 index 00000000..90eded55 --- /dev/null +++ b/assets/img/icons/upload.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/assets/img/icons/zip.svg b/assets/img/icons/zip.svg new file mode 100644 index 00000000..fff70d24 --- /dev/null +++ b/assets/img/icons/zip.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/js/datatable.js b/assets/js/datatable.js new file mode 100644 index 00000000..a1d09b37 --- /dev/null +++ b/assets/js/datatable.js @@ -0,0 +1,11 @@ +$(document).ready(function () { + $("#table").DataTable({ + searching: false, + columnDefs: [ + { orderable: false, targets: 3 }, + { orderable: false, targets: 4 }, + { orderable: false, targets: 5 }, + ], + }); + $("#tree").jstree(); +}); diff --git a/assets/js/deleteFile.js b/assets/js/deleteFile.js new file mode 100644 index 00000000..1ad91b1a --- /dev/null +++ b/assets/js/deleteFile.js @@ -0,0 +1,25 @@ +$(document).ready(function () { + // $(".finalDelete").click(function (e) { + // let fileUrl = e.target.dataset.file; + // let splitUrl = fileUrl.split("/"); + // console.log(fileUrl); + // document.querySelector("#deletionTarget").value = splitUrl[splitUrl.length - 1]; + // document.querySelector("#deletePath").value = fileUrl; + // console.log(fileUrl); + // }) +}); +// $.ajax({ + +// url: "../../filesystem-explorer/modules/deleteFile.php", +// type: "post", +// data: { +// filePath: fileUrl +// }, +// success: function (response) { +// // console.log(response); +// // window.location.reload(); +// }, +// error: function () { +// alert('There was some error performing the AJAX call!'); +// } +// }); \ No newline at end of file diff --git a/assets/js/editFile.js b/assets/js/editFile.js new file mode 100644 index 00000000..1b8e4e52 --- /dev/null +++ b/assets/js/editFile.js @@ -0,0 +1,25 @@ +$(document).ready(function () { + $(".editFile").click(function (e) { + let fileUrl = e.target.dataset.file; + console.log(fileUrl); + document.querySelector("#oldNameInput").value = fileUrl; + + let splitUrl = fileUrl.split("/"); + document.querySelector("#newName").value = splitUrl[splitUrl.length - 1]; + + // $.ajax({ + + // url: "../../filesystem-explorer/modules/editFile.php", + // type: "post", + // data: { + // filePath: fileUrl + // }, + // success: function (response) { + // window.location.reload(); + // }, + // error: function () { + // alert('There was some error performing the AJAX call!'); + // } + // }); + }) +}) \ No newline at end of file diff --git a/assets/js/functions.js b/assets/js/functions.js new file mode 100644 index 00000000..f9e2f159 --- /dev/null +++ b/assets/js/functions.js @@ -0,0 +1,9 @@ +// var editBtnArray = document.querySelectorAll('[data-oldname]'); +// // console.log(editBtnArray); +// editBtnArray.forEach(button => { +// button.addEventListener('click', () => { +// var oldName = button.getAttribute('data-oldname'); +// document.getElementById('save-btn').setAttribute('data-oldname', oldName); +// document.getElementById('oldNameInput').setAttribute('value', oldName); +// }) +// }) diff --git a/assets/js/moveFile.js b/assets/js/moveFile.js new file mode 100644 index 00000000..6dbef20b --- /dev/null +++ b/assets/js/moveFile.js @@ -0,0 +1,10 @@ +$(document).ready(function () { + $(".deleteFile").click(function (e) { + let fileUrl = e.target.dataset.file; + let splitUrl = fileUrl.split("/"); + document.querySelector('#nameFile').innerHTML = splitUrl[splitUrl.length - 1]; + document.querySelector("#currentNameInput").value = splitUrl[splitUrl.length - 1]; + document.querySelector("#filePath").value = fileUrl; + console.log(fileUrl); + }) +}); \ No newline at end of file diff --git a/docs/uml.PNG b/docs/uml.PNG new file mode 100644 index 00000000..a04f9b06 Binary files /dev/null and b/docs/uml.PNG differ diff --git a/docs/wireframe.PNG b/docs/wireframe.PNG new file mode 100644 index 00000000..c76abf02 Binary files /dev/null and b/docs/wireframe.PNG differ diff --git a/index.php b/index.php new file mode 100644 index 00000000..e13a6682 --- /dev/null +++ b/index.php @@ -0,0 +1,198 @@ + + + + + + + + File System PHP + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + + + +
+ +
+
+
+ +
+
+
+ + +
+
+ + + +
+
+ + + + + + + + + + + + + + +
File nameCreation DateLast modificationExtensionSizeActions
+ +
+
+ + + + + + + + + + + + + + + + + + diff --git a/modules/Utils.php b/modules/Utils.php new file mode 100644 index 00000000..b4c8c6da --- /dev/null +++ b/modules/Utils.php @@ -0,0 +1,105 @@ +$dirname\n"; + } + + echo "\n"; + echo "\n"; + + //closing the directory + closedir($dir_handle); +} + +/** + * Upload file + * + * @return void + */ +function uploadFile() +{ + if ($_FILES['file']['name'] !== '') { + $fileName = $_FILES['file']['name']; + $test = explode(".", $_FILES['file']['name']); + $extension = end($test); + $acceptedExtensions = ['doc', 'csv', 'jpg', 'png', 'txt', 'ppt', 'odt', 'pdf', 'zip', 'rar', 'exe', 'svg', 'mp3', 'mp4']; + + if (!in_array($extension, $acceptedExtensions)) echo "wrong type, the accepted extensions are the following: " . print_r($acceptedExtensions); + else { + $date = new DateTime(); + $timestamp = $date->getTimestamp(); + $currentFolder = ''; + if(isset($_GET['folder'])){ + $currentFolder = $_GET['folder']; + } + $location = getcwd() . '/uploads/'.$currentFolder."/".$test[0]."-".$timestamp.".".$extension; + //echo $location; + move_uploaded_file($_FILES['file']['tmp_name'], $location); + $redirect = '../index.php?folder='.$currentFolder; + //Location to be discussed + header("Location: $redirect"); + }; + } +}; + +function editFile() +{ + if (isset($_POST['newName'])) { + $newName = $_POST['newName']; + echo $newName; + // rename($oldName, $newName); + $mainPath = getcwd() . '/modules/uploads' . "/"; + } +}; + + +function debug_to_console($data) { + $output = $data; + if (is_array($output)) + $output = implode(',', $output); + + echo ""; +} + +// ESTA FUNCIÓN TIENE QUE: +// - BUSCAR SI HAY RESULTADOS +// SI HAY RESULTADOS -> PRINT DE LOS RESULTADOS EN UN BLOQUE +// - BORRAR DATOS DE LA BÚSQUEDA EN LA SESIÓN + + +// DISPLAY MATCHING FILES WHEN SEARCHING + +// function displayMatchingFiles() { + +// } \ No newline at end of file diff --git a/modules/breadcrumbs.php b/modules/breadcrumbs.php new file mode 100644 index 00000000..dc1f37ff --- /dev/null +++ b/modules/breadcrumbs.php @@ -0,0 +1,18 @@ +'; + $html = $html.''; + if (isset($_GET['folder'])) { + $folders = explode('/', $_GET['folder']); + $adUrlFolder = "/filesystem-explorer/index.php?folder="; + for ($i=1; $i < count($folders); $i++) { + $adUrlFolder = $adUrlFolder."/".$folders[$i]; + $html = $html.''; + } + } + $html = $html.''; + echo $html; +} diff --git a/modules/createFolder.php b/modules/createFolder.php new file mode 100644 index 00000000..b68114f6 --- /dev/null +++ b/modules/createFolder.php @@ -0,0 +1,27 @@ + $deletePath, + "name" => "hello" + ); + $json = json_encode($person); + return $json; + } +} */ + +// deleteFile(); + +/* function fullDelete() +{ + $fileName = "trash123"; + $sliceFileName = substr($fileName, 5); + echo $sliceFileName; +} +fullDelete(); + */ \ No newline at end of file diff --git a/modules/editFile.php b/modules/editFile.php new file mode 100644 index 00000000..49f14527 --- /dev/null +++ b/modules/editFile.php @@ -0,0 +1,17 @@ + $server_root . $name, 'name' => $name, 'creationDate' => $cretionDate, 'editDate' => $editDate, 'icon' => "./assets/img/icons/" . $type . ".svg", 'size' => $size)); + array_push($arrayTree, $json); + } + return $arrayTree; + } + + +}; + +function moveToTrash() +{ + + if (isset($_POST['currentNameInput'])) { + $filePath = $_POST['filePath']; //uploads + $trashPath = getcwd() . "/trash/".$_POST['currentNameInput']; + rename($filePath, $trashPath); + header("Location: ../index.php"); + } +}; + +moveToTrash(); + diff --git a/modules/search.php b/modules/search.php new file mode 100644 index 00000000..a7843455 --- /dev/null +++ b/modules/search.php @@ -0,0 +1,158 @@ +"; + // print_r($matchingFiles); + // echo ""; + // die(); + // $similarFiles = getSimilarFiles($path, $cleanQuery); + + $_SESSION['matchingFiles'] = $matchingFiles; + // $_SESSION['similarFiles'] = $similarFiles; + + header("Location: ../index.php"); + } +} + +require_once("./Utils.php"); + +function getMatchingFiles($path, $cleanQuery, $files) { + $dir = opendir($path); + // var_dump(readdir($dir)); + // echo "
"; + + while ($current = readdir($dir)) { + // var_dump($current); + // echo "
"; + if ( $current != "." && $current != ".." ) { + if (is_dir($path."/".$current)) { + // echo "Heyyy"; + // echo "
"; + $files = getMatchingFiles($path.'/'.$current, $cleanQuery, $files); + } else { + $currentFileName = explode(".", $current); + $cleanCurrent = trim(strtolower($currentFileName[0])); + if (str_contains($cleanCurrent, $cleanQuery) || similar_text($cleanCurrent, $cleanQuery) > 4) { + $files[] = $path."/".$current; + } + } + } + } + + // var_dump($files); + // echo "
"; + // die(); + return $files; +} + +// function getSimilarFiles($path, $cleanQuery) { +// $dir = opendir($path); +// $files = array(); +// while ($current = readdir($dir)){ +// if ( $current != "." && $current != "..") { +// if (is_dir($path.$current)) { +// getSimilarFiles($path.$current.'/', $cleanQuery); +// } else { +// $currentFileWithExt = basename($current); +// $currentFileName = explode(".", $currentFileWithExt); +// $cleanCurrent = trim(strtolower($currentFileName[0])); +// if (similar_text($cleanCurrent, $cleanQuery) > 4) { +// $files[] = $current; +// } +// } +// } +// } + +// return $files; +// } + +searchFiles(); + + + + + + + + + + + + + + + + + + + +/* function showFoldersFile($path = '/') +{ +$arrayTree = []; +$server_root = getcwd() . '/modules/uploads' . $path; + +$tree = scandir($server_root); +for ($i = 2; $i < count($tree); $i++) { +$infoFile = pathinfo($tree[$i]); +$cretionDate = date("d/m/Y", filectime($server_root . "/" . $tree[$i])); +$editDate = date("d/m/Y", filemtime($server_root . "/" . $tree[$i])); +$name = $infoFile['basename']; +$type = 'folder'; +$sizebytes = filesize($server_root . "/" . $tree[$i]); +$size = formatBytes($sizebytes, 2); + +if (count($infoFile) === 4) { +$type = $infoFile['extension']; +} + +$json = json_encode(array('url' => $server_root . $name, 'name' => $name, 'creationDate' => $cretionDate, 'editDate' => $editDate, 'icon' => "./assets/img/icons/" . $type . ".svg", 'size' => $size)); +array_push($arrayTree, $json); +} + +return $arrayTree; +} */ + + +// ---- + + +// function search($path = '/', $search = '') +// { + +// if (isset($_REQUEST['search'])) { +// $search = $_REQUEST['search']; +// } + +// //using the opendir function +// $dir_handle = opendir($path) or die("Unable to open $path"); + +// //Leave only the lastest folder name +// $array = explode("/", $path); + +// while (false !== ($file = readdir($dir_handle))) { +// if ($file != "." && $file != "..") { +// echo $file; +// if (is_dir($path . "/" . $file)) { +// //Display a list of sub folders. +// search($path . "/" . $file, $search); +// } else { + +// } +// } +// } + +// //closing the directory +// closedir($dir_handle); +// } + +// search(); diff --git a/modules/showFoldersFile.php b/modules/showFoldersFile.php new file mode 100644 index 00000000..5407ff9c --- /dev/null +++ b/modules/showFoldersFile.php @@ -0,0 +1,131 @@ + $server_root . $name, 'name' => $name, 'creationDate' => $cretionDate, 'editDate' => $editDate, 'icon' => "./assets/img/icons/" . $type . ".svg", 'size' => $size)); + array_push($arrayTree, $json); + } + + return $arrayTree; +} + +function showQueryFiles($array) { + + $arrayTree = []; + + for ($i = 0; $i < count($array); $i++) { + $infoFile = $array[$i]; + $cretionDate = date("d/m/Y", filectime($infoFile)); + $editDate = date("d/m/Y", filemtime($infoFile)); + $fullName = basename($infoFile); + $fullNameArray = explode(".", $fullName); + $name = $fullNameArray[0]; + $type = 'folder'; + $sizebytes = filesize($infoFile); + $size = formatBytes($sizebytes, 2); + + if (isset($fullNameArray[1])) { + $type = $fullNameArray[1]; + } + + $json = json_encode(array('url' => $infoFile, 'name' => $name, 'creationDate' => $cretionDate, 'editDate' => $editDate, 'icon' => "./assets/img/icons/" . $type . ".svg", 'size' => $size)); + array_push($arrayTree, $json); + } + + return $arrayTree; +} + +function printFolders($tree) +{ + $html = ''; + for ($i = 0; $i < count($tree); $i++) { + $html = $html . ''; + $file = json_decode($tree[$i]); + foreach ($file as $key => $value) { + if ($key === 'url') { + $url = $value; + } + if ($key === 'icon') { + $html = $html . ""; + } else { + if ($key !== 'url') { + if ($key === 'name') { + //$value . "
"; + $explodeUrl = explode(".", $value); + $path = '/'; + + if (isset($_GET['folder'])) { + $path = $_GET['folder'] . '/' . $value; + } else { + $path = $path . $value; + } + + if (isset($explodeUrl[1])) { + if (isset($_GET['trash'])) { + $html = $html . "$value"; + } else { + $html = $html . "$value"; + } + + } else { + if (isset($_GET['trash'])) { + $html = $html . "$value"; + } else { + $html = $html . "$value"; + } + + } + + $oldName = $value; + } else { + $html = $html . "$value"; + } + } + } + } + if (isset($_GET['trash'])) { + $html = $html . " + + "; + } else { + $html = $html . " + + + "; + } + + } + + return $html; +} + +function formatBytes($size, $precision = 2) +{ + $base = log($size, 1024); + $suffixes = array('b', 'Kb', 'Mb', 'Gb', 'Tb'); + $result = round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)]; + + if (!is_nan(round(pow(1024, $base - floor($base)), $precision))) { + return $result; + } else { + return ""; + } +} diff --git a/modules/trash/2-1636460742.jpg b/modules/trash/2-1636460742.jpg new file mode 100644 index 00000000..a55e80f6 Binary files /dev/null and b/modules/trash/2-1636460742.jpg differ diff --git a/modules/trash/2-1636461248.jpg b/modules/trash/2-1636461248.jpg new file mode 100644 index 00000000..a55e80f6 Binary files /dev/null and b/modules/trash/2-1636461248.jpg differ diff --git a/modules/trash/3-1636374024.jpg b/modules/trash/3-1636374024.jpg new file mode 100644 index 00000000..1d36499c Binary files /dev/null and b/modules/trash/3-1636374024.jpg differ diff --git a/modules/trash/3-1636374031.jpg b/modules/trash/3-1636374031.jpg new file mode 100644 index 00000000..1d36499c Binary files /dev/null and b/modules/trash/3-1636374031.jpg differ diff --git a/modules/trash/4-1636373736.jpg b/modules/trash/4-1636373736.jpg new file mode 100644 index 00000000..99be981e Binary files /dev/null and b/modules/trash/4-1636373736.jpg differ diff --git a/modules/trash/Git Cheat Sheet.pdf b/modules/trash/Git Cheat Sheet.pdf new file mode 100644 index 00000000..01a95dec Binary files /dev/null and b/modules/trash/Git Cheat Sheet.pdf differ diff --git a/modules/trash/shortcuts.txt b/modules/trash/shortcuts.txt new file mode 100644 index 00000000..d5e1eded --- /dev/null +++ b/modules/trash/shortcuts.txt @@ -0,0 +1,14 @@ +multiples linies: alt+clic + +crear amb classe: label. + nom de classe + +ex: +section.footer =