aboutsummaryrefslogtreecommitdiffstats
path: root/php/node.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 16:40:24 +0200
committeradam <adam@>2021-02-12 16:40:24 +0200
commit0c3d535a341dcefd702982715f6d20275a0f512d (patch)
treebdc6249da1f2d6d4a7975d192537511017df9354 /php/node.php
parent75640897d7ae44f10b9dde091d4b8dcba8e23776 (diff)
downloadfileup-0c3d535a341dcefd702982715f6d20275a0f512d.tar.gz
stuff
Diffstat (limited to 'php/node.php')
-rw-r--r--php/node.php35
1 files changed, 20 insertions, 15 deletions
diff --git a/php/node.php b/php/node.php
index 6e00a4b..62b9ad2 100644
--- a/php/node.php
+++ b/php/node.php
@@ -1,26 +1,31 @@
<?php
require_once "database.php";
+require_once "user.php";
- class Node
+
+ /*returns an assoc arrat of Node-s*/
+ /*path is in terms of the simulated filesystem*/
+ function get_directory(string $abstract_path,User $user)
{
- public $node_id;
- public $is_directory;
- public $relative_path;
- public $type;
- public $name;
- public $note;
- function __construct($node_id)
+ if($abstract_path[0]!="/")
{
- $this->node_id=$node_id;
+ return NULL;
}
- }
- class Directory_Node extends Node
- {
- public $node_list;
- /*the path in terms of the simulated filesystem*/
- function __construct(string $abstract_path)
+ if($component=strtok($abstract_path,"/")==false)
+ {
+ return NULL;
+ }
+ $current_dir=$database->get_node($component,$user->home_directory);
+ if($current_dir==NULL)
+ return NULL;
+ /*traverse path*/
+ while($component=strtok("/"))
{
+ $current_dir=get_node($component,$current_dir);
+ if($current_dir==NULL)
+ return NULL;
}
+ return get_links_of(NULL,$current_dir);
}
?>