diff options
author | adam <adam@> | 2021-02-12 22:35:02 +0200 |
---|---|---|
committer | adam <adam@> | 2021-02-12 22:35:02 +0200 |
commit | b79da4bf1b39d6b203a083c7bcbef106dff06eaa (patch) | |
tree | 29db21995263495b9614f00ee1dccca4be76adaa /php/node.php | |
parent | 022e478554fdb7110f3029fab49f706ba1d893ad (diff) | |
download | fileup-b79da4bf1b39d6b203a083c7bcbef106dff06eaa.tar.gz |
mkdir
Diffstat (limited to 'php/node.php')
-rw-r--r-- | php/node.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/php/node.php b/php/node.php index 3d56d99..b3b2c3f 100644 --- a/php/node.php +++ b/php/node.php @@ -3,7 +3,6 @@ require_once "database.php"; require_once "user.php"; - /*returns an assoc arrat of Node-s*/ /*path is in terms of the simulated filesystem*/ function get_directory(string $abstract_path,User $user) { @@ -14,7 +13,7 @@ require_once "user.php"; } if($component=strtok($abstract_path,"/")==false) { - return $database->get_links_of($user->home_directory); + return $user->home_directory; } $current_dir=$database->get_node_id($component,$user->home_directory); if($current_dir==NULL) @@ -26,7 +25,27 @@ require_once "user.php"; if($current_dir==NULL) return NULL; } - return $database->get_links_of($current_dir); + return $current_dir; + } + + /*returns an assoc arrat of Node-s*/ + /*path is in terms of the simulated filesystem*/ + function get_directory_contents(string $abstract_path,User $user) + { + global $database; + $dir_id=get_directory($abstract_path,$user); + if($dir_id==NULL) + return NULL; + return $database->get_links_of($dir_id); + } + + /*path is in terms of the simulated filesystem*/ + function create_directory(string $abstract_path,string $directory_name,string $note,User $user) + { + global $database; + $dir_id=$database->create_dangling_directory(); + $parent_dir_id=get_directory($abstract_path,$user); + $database->link_nodes($parent_dir_id,$dir_id,$directory_name,$note); } ?> |