From 871ffe01d02ca899aa01550d601b75052dfb4ed6 Mon Sep 17 00:00:00 2001 From: Felix Ivo Date: Mon, 30 Jun 2025 10:37:43 +0200 Subject: [PATCH] removed isEditMode --- Views/Notes/createNote.phtml | 24 ++++++------------------ Views/Notes/editNote.phtml | 29 ++++++++++++----------------- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/Views/Notes/createNote.phtml b/Views/Notes/createNote.phtml index e67340d..f014524 100644 --- a/Views/Notes/createNote.phtml +++ b/Views/Notes/createNote.phtml @@ -7,16 +7,7 @@ $parsedown->setSafeMode(true); $this->notesModel = new \ppa\Model\NotesModel(); -$isEditMode = false; $note = null; -if ($isEditMode) { - $noteId = $_GET['id'] ?? 0; - $note = $this->notesModel->getNoteById($noteId, $_SESSION['user_id']); - if (!$note) { - echo "
Note not found or you don't have permission to edit it.
"; - echo "Back to Dashboard"; - } -} function isLoggedIn() { return isset($_SESSION['user_id']); @@ -34,33 +25,30 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
Drag & drop a .txt or .md file here, or fill manually.
- - - - +
- +
- +
- text(sanitize($note['content'])); else echo "Start typing or drop a file to see preview..."; ?> + Start typing or drop a file to see preview...
- +
diff --git a/Views/Notes/editNote.phtml b/Views/Notes/editNote.phtml index 1cd33f5..df170ea 100644 --- a/Views/Notes/editNote.phtml +++ b/Views/Notes/editNote.phtml @@ -7,15 +7,12 @@ $parsedown->setSafeMode(true); $this->notesModel = new \ppa\Model\NotesModel(); -$isEditMode = true; $note = null; -if ($isEditMode) { - $noteId = $_GET['id'] ?? 0; - $note = $this->notesModel->getNoteById($noteId, $_SESSION['user_id']); - if (!$note) { - echo "
Note not found or you don't have permission to edit it.
"; - echo "Back to Dashboard"; - } +$noteId = $_GET['id'] ?? 0; +$note = $this->notesModel->getNoteById($noteId, $_SESSION['user_id']); +if (!$note) { + echo "
Note not found or you don't have permission to edit it.
"; + echo "Back to Dashboard"; } function isLoggedIn() { @@ -34,33 +31,31 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
Drag & drop a .txt or .md file here, or fill manually.
- - - - + +
- +
- +
- text(sanitize($note['content'])); else echo "Start typing or drop a file to see preview..."; ?> + text(sanitize($note['content'])); else echo "Start typing or drop a file to see preview..."; ?>
- +