commit 1f5e301f4feeabae6d63b6051360029db62c5dbe
parent 511ff0a579d6d5f0076370ee5ffd60745ef60a93
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Fri, 25 Oct 2024 12:35:53 +0200
fix: minor bug-fixes; fix: move sorting-function to helpers
Diffstat:
5 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/lib/edit.php b/lib/edit.php
@@ -1,7 +1,3 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later
- * SPDX-FileCopyrightText: 2024 JayVii <jayvii[AT]posteo[DOT]de>
- */
-
<?php
function edit_note(
@@ -24,14 +20,14 @@ function edit_note(
id="category"
name="category"
type="text"
- value="<?php echo $category"; ?>"
+ value="<?php echo $category; ?>"
>
<label for="filename"><?php echo $GLOBALS["i18n_filename"]; ?></label>
<input
id="filename"
name="filename"
type="text"
- value="<?php echo $filename"; ?>"
+ value="<?php echo $filename; ?>"
>
<input
id="filename_t1"
diff --git a/lib/helpers.php b/lib/helpers.php
@@ -0,0 +1,8 @@
+<?php
+
+function sort_by_time($a, $b) {
+ // sort from oldest to newest (reversed)
+ return $b["time"] - $a["time"];
+}
+
+?>
diff --git a/lib/list.php b/lib/list.php
@@ -1,7 +1,3 @@
-<!-- SPDX-License-Identifier: AGPL-3.0-or-later
- SPDX-FileCopyrightText: 2024 JayVii <jayvii[AT]posteo[DOT]de>
--->
-
<?php
function list_notes(
@@ -31,7 +27,6 @@ function list_notes(
}
/* Sort filenames by edit timestamp */
- function sort_by_time($a, $b) { return $b["time"] - $a["time"]; }
usort($filenames, "sort_by_time");
?>
diff --git a/lib/read.php b/lib/read.php
@@ -1,7 +1,3 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later
- * SPDX-FileCopyrightText: 2024 JayVii <jayvii[AT]posteo[DOT]de>
- */
-
<?php
function read_note(
diff --git a/lib/write.php b/lib/write.php
@@ -1,7 +1,3 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later
- * SPDX-FileCopyrightText: 2024 JayVii <jayvii[AT]posteo[DOT]de>
- */
-
<?php
function write_note(