diff options
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); } ?> |