From cfc5bf135b131827f8b269f2daebe614f8baa56e Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 13 Feb 2021 12:44:19 +0200 Subject: stuff --- php/node.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'php/node.php') diff --git a/php/node.php b/php/node.php index d7c2a6c..a9a6f9b 100644 --- a/php/node.php +++ b/php/node.php @@ -6,20 +6,24 @@ require_once "user.php"; /*path is in terms of the simulated filesystem*/ function get_directory(string $abstract_path,User $user) { + error_log("getting directory".$abstract_path." for ".$user->username); + global $database; - if($abstract_path[0] != "/") { + if($abstract_path[0] != "/") + { return NULL; } - $component = strtok($abstract_path,"/"); - $current_dir = $user->home_directory; + $component = strtok($abstract_path,"/"); + $current_dir = $user->home_directory; - while ($component) { + while($component) + { $current_dir = $database->get_node_id($component, $current_dir); - $component = strtok("/"); - }; + $component = strtok("/"); + } - return $current_dir; + return $current_dir; } /*returns an assoc arrat of Node-s*/ @@ -39,6 +43,7 @@ require_once "user.php"; global $database; $parent_dir_id=get_directory($abstract_path,$user); + if($database->check_if_name_is_taken($directory_name,$parent_dir_id)) { return NULL; -- cgit v1.2.3 From 8f8d22109484308255d16f318cb488b3c8519885 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 13 Feb 2021 13:26:36 +0200 Subject: added trash folder on user creation --- php/node.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'php/node.php') diff --git a/php/node.php b/php/node.php index a9a6f9b..5074082 100644 --- a/php/node.php +++ b/php/node.php @@ -1,12 +1,10 @@ username); global $database; if($abstract_path[0] != "/") -- cgit v1.2.3