aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 16:53:11 +0200
committeradam <adam@>2021-02-12 16:53:11 +0200
commitfe005fb926ad568333655a0794338516e4af5b9d (patch)
tree5c746b077687b411a99f0feb1652813c047ba6dd
parent6a6c2249ddc649bb114ce8a5cc619ae16a43d20f (diff)
downloadfileup-fe005fb926ad568333655a0794338516e4af5b9d.tar.gz
asdf
-rw-r--r--php/database.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/php/database.php b/php/database.php
index 74a0dd4..0c5f9a8 100644
--- a/php/database.php
+++ b/php/database.php
@@ -216,12 +216,20 @@ require_once "node.php";
function link_nodes(int $target_id,int $source_id,string $name,string $note)
{
$statement=$this->pdo->prepare("
- insert into
-
+ insert into node_links(directory_id,node_id,name,note)
+ values (:dir,:node,:name,:note)
");
+ $statement->bindParam(':dir',$target_id);
+ $statement->bindParam(':node',$source_id);
+ $statement->bindParam(':name',$name);
+ $statement->bindParam(':note',$note);
+ if($statement->execute()==false)
+ {
+ error_log("there was an error with the statement ni link_nodes");
+ }
}
/*returns the file name as it must be in the filesystem relative to the storage root*/
- function create_file_node(string $filename,int $dir_id): string
+ function create_file_node(string $filename,string $note,int $dir_id): string
{
global $storage_root;
/*checkout the directory*/
@@ -256,7 +264,7 @@ require_once "node.php";
$prep=$this->pdo->prepare("insert into nodes(is_directory,relative_path,code)
values(false,:root,:code)
");
- $prep->bindParam(':root',$storage_root);
+ $prep->bindParam(':root',"/".$code);
$prep->bindParam(':code',$code);
if($prep->execute()==false)
@@ -265,7 +273,9 @@ require_once "node.php";
/*not so quiet error*/
return "error";
}
+ $new_id=get_node_with_code($code);
/*link the node to the directory*/
+ link_nodes($dir_id,$new_id,$filename,$note);
return $code;
}
/*checks if there is a link between two node_id-s*/