From b1689d03b0ac8a601f3ff4a225729d1e15b317ba Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 12 Feb 2021 19:09:42 +0200 Subject: almost there --- php/node.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'php/node.php') diff --git a/php/node.php b/php/node.php index 62b9ad2..3d56d99 100644 --- a/php/node.php +++ b/php/node.php @@ -7,25 +7,26 @@ require_once "user.php"; /*path is in terms of the simulated filesystem*/ function get_directory(string $abstract_path,User $user) { + global $database; if($abstract_path[0]!="/") { return NULL; } if($component=strtok($abstract_path,"/")==false) { - return NULL; + return $database->get_links_of($user->home_directory); } - $current_dir=$database->get_node($component,$user->home_directory); + $current_dir=$database->get_node_id($component,$user->home_directory); if($current_dir==NULL) return NULL; /*traverse path*/ while($component=strtok("/")) { - $current_dir=get_node($component,$current_dir); + $current_dir=$database->get_node_id($component,$current_dir); if($current_dir==NULL) return NULL; } - return get_links_of(NULL,$current_dir); + return $database->get_links_of($current_dir); } ?> -- cgit v1.2.3