aboutsummaryrefslogtreecommitdiffstats
path: root/php/node.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/node.php')
-rw-r--r--php/node.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/php/node.php b/php/node.php
index b3b2c3f..c2ab5f1 100644
--- a/php/node.php
+++ b/php/node.php
@@ -43,9 +43,17 @@ require_once "user.php";
function 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;
+ }
}
?>