Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a54f7d3
added html code and styles.css. Styles are incomplete, but sufficient…
MarcSola Jun 22, 2021
0c6a5e4
css finish
alvaromergar Jun 23, 2021
efed67f
changed settings icon
MarcSola Jun 23, 2021
7dd631e
added newOptions popup and started its show functionality in jquery
MarcSola Jun 23, 2021
6f984c9
fixed popup new button functionality and now it shows and hides corre…
MarcSola Jun 24, 2021
d62a2e8
upload file started, but not finished
MarcSola Jun 24, 2021
62d058c
managed to fix the panel at last
MarcSola Jun 24, 2021
bf19f05
merged F1 into F2 after final popup fix
MarcSola Jun 24, 2021
294f4c5
template html
alvaromergar Jun 25, 2021
4dc7bb5
upload file works for now, but need to implement a better solution to…
MarcSola Jun 25, 2021
cbeda07
created create folder form and now Im going to branch to create new f…
MarcSola Jun 25, 2021
0205fb7
added create folder, but need to work on possible errors such as name…
MarcSola Jun 27, 2021
5ccbc92
added a class to createFolderFormInput to adapt its width in relation…
MarcSola Jun 27, 2021
68480a1
Merge branch 'develop' of https://github.com/MarcSola/filesystem-expl…
MarcSola Jun 28, 2021
00e2ec7
merged F2.2 into develop
MarcSola Jun 28, 2021
508b6bb
added basic rendering of files in main center
MarcSola Jun 28, 2021
d5dacdf
solved options render issue regarding folder link to update
MarcSola Jun 28, 2021
35f5331
added dot options panel for files and directories and added main left…
MarcSola Jun 28, 2021
b932a4b
created rename form and its listeners to show it and hide it. updateN…
MarcSola Jun 28, 2021
474daf2
progress
alvaromergar Jun 29, 2021
ad66885
added required to rename input
MarcSola Jun 29, 2021
bdcebb9
Merge branch 'F04-rmdir' into F4-Rename
MarcSola Jun 29, 2021
9912d74
rename validation finished. Update name to do
MarcSola Jun 29, 2021
1023f46
php for update needs to be done
MarcSola Jun 29, 2021
b078330
basic rename version without browsing done
MarcSola Jun 30, 2021
bb6912e
check onClick function for show data
alvaromergar Jun 30, 2021
92163bd
browsing still WIP
MarcSola Jun 30, 2021
41f2d3a
Finish function on click control data
alvaromergar Jun 30, 2021
28099d0
browsing done. Hugo is my dad
MarcSola Jun 30, 2021
3ecedcd
merged F04 into F6 successfully
MarcSola Jun 30, 2021
d913fe9
finished rename. it avoids file and folder replacement on rename
MarcSola Jul 1, 2021
71b7b9b
added browsing to upload file and create folder, but name replacement…
MarcSola Jul 1, 2021
9c5b08b
added code that prevents from replacement by naming and it works :D
MarcSola Jul 1, 2021
704a1ec
finish
alvaromergar Jul 1, 2021
e709708
finished preventing file and folder replacement by rename
MarcSola Jul 1, 2021
8b59ca2
Progress function delete
alvaromergar Jul 1, 2021
2015cde
Merge branch 'F6-IncludeBrowsingToFeatures' into F05-remove
alvaromergar Jul 1, 2021
0652d73
added icon change to main right header
MarcSola Jul 1, 2021
43821ab
in progress
alvaromergar Jul 1, 2021
c9afe3d
Merge branch 'F04-rmdir' into F05-remove
alvaromergar Jul 1, 2021
4c622fb
finish remove
alvaromergar Jul 1, 2021
991cc8e
Pruebas
alvaromergar Jul 1, 2021
4849884
added object for now to index.php, but we could add maybe a function …
MarcSola Jul 2, 2021
7c20268
Finish main create file and folder
alvaromergar Jul 2, 2021
f3a5f5b
everything is done except styling and audio and video need to be fixe…
MarcSola Jul 2, 2021
58d3568
time to merge
MarcSola Jul 3, 2021
26c08c6
todo ok
alvaromergar Jul 3, 2021
2fe4b88
fixed audio and video issues and everything was merged correctly
MarcSola Jul 3, 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
474 changes: 474 additions & 0 deletions assets/css/styles.css

Large diffs are not rendered by default.

Binary file added assets/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions includes/createFolder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

require("./updateDir.php");

if(isset($_POST['submitFolder'])){

// Establish folderUploadDir directory
$folderUploadDir = $_SESSION['currentPath'];

// Getting folderName input value
$folderName = $_POST['folderName'];
echo $folderName."<br>";

// Getting all dir items
$dirItemList = scandir($folderUploadDir);
$dirItemList = array_diff($dirItemList, array('.', '..'));
print_r($dirItemList); echo "<br>";

//Checking if folderName already exists and changing its value if so
foreach ($dirItemList as $dirItem){
if($dirItem === $folderName){

if(!strrpos($dirItem, ".", 0)){
echo "I'm in and \$dirItem is --> ".$dirItem."<br>";

if(strrpos($dirItem, "Copy", 0)){
$copyIndexString = (end(explode("Copy", $dirItem)));
echo "\$copyIndexString --> ".$copyIndexString."<br>";

if(empty($copyIndexString)){
$copyIndex = 1;
$newCopyIndex = (string)($copyIndex);

}else{
$copyIndex = (int)$copyIndexString;
$copyIndex +=1;
$newCopyIndex = (string)($copyIndex);

}
$folderName = str_replace("Copy".$copyIndexString, "Copy".$newCopyIndex, $folderName);
echo "new \$folderName -->".$folderName."<br>";

}else{
$folderName.="Copy";
echo "new \$folderName -->".$folderName."<br>";
}
}
}

}

// Completing directory path
$finalDirectoryPath = $folderUploadDir."/".$folderName;

// Create new folder permissions (0777 means everything allowed)
mkdir($finalDirectoryPath, 0777);

header("Location: ../index.php?foldercreationsuccess");
}

?>
25 changes: 25 additions & 0 deletions includes/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
session_start();
$dir = $_SESSION['currentPath'];
$target = $dir."/".$_GET["name"];
function remove($dir){
if (is_dir($dir)){
$objects = scandir($dir);
foreach ($objects as $object){
if($object != "." && $object != ".."){
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object)){
remove($dir . DIRECTORY_SEPARATOR . $object);
}else{
unlink($dir . DIRECTORY_SEPARATOR . $object);
}
}
}
rmdir($dir);
}else{
unlink($dir);
}
}
remove($target);
header("Location: ../index.php");


119 changes: 119 additions & 0 deletions includes/manageDirItems.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

// including update mechanism
require("updateDir.php");

// Getting dirPath
$dirPath = $_SESSION['currentPath'];
// $dirPath = "./root";

// Getting every item in dirPath
$dirPathItemList = scandir($dirPath);

// Renders items for current dirPath
function renderDirItemList($dirPath, $dirPathItemList){
for($i=2; $i<sizeof($dirPathItemList); $i++){
$fileName = $dirPathItemList[$i];
$fileExt = explode('.', $fileName);
$fileActualExt = strtolower(end($fileExt));

// Choosing file extension icon to render
switch($fileActualExt){
case 'doc':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-word-fill'></i></div>";
break;
case 'csv':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-excel-fill'></i></div>";
break;
case 'jpg':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-image-fill'></i></div>";
break;
case 'png':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-image-fill'></i></div>";
break;
case 'txt':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-text-fill'></i></div>";
break;
case 'ppt':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-ppt-fill'></i></div>";
break;
case 'odt':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-word-fill'></i></div>";
break;
case 'pdf':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-pdf-fill'></i></div>";
break;
case 'zip':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-zip-fill'></i></div>";
break;
case 'rar':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-zip-fill'></i></div>";
break;
case 'exe':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-code-fill'></i></div>";
break;
case 'svg':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-image-fill'></i></div>";
break;
case 'mp3':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-music-fill'></i></div>";
break;
case 'mp4':
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-file-play-fill'></i></div>";
break;
default:
$icon = "<div class='mainCenter__fileIcon'><i class='bi bi-folder-fill'></i></div>";
}

if(is_dir($dirPath."/".$fileName)){

echo "
<div class ='fileWrapper'>
<a class='renderUpdateLink clickMe' >"
.$icon.
"<div class='mainCenter__fileName' data-id='".$fileName."'>".$fileName."</div>
</a>
<i id='".$fileName."Rename' class='bi bi-pencil-square space'></i>
<a class='icon__delete space' href='./includes/delete.php?name=".$fileName."' ><i id='".$fileName." Delete' class='bi bi-trash-fill '></i></a>
</div>
";

}else{

echo "
<div class ='fileWrapper'>
<a class='renderUpdateLink clickMe' >"
.$icon.
"<div class='mainCenter__fileName' data-id='".$fileName."'>".$fileName."</div>
</a>
<i id='".$fileName."Rename' class='bi bi-pencil-square space'></i>
<a class='icon__delete space' href='./includes/delete.php?name=".$fileName."' ><i id='".$fileName."Delete' class='bi bi-trash-fill '></i></a>
</div>
";

}
}
}

function renderItemListLeft($dirPath, $dirPathItemList){
for($i=2; $i<sizeof($dirPathItemList); $i++){
$fileName = $dirPathItemList[$i];
$fileExt = explode('.', $fileName);
$fileActualExt = strtolower(end($fileExt));
if(is_dir($dirPath."/".$fileName)){
echo "
<div class='mainLeft__container'>
<a class='renderUpdateLink' href='./includes/updateDir.php?updateDir=".$dirPath."/".$fileName."'>
<div class='mainLeft__fileIcon'><i class='bi bi-folder-fill'></i></div>
<div class='mainLeft__fileName'>".$fileName."</div>
</a>
</div>
";
}
}
}
?>

<!--
libxml_disable_entity_loader./includes/manageDirItems.php?updateDir
-->
67 changes: 67 additions & 0 deletions includes/openFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

session_start();
$ruta = $_SESSION['currentPath'];

function dblClick($ruta){

// Getting file name
$Name = $_POST['filename'];

// Creating array of allowed extensions
$allowed = array('jpg', 'png', 'svg', 'mp3', 'mp4');

// Splitting Main path and getting start index for navBar
$splitMainPath = explode("/", $ruta);
$startIndexLocalPath = array_search("root", $splitMainPath, true);

// Constructing and setting up local dir path to render file
$localDirPath = "";
for($i = $startIndexLocalPath; $i < count($splitMainPath); $i++){
$localDirPath .=$splitMainPath[$i]."/";
}
if (is_dir($ruta)) {
$dh = opendir($ruta);
while (($file = readdir($dh)) !== false) {
if ($Name == $file){
$fileExt = explode('.', $Name);
$fileActualExt = strtolower(end($fileExt));

if(is_file($ruta."/".$file)) {
if(in_array($fileActualExt, $allowed)){
$nameData = $file;
$extensionData = $fileActualExt;
$arrayData = [
"name" => $nameData,
"extension" => $extensionData,
"objectDirPath" => $localDirPath.$file,
];
echo json_encode($arrayData);
}
}
}

}
closedir($dh);
}else
echo "<br>No es ruta valida";
}

dblClick($ruta);

// else{
// $nameData = $file;
// $dateData = date("d/m/Y", filemtime($ruta."/".$Name));
// $modificationData = date("d/m/Y", fileatime($ruta."/".$Name));
// $sizeData = "null";
// $extensionData = "null";
// $arrayData = [
// "name" => $nameData,
// "dataCreation" => $dateData,
// "modification" => $modificationData,
// "size" => $sizeData,
// "extension" => $extensionData,
// ];
// echo json_encode($arrayData);
// }
?>
54 changes: 54 additions & 0 deletions includes/showData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
session_start();
$ruta = $_SESSION['currentPath'];
function listar_directorios_ruta($ruta){
$Name = $_POST['prueba'];
if (is_dir($ruta)) {
$dh = opendir($ruta);
while (($file = readdir($dh)) !== false) {
if ($Name == $file){
if(is_file($ruta."/".$file)) {
function human_filesize($bytes, $decimals = 2){
$sz = "BKMGTP";
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow (1024, $factor)) . @$sz[$factor];
}
$fileExtension = strstr($file, '.');
$fileName = strstr($file, '.', true);
$nameData = $fileName;
$dateData = date("d/m/Y", filemtime($ruta."/".$Name));
$modificationData = date("d/m/Y", fileatime($ruta."/".$Name));
$sizeData = human_filesize(filesize($ruta."/".$file));
$extensionData = $fileExtension;
$arrayData = [
"name" => $nameData,
"dataCreation" => $dateData,
"modification" => $modificationData,
"size" => $sizeData,
"extension" => $extensionData,
];
echo json_encode($arrayData);
}else{
$nameData = $file;
$dateData = date("d/m/Y", filemtime($ruta."/".$Name));
$modificationData = date("d/m/Y", fileatime($ruta."/".$Name));
$sizeData = "null";
$extensionData = "null";
$arrayData = [
"name" => $nameData,
"dataCreation" => $dateData,
"modification" => $modificationData,
"size" => $sizeData,
"extension" => $extensionData,
];
echo json_encode($arrayData);
}
}

}
closedir($dh);

}else
echo "<br>No es ruta valida";
}
listar_directorios_ruta($ruta);
21 changes: 21 additions & 0 deletions includes/updateDir.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
if(!isset($_SESSION))
{
session_start();
}

if(!isset($_SESSION['currentPath'])){
// echo "I'm in <br>";
$_SESSION['currentPath'] = $_SESSION['base_url'] . "/root";
$_SESSION['mainRootPath'] = $_SESSION['base_url'] . "/root";

}else if(isset($_GET['updateDir'])){

$_SESSION['currentPath'] = $_GET['updateDir'];
header("Location: ../index.php");
}

// echo $_SESSION['currentPath'];
// echo "I am the main root path --> ".$_SESSION['mainRootPath'];

?>
34 changes: 34 additions & 0 deletions includes/updateDirNavBar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
function renderDirBrowsingNavBar(){

// Splitting Main path and getting start index for navBar
$splitMainPath = explode("/", $_SESSION["currentPath"]);
$startIndexNavbar = array_search("root", $splitMainPath, true) + 1;

// $hrefDirPath = $splitMainPath[$startIndexNavbar];
// $hrefDirPath = $splitMainPath[$startIndexNavbar]."/";
echo "
<a class='render__route' href='./includes/updateDir.php?updateDir=".$_SESSION['mainRootPath']."'>
My Unity
</a>";
// <a class='renderUpdateLink' href='./includes/updateDir.php?updateDir=".$_SESSION['mainRootPath']."/'>

// Aux variable for dir path
$hrefDirPath = "/";

for($i = $startIndexNavbar; $i < sizeof($splitMainPath); $i++){

// Rendering NavBar in relation to Main path
$hrefDirPath = $hrefDirPath.$splitMainPath[$i];
// $hrefDirPath = $hrefDirPath.$splitMainPath[$i]."/";
echo "
<a class='render__route' href='./includes/updateDir.php?updateDir=".$_SESSION['mainRootPath'].$hrefDirPath."'>/".
$splitMainPath[$i]."
</a>";

$hrefDirPath = $hrefDirPath."/";
}

}

?>
Loading