diff --git a/functions/blocknotes.php b/functions/blocknotes.php index 8a17446..cba14d3 100644 --- a/functions/blocknotes.php +++ b/functions/blocknotes.php @@ -419,3 +419,31 @@ function delete_subnote($blocknote_id, $note_id, $sub_id, $username, $is_admin) } return ['success' => false, 'message' => 'Errore nel salvataggio.']; } + +/** + * Compatibility Aliases + */ +function add_note_to_blocknote($blocknote_id, $title, $description, $username, $is_admin) { + return add_note($blocknote_id, $title, $description, $username, $is_admin); +} + +function edit_note_in_blocknote($blocknote_id, $note_id, $title, $description, $username, $is_admin) { + return edit_note($blocknote_id, $note_id, $title, $description, $username, $is_admin); +} + +function delete_note_from_blocknote($blocknote_id, $note_id, $username, $is_admin) { + return delete_note($blocknote_id, $note_id, $username, $is_admin); +} + +function add_subnote_to_note($blocknote_id, $note_id, $sub_title, $type, $content, $username, $is_admin) { + return add_subnote($blocknote_id, $note_id, $sub_title, $type, $content, $username, $is_admin); +} + +function edit_subnote_in_note($blocknote_id, $note_id, $sub_id, $sub_title, $type, $content, $username, $is_admin) { + return edit_subnote($blocknote_id, $note_id, $sub_id, $sub_title, $type, $content, $username, $is_admin); +} + +function delete_subnote_from_note($blocknote_id, $note_id, $sub_id, $username, $is_admin) { + return delete_subnote($blocknote_id, $note_id, $sub_id, $username, $is_admin); +} + diff --git a/includes/js_footer.php b/includes/js_footer.php index e335211..c07e2e5 100644 --- a/includes/js_footer.php +++ b/includes/js_footer.php @@ -1,3 +1,5 @@ \ No newline at end of file diff --git a/pages/view_blocknote.php b/pages/view_blocknote.php index 6a009df..3eeada7 100644 --- a/pages/view_blocknote.php +++ b/pages/view_blocknote.php @@ -19,22 +19,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; if ($action === 'add_note') { - $res = add_note_to_blocknote($blocknote_id, $_POST['title'] ?? '', $_POST['description'] ?? '', $user['username'], is_admin()); + $res = add_note($blocknote_id, $_POST['title'] ?? '', $_POST['description'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; } elseif ($action === 'edit_note') { - $res = edit_note_in_blocknote($blocknote_id, $_POST['note_id'] ?? '', $_POST['title'] ?? '', $_POST['description'] ?? '', $user['username'], is_admin()); + $res = edit_note($blocknote_id, $_POST['note_id'] ?? '', $_POST['title'] ?? '', $_POST['description'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; } elseif ($action === 'delete_note') { - $res = delete_note_from_blocknote($blocknote_id, $_POST['note_id'] ?? '', $user['username'], is_admin()); + $res = delete_note($blocknote_id, $_POST['note_id'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; } elseif ($action === 'add_subnote') { - $res = add_subnote_to_note($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_title'] ?? '', $_POST['type'] ?? 'text', $_POST['content'] ?? '', $user['username'], is_admin()); + $res = add_subnote($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_title'] ?? '', $_POST['type'] ?? 'text', $_POST['content'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; } elseif ($action === 'edit_subnote') { - $res = edit_subnote_in_note($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_id'] ?? '', $_POST['sub_title'] ?? '', $_POST['type'] ?? 'text', $_POST['content'] ?? '', $user['username'], is_admin()); + $res = edit_subnote($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_id'] ?? '', $_POST['sub_title'] ?? '', $_POST['type'] ?? 'text', $_POST['content'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; } elseif ($action === 'delete_subnote') { - $res = delete_subnote_from_note($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_id'] ?? '', $user['username'], is_admin()); + $res = delete_subnote($blocknote_id, $_POST['note_id'] ?? '', $_POST['sub_id'] ?? '', $user['username'], is_admin()); if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message']; }