setContent($content); $note->setTags($_POST["tag"]); $note->save($env->db()); if (isset($_FILES['attachments'])) Attachment::createFromUploads($env->db(), $env->attachmentsPath(), $note, $_FILES['attachments']); $url = $env->documentRoot() . "n/" . $note->getId(); if ($_POST["create_and_new"]) { $templateData["success"] = true; } else { http_response_code(303); header("Location: {$url}"); echo 'Note created: '; return; } } echo $env->twig()->render("/new_note.twig", $templateData); } }