aboutsummaryrefslogtreecommitdiffstats
path: root/php/node.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 19:09:42 +0200
committeradam <adam@>2021-02-12 19:09:42 +0200
commitb1689d03b0ac8a601f3ff4a225729d1e15b317ba (patch)
tree81476c675a5787a071a8a854aebb58293b6496b2 /php/node.php
parent705f95545b1f6520ce1fb9c39c6f826484c780bf (diff)
downloadfileup-b1689d03b0ac8a601f3ff4a225729d1e15b317ba.tar.gz
almost there
Diffstat (limited to 'php/node.php')
-rw-r--r--php/node.php9
1 files changed, 5 insertions, 4 deletions
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);
}
?>