summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/browse.php8
-rw-r--r--www/functions/func_folder.php2
2 files changed, 7 insertions, 3 deletions
diff --git a/www/browse.php b/www/browse.php
index 468401a..7594cd4 100644
--- a/www/browse.php
+++ b/www/browse.php
@@ -3,12 +3,13 @@
function print_browser($content){
- require_once("include.php");
+// require_once("include.php");
if($_SERVER['REQUEST_METHOD'] == 'POST'){
//echo "created_folder : ". $_POST["foldername"] . " in ". $_GET["folder"];
- create_folder("/".$_GET["folder"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/);
- browse(collect_content($GLOBALS["db"], $_GET["name"] , $_GET["folder"]));
+
+ create_folder($_POST["path"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/);
+ browse(collect_content($GLOBALS["db"], $_SESSION["username"] , $_POST["path"]));
}else{
browse(collect_content($GLOBALS["db"], $_GET["name"] , $_GET["folder"]));
}
@@ -47,6 +48,7 @@ function browse($content){
<h1 class="new-folder-"> New Folder </h1>
<form id="new-folder-form" method="post" action="'.$_GET["name"].$_GET["folder"].'">
<input class="new-folder-input" id="new-folder-name" type="text" placeholder="name" name="foldername" required>
+ <input type="hidden" value="'.$_GET["folder"].'" name="path">
<label style="display:inline">Public</label><input style="display:inline; margin-left: 5px;" class="new-folder-input" type="checkbox" name="public">
<input style="display:block" onclick="hideNewFolder()" type="submit" id="button-input" class="new-folder-input" value="create">
</form>
diff --git a/www/functions/func_folder.php b/www/functions/func_folder.php
index 376cdd6..7a2233b 100644
--- a/www/functions/func_folder.php
+++ b/www/functions/func_folder.php
@@ -17,6 +17,8 @@ function create_folder($path, $new_folder_name, $share){
return MKDIR_OWNER;
}
+// echo "path: ".$path." file_id: ".$file_id." userid: ".$_SESSION['userid']." new_folder_name: ".$new_folder_name." share: ".$share."<br>"; exit;
+
if($db->exec("
BEGIN TRANSACTION;
INSERT INTO files (id, parent, owner, name, folder, size, share, hash) VALUES (Null, " . $file_id . ", " . $_SESSION['userid'] . ", '" . SQLite3::escapeString($new_folder_name) . "', 'DIRECTORY', 0, '" . SQLite3::escapeString($share) . "', '');