diff options
author | Alex Vitkov <alexvitkov98@gmail.com> | 2021-02-14 09:40:14 +0200 |
---|---|---|
committer | Alex Vitkov <alexvitkov98@gmail.com> | 2021-02-14 09:40:14 +0200 |
commit | e42f26d37a4afee40b49aa7c1357695656acfd6c (patch) | |
tree | 9ba01584926eacd8a8011290c7cbbd9d5dd520eb /php/node.php | |
parent | e55c72279c25617f441049ab0be6fd6843eecdd5 (diff) | |
parent | c7a6eb6587b285f59a7c2c4bae9a7aa4ef8247e1 (diff) | |
download | fileup-e42f26d37a4afee40b49aa7c1357695656acfd6c.tar.gz |
Merge branch 'master' of https://github.com/alexvitkov/india
Diffstat (limited to 'php/node.php')
-rw-r--r-- | php/node.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/php/node.php b/php/node.php index 666d540..c86beae 100644 --- a/php/node.php +++ b/php/node.php @@ -10,6 +10,12 @@ require_once "user.php"; public $type; public $code; } + class Shared_Node + { + public $node_id; + public $code; + public $password; + } /*path is in terms of the simulated filesystem*/ /*returns NULL on error*/ function get_directory(string $abstract_path,User $user) @@ -86,22 +92,22 @@ require_once "user.php"; { return NULL; } - if($database->create_shared_node($password,$node_id)==false) + $shared_node=$database->create_shared_node($password,$node_id); + if($shared_node==NULL) { return NULL; } - $code=$database->get_code_of_node($node_id); - if($code==NULL) - { - return NULL; - } + if($can_read) + $database->give_view_access($node_id,$user->user_id); + if($can_write) + $database->give_edit_access($node_id,$user->user_id); if($use_https) { - return "https://".$domain_name."/php/share.php?file=".$code; + return "https://".$domain_name."/php/share.php?file=".$shared_node->code; }else { - return "http://".$domain_name."/php/share.php?file=".$code; + return "http://".$domain_name."/php/share.php?file=".$shared_node->code; } } |