F diff --git a/php/database.php b/php/database.php --- a/php/database.php +++ b/php/database.php/* returns assoc array of nodes*/function get_links_of(int $node_id){- error_log("in get_links_of with argument {$node_id}");$statement=$this->pdo->prepare("select node_links.node_id as id,node_links.name as name,error_log("there was an error with the statement ni link_nodes");}}+ function check_if_name_is_taken(string $filename,int $dir_id):bool+ {+ if($this->get_node_id($filename,$dir_id)!=NULL)+ {+ return true;+ }else+ {+ return false;+ }++ }/*returns the file name as it must be in the filesystem relative to the storage root*/function create_file_node(string $filename,string $note,int $dir_id,string $mimetype,User $user): string{}/*check if node with given name exists*/- if($this->get_node_id($filename,$dir_id)!=NULL)+ if($this->check_if_name_is_taken($filename,$dir_id)){error_log("filename taken");return "filename taken";F diff --git a/php/node.php b/php/node.php --- a/php/node.php +++ b/php/node.phpfunction create_directory(string $abstract_path,string $directory_name,string $note,User $user){global $database;- $dir_id=$database->create_dangling_directory();+$parent_dir_id=get_directory($abstract_path,$user);- $database->link_nodes($parent_dir_id,$dir_id,$directory_name,$note);+ if($database->check_if_name_is_taken($directory_name,$parent_dir_id))+ {+ return NULL;+ }else+ {+ $dir_id=$database->create_dangling_directory();+ $database->link_nodes($parent_dir_id,$dir_id,$directory_name,$note);+ return $dir_id;+ }}?>F diff --git a/php/readdir.php b/php/readdir.php --- a/php/readdir.php +++ b/php/readdir.phprequire_once "node.php";session_start();$user=$_SESSION['user_object'];+ $path=$_POST['path'];//echo '[ { "name": "file1.txt", "mimetype": "text/plain", "is_directory": false }, { "name": "file2.pdf", "mimetype": "application/pdf", "is_directory": false }, { "name": "dir", "mimetype": "", "is_directory": true } ] ';- $ret=get_directory_contents("/",$user);+ $ret=get_directory_contents($path,$user);$json=json_encode($ret);echo $json;?>