From 74d2c4f86d57272f8d916835de7772406efa3650 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Fri, 16 Feb 2024 17:35:06 +0100 Subject: [PATCH] change gui use combobox to select action --- index.php | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/index.php b/index.php index 215f332..c1a95e7 100644 --- a/index.php +++ b/index.php @@ -46,23 +46,30 @@ echo '
home

'; - if (isset($_POST['savebutton'])) + $action = ''; + if (isset($_POST['action'])) $action = $_POST['action']; + else if (isset($_GET['action'])) $action = $_GET['action']; + + $param = ''; + if (isset($_GET['param'])) $param = $_GET['param']; + + if ($action == 'save') { $title = $_POST['title']; $content = $_POST['content']; file_put_contents($dir . '/' . $title, $content); - $_GET['openaction'] = true; - $_GET['userdata'] = $title; + $action = 'open'; + $param = $title; } - else if (isset($_POST['deletebutton'])) + else if ($action == 'delete') { $title = $_POST['title']; rename($dir . '/' . $title, $dir . '/' . $title . '.del'); } - if (isset($_GET['openaction'])) + if ($action == 'open') { - $title = $_GET['userdata']; + $title = $param; $content = ''; if (!file_exists($dir . '/' . $title)) @@ -78,8 +85,11 @@ echo '
- - + +


@@ -91,15 +101,18 @@ else { $defaulttitle = date("Y-m-d H.i.s", time()); - if (isset($_GET['userdata'])) + if ($param) { - $defaulttitle = $_GET['userdata']; + $defaulttitle = $param; } echo ' - - - - + + +
'; echo '
'; @@ -113,17 +126,17 @@ { $name = basename($path); if (!str_ends_with($name, '.del') - && (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata']))) + && ($action != 'filter' || str_contains($name, $param))) { - if (isset($_GET['searchaction'])) + if ($action == 'search') { $content = file_get_contents($path); - if (!str_contains($content, $_GET['userdata'])) + if (!str_contains($content, $param)) { continue; } } - echo '
' . $name .'
'; + echo '
' . $name .'
'; } } echo '
';