pub / rememori

Simple file-based bookmarking and notes application
git clone https://src.jayvii.de/pub/rememori.git
Home | Log | Files | Exports | Refs | README | RSS

commit 7544233accd8763d61405a5f8590934072325708
parent 2658df9e50f6dba4d11475aa35f7e26f92b586be
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Fri, 25 Oct 2024 13:02:50 +0200

wip: implement show action

Diffstat:
Mindex.php | 15+++++++++++++--
Mlib/edit.php | 6++++++
Mlib/list.php | 2+-
Mlib/read.php | 2+-
4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/index.php b/index.php @@ -5,7 +5,9 @@ <?php /* DEVELOPMENT SETTINGS */ - $_POST["action"] = "list_all"; + if (is_null($_POST["action"])) { + $_POST["action"] = "list_all"; + } $_POST["user"] = "test_user"; /* Load library functions */ @@ -60,7 +62,7 @@ id="action" name="action" type="hidden" - value="edit" + value="show" > <input type="submit" @@ -83,6 +85,15 @@ } } + /* Show action */ + if ($_POST["action"] == "show") { + edit_note( + $_POST["user"], + $_POST["category"], + $_POST["filename"] + ); + } + ?> </body> diff --git a/lib/edit.php b/lib/edit.php @@ -35,6 +35,12 @@ function edit_note( type="hidden" value="<?php echo $user . "/" . $category . "/" . $filename; ?>" > + <input + id="action" + name="action" + type="hidden" + value="edit" + > <input type="submit" value="<?php echo $GLOBALS["i18n_save"]; ?>"> </form> diff --git a/lib/list.php b/lib/list.php @@ -80,7 +80,7 @@ function list_notes( id="action" name="action" type="hidden" - value="edit" + value="show" > <input type="submit" diff --git a/lib/read.php b/lib/read.php @@ -17,7 +17,7 @@ function read_note( ); /* Read from file */ - $content = fread($file); + $content = fread($file, filesize($filepath)); /* return content.If reading fails, returns "false" */ return $content;