diff --git a/Model/NotesModel.php b/Model/NotesModel.php index d4c6d7c..82fb70e 100644 --- a/Model/NotesModel.php +++ b/Model/NotesModel.php @@ -94,6 +94,11 @@ class NotesModel extends Database $params = [trim($title), $content, $noteId, $userId]; } $stmt->execute($params); + + $uploadResult = $this->uploadFiles($noteId); + if (!$uploadResult['success']) { + return $uploadResult; + } if ($stmt->rowCount() > 0) { return ['success' => true, 'message' => 'Note updated successfully.']; @@ -148,6 +153,19 @@ class NotesModel extends Database } } + function getFileCount() { + $pdo = $this->linkDB(); + if (!$pdo) return 0; + try { + $stmt = $pdo->prepare("SELECT COUNT(*) FROM files"); + $stmt->execute(); + return $stmt->fetchColumn(); + } catch (PDOException $e) { + error_log("Get Files Count Error: " . $e->getMessage()); + return 0; + } + } + function getNoteCount() { $pdo = $this->linkDB(); if (!$pdo) return 0; diff --git a/Views/Notes/createNote.phtml b/Views/Notes/createNote.phtml index 9df15fb..cbd9d25 100644 --- a/Views/Notes/createNote.phtml +++ b/Views/Notes/createNote.phtml @@ -67,7 +67,6 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') { -