F diff --git a/php/database.php b/php/database.php --- a/php/database.php +++ b/php/database.php$this->pdo=new PDO("mysql:dbname={$database_name};host={$database_location}",$database_username,$database_password);}- /*returns false if this isn't a user, otherwise returns the user*/+ /*returns NULL if this isn't a user, otherwise returns the user*/function get_user(string $user){$ret=new User;$hold=$prep->fetch(PDO::FETCH_ASSOC);- if($hold)+ if(isset($hold["user_id"])){$ret->user_id=$hold["user_id"];$ret->username=$hold["username"];$ret->email_address=$hold["email"];- $ret->current_directory=$hold["home_directory"];+ $ret->home_directory=$hold["home_directory"];return $ret;}else{- return false;+ return NULL;}}/*returns false if this isn't a user or the password is incorrect, otherwise returns the userid*/$ret=$this->create_dangling_directory();$trash_folder_id=$this->create_dangling_directory();$this->link_nodes($ret,$trash_folder_id,"trash","trash folder");++ $share_folder_id=$this->create_dangling_directory();+ $this->link_nodes($ret,$share_folder_id,"share","shared things go in here");return $ret;}F diff --git a/php/node.php b/php/node.php --- a/php/node.php +++ b/php/node.php$parent_dir_id=get_directory($abstract_path,$user);$database->unlink_nodes($parent_dir_id,$filename);}- function create_share_link(string $abstract_path,string $filename,string $password,User $user,bool $can_read,bool $can_write)+ function create_share_link(string $abstract_path,string $filename,string $password,+ User $user,bool $can_read,bool $can_write,$users){global $database;global $domain_name;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);+ $usernames=explode(',',$users);+ foreach($usernames as $username)+ {+ $usr=$database->get_user($username);+ if($usr==NULL)+ continue;+ error_log("sharing with $usr->username");++ if($can_read)+ $database->give_view_access($node_id,$usr->user_id);+ if($can_write)+ $database->give_edit_access($node_id,$usr->user_id);++ error_log("home directory is $usr->home_directory");+ $share_id=$database->get_node_id("share",$usr->home_directory);+ if($share_id==NULL)+ {+ error_log("could not find share directory for $username");+ }+ $database->link_nodes($share_id,$node_id,$filename,"this was shared to you");+ }if($use_https){return "https://".$domain_name."/php/share.php?file=".$shared_node->code;F diff --git a/php/share.php b/php/share.php --- a/php/share.php +++ b/php/share.phpexit(1);}- $share_link=create_share_link($path,$filename,$password,$user,$can_read,$can_write);+ error_log("someone is sharing ".$filename." with ".$users);+ $share_link=create_share_link($path,$filename,$password,$user,$can_read,$can_write,$users);//$share_link=create_share_link($path,$filename,$password,$user,true,true);