commit 5458fc8f7f90d2f751a458e22e54d232aac361a2
parent 9c69f0b14db3754cab84272ba564a9c442694791
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Tue, 29 Oct 2024 12:09:02 +0100
fix: use base64 encoded path for note and deletion ID
Diffstat:
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/lib/list.php b/lib/list.php
@@ -30,13 +30,15 @@ function list_notes(
/* loop through each filename and draw a table row */
foreach ($filenames as $filename) {
+
+ /* create id for list item */
+ $note_id = base64_encode(
+ $filename["category"] . "_" . $filename["name"]
+ );
?>
<!-- note list item -->
- <div
- id="<?php echo $filename["category"] . "_" . $filename["name"]; ?>"
- class="list_item"
- >
+ <div id="<?php echo $note_id; ?>" class="list_item">
<?php
/* if note starts with an URL, link it in the title
@@ -114,17 +116,10 @@ function list_notes(
<span class="inline">|</span>
<!-- delete button -->
-<?php
- $del_id = hash(
- "sha256",
- $user . "/" . $filename["category"] . "/" . $filename["name"],
- false
- );
-?>
<form
action="/"
method="post"
- id="<?php echo $del_id; ?>"
+ id="<?php echo "del_" . $note_id; ?>"
class="inline"
>
<input
@@ -149,7 +144,7 @@ function list_notes(
class="danger likeanchor"
type="button"
value="<?php echo $GLOBALS["i18n_delete"]; ?>"
- onclick="deletion_confirm('<?php echo $del_id; ?>');"
+ onclick="deletion_confirm('<?php echo "del_" . $note_id; ?>');"
>
</form>