$dms, 'user'=>$user)); /* Check if the form data comes from a trusted request */ if(!checkFormKey('addsubfolder')) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token")); } if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_POST["folderid"]; $folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderPathHTML = getFolderPathHTML($folder, true); if ($folder->getAccessMode($user, 'addFolder') < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); } $sequence = $_POST["sequence"]; $sequence = str_replace(',', '.', $_POST["sequence"]); if (!is_numeric($sequence)) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_sequence")); } $name = $_POST["name"]; $comment = $_POST["comment"]; if(isset($_POST["attributes"])) $attributes = $_POST["attributes"]; else $attributes = array(); /* foreach($attributes as $attrdefid=>$attribute) { $attrdef = $dms->getAttributeDefinition($attrdefid); if($attribute) { if(!$attrdef->validate($attribute)) { $errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $errmsg); } } elseif($attrdef->getMinValues() > 0) { UI::exitError(getMLText("folder_title", array("foldername" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName()))); } } */ /* Check if additional notification shall be added */ $notusers = array(); if(!empty($_POST['notification_users'])) { foreach($_POST['notification_users'] as $notuserid) { $notuser = $dms->getUser($notuserid); if($notuser) { $notusers[] = $notuser; } } } $notgroups = array(); if(!empty($_POST['notification_groups'])) { foreach($_POST['notification_groups'] as $notgroupid) { $notgroup = $dms->getGroup($notgroupid); if($notgroup) { $notgroups[] = $notgroup; } } } /* Check if name already exists in the folder */ if(!$settings->_enableDuplicateSubFolderNames) { if($folder->hasSubFolderByName($name)) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("subfolder_duplicate_name")); } } $controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('folder', $folder); $controller->setParam('name', $name); $controller->setParam('comment', $comment); $controller->setParam('sequence', $sequence); $controller->setParam('attributes', $attributes); $controller->setParam('notificationgroups', $notgroups); $controller->setParam('notificationusers', $notusers); if(!$subFolder = $controller()) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg())); } else { // Send notification to subscribers. if($notifier) { $notifier->sendNewFolderMail($subFolder, $user); } } add_log_line("?name=".$name."&folderid=".$folderid); header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_POST["showtree"]); ?>