From bff6aed872c6e000bbf94c031a05ce00f7b95d0e Mon Sep 17 00:00:00 2001
From: Banana
Date: Thu, 12 Nov 2026 18:01:59 +0100
Subject: [PATCH] init of the category addition
Signed-off-by: Banana
---
CHANGELOG | 4 +--
README.md | 6 ++++
TODO | 2 --
webroot/.htaccess | 5 ++--
webroot/index.php | 22 +++++++++------
webroot/lib/i18n/de.ini | 6 ++++
webroot/lib/i18n/en.ini | 6 ++++
webroot/view/404/404.html | 2 ++
webroot/view/404/404.php | 23 +++++++++++++++
webroot/view/category/category.html | 44 +++++++++++++++++++++++++++++
webroot/view/category/category.php | 21 ++++++++++++++
webroot/view/entry/entry.html | 8 +++++-
webroot/view/entry/entry.php | 4 +++
webroot/view/list/list.html | 6 +++-
14 files changed, 143 insertions(+), 16 deletions(-)
create mode 100644 webroot/view/404/404.html
create mode 100644 webroot/view/404/404.php
create mode 100644 webroot/view/category/category.html
create mode 100644 webroot/view/category/category.php
diff --git a/CHANGELOG b/CHANGELOG
index 3f4c27e..7d47250 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,9 +1,9 @@
1.x Eos -
+ Config change. Important breaking changes. See upgrade-from-1.1.md for more details.
+ + Added: Simple page title to see where it is at.
+ + Fixed: Search. Works now everywhere.
+ Updated: README.md
+ Updated: upgrade-from-1.0.md file for better reading
- + Fixed: Search. Works now everywhere.
- + Added: Simple page title to see where it is at.
1.1 Atlas - 2024-06-29
+ Config change: i18n. See upgrade-from-1.0.md for more details.
diff --git a/README.md b/README.md
index 176a8ad..7950c84 100644
--- a/README.md
+++ b/README.md
@@ -21,9 +21,15 @@ Editing by selecting a note and saving the changes. It updates the search databa
To delete an entry you have to select it and check the `Delete entry` option. Click `Save` and the entry is gone.
+# Search
+
The search is a mysql fulltext search. It builds an index by using the words provided in the entries. Everything longer then 3 chars is added
to the index. MySQL has its own [ignore/stop words](https://dev.mysql.com/doc/refman/26.10/en/fulltext-stopwords.html) build in.
+Using the search at the startpage, the results come frome everthing. Limiting the result to a maximum of 100.
+
+Searching withing a year or month, the results are limited to this timeframe.
+
# Requirements
+ A Webserver (tested on Apache 2.4)
diff --git a/TODO b/TODO
index 4e95e38..88be935 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-+ search
-++ filter by date and if available by category
+ categories with colors
+ PHP Better API
+ Go client improvements
diff --git a/webroot/.htaccess b/webroot/.htaccess
index 301dd68..594cd11 100644
--- a/webroot/.htaccess
+++ b/webroot/.htaccess
@@ -6,8 +6,9 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule ^(\d{4})/(\d{2})/(\d{2})(|/(\S{4}))$ index.php?y=$1&m=$2&d=$3&id=$5 [L]
+ RewriteRule ^(\d{4})/(\d{2})/(\d{2})(|/(\S{4}))$ index.php?p=entry&y=$1&m=$2&d=$3&id=$5 [L]
RewriteRule ^(\d{4})/(\d{2})$ index.php?y=$1&m=$2 [L]
RewriteRule ^(\d{4})$ index.php?y=$1 [L]
- RewriteRule ^new$ index.php?p=new [L]
+ RewriteRule ^new$ index.php?p=entry [L]
+ RewriteRule ^category$ index.php?p=category [L]
diff --git a/webroot/index.php b/webroot/index.php
index 217afb5..8a52fa8 100644
--- a/webroot/index.php
+++ b/webroot/index.php
@@ -66,7 +66,6 @@ $driver = new mysqli_driver();
$driver->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;
# default values
-$_view = 'list';
$_year = date('Y');
$_month = date('m');
$_day = date('d');
@@ -74,6 +73,20 @@ $_id = '';
$_requestDateProvided = '';
$TemplateData = array();
+# valid pages
+$_validPages = array('list','entry','category');
+
+$_view = 'list';
+if(!empty($_GET['p'])) {
+ $_view = trim($_GET['p']);
+ $_view = Summoner::validate($_view,'nospace') ? $_view : 'list';
+
+ if(!in_array($_view,$_validPages)) {
+ $_view = "404";
+ }
+}
+
+## the following $_ are used in edit and list
if(isset($_GET['y']) && Summoner::validate($_GET['y'], 'digit')) {
$_year = trim($_GET['y']);
$_requestDateProvided .= 'Y';
@@ -86,13 +99,6 @@ if(isset($_GET['d']) && Summoner::validate($_GET['d'], 'digit')) {
$_day = trim($_GET['d']);
$_requestDateProvided .= '-d';
}
-if(isset($_GET['p']) && Summoner::validate($_GET['p'], 'nospace') && $_GET['p'] == "new") {
- $_view = 'entry';
-}
-if(isset($_GET['id']) && Summoner::validate($_GET['id'], 'shortlink',4)) {
- $_id = trim($_GET['id']);
- $_view = 'entry';
-}
require_once 'view/'.$_view.'/'.$_view.'.php';
diff --git a/webroot/lib/i18n/de.ini b/webroot/lib/i18n/de.ini
index 187aeb3..5744082 100644
--- a/webroot/lib/i18n/de.ini
+++ b/webroot/lib/i18n/de.ini
@@ -14,8 +14,14 @@
form.button.save=Speichern
form.button.search=Suche
+form.cat.deletion=Löschen
+form.cat.name=Name
+form.cat.new.name=Neuer Name
+form.cat.new=Neue Kategorie
form.checkbox.deleteentry=Eintrag löschen
+text.404=Seite nicht gefunden.
text.home=Index
text.new=Neu
text.noentries=Nichts vorhanden.
+text.category=Kategorie
diff --git a/webroot/lib/i18n/en.ini b/webroot/lib/i18n/en.ini
index f56c741..821e8d0 100644
--- a/webroot/lib/i18n/en.ini
+++ b/webroot/lib/i18n/en.ini
@@ -14,8 +14,14 @@
form.button.save=Save
form.button.search=Search
+form.cat.deletion=Delete
+form.cat.name=Name
+form.cat.new.name=New Name
+form.cat.new=New Category
form.checkbox.deleteentry=Delete Entry
+text.404=Page not found.
text.home=Home
text.new=New
text.noentries=Nothing here.
+text.category=Category
diff --git a/webroot/view/404/404.html b/webroot/view/404/404.html
new file mode 100644
index 0000000..1c73340
--- /dev/null
+++ b/webroot/view/404/404.html
@@ -0,0 +1,2 @@
+t('text.404'); ?>
+t('text.home'); ?>
diff --git a/webroot/view/404/404.php b/webroot/view/404/404.php
new file mode 100644
index 0000000..1469ae6
--- /dev/null
+++ b/webroot/view/404/404.php
@@ -0,0 +1,23 @@
+
+ t('text.home'); ?>
+ | t('text.category'); ?>
+ | t('text.new'); ?>
+
+
+
diff --git a/webroot/view/category/category.php b/webroot/view/category/category.php
new file mode 100644
index 0000000..622316f
--- /dev/null
+++ b/webroot/view/category/category.php
@@ -0,0 +1,21 @@
+t('text.home'); ?> | t('text.new'); ?>
+t('text.home'); ?>
+ | t('text.new'); ?>
+
+
t('form.checkbox.deleteentry'); ?>
diff --git a/webroot/view/entry/entry.php b/webroot/view/entry/entry.php
index 427f9f4..01ce745 100644
--- a/webroot/view/entry/entry.php
+++ b/webroot/view/entry/entry.php
@@ -23,6 +23,10 @@
require_once 'lib/entry.class.php';
$Entry = new Entry($DB);
+if(isset($_GET['id']) && Summoner::validate($_GET['id'], 'shortlink',4)) {
+ $_id = trim($_GET['id']);
+}
+
$TemplateData['data'] = array();
if(!empty($_id)) {
$TemplateData['data'] = $Entry->load($_year,$_month,$_day,$_id);
diff --git a/webroot/view/list/list.html b/webroot/view/list/list.html
index 9617a6e..d881443 100644
--- a/webroot/view/list/list.html
+++ b/webroot/view/list/list.html
@@ -3,7 +3,11 @@
-
t('text.home'); ?> | t('text.new'); ?>
+
+ t('text.home'); ?>
+ | t('text.category'); ?>
+ | t('text.new'); ?>
+
$v) {
echo '';
--
2.47.3