aboutsummaryrefslogtreecommitdiffstats
path: root/php/node.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-13 23:24:31 +0200
committeradam <adam@>2021-02-13 23:24:31 +0200
commitc7a6eb6587b285f59a7c2c4bae9a7aa4ef8247e1 (patch)
tree970b84eb7103248e10d2a713850e0a314d921aa8 /php/node.php
parent3005c7774d4f32dc857a9b10c4e621f4df2019c4 (diff)
downloadfileup-c7a6eb6587b285f59a7c2c4bae9a7aa4ef8247e1.tar.gz
generates different code links
Diffstat (limited to 'php/node.php')
-rw-r--r--php/node.php22
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;
}
}