]> 91.132.146.200 Git - scientia.git/commitdiff
init of the category addition develop
authorBanana <mail@bananas-playground.net>
Thu, 12 Nov 2026 17:01:59 +0000 (18:01 +0100)
committerBanana <mail@bananas-playground.net>
Thu, 12 Nov 2026 17:01:59 +0000 (18:01 +0100)
Signed-off-by: Banana <mail@bananas-playground.net>
14 files changed:
CHANGELOG
README.md
TODO
webroot/.htaccess
webroot/index.php
webroot/lib/i18n/de.ini
webroot/lib/i18n/en.ini
webroot/view/404/404.html [new file with mode: 0644]
webroot/view/404/404.php [new file with mode: 0644]
webroot/view/category/category.html [new file with mode: 0644]
webroot/view/category/category.php [new file with mode: 0644]
webroot/view/entry/entry.html
webroot/view/entry/entry.php
webroot/view/list/list.html

index 3f4c27ecea4ff80bbd0c4aca330c9245e4094b3d..7d472507ea39359d2578f20ff0552544d363da4b 100644 (file)
--- 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.
index 176a8ad2efe846133eca3929cb7f511e5620b19c..7950c846131664b6765686c0365261a1f24ce6cd 100644 (file)
--- 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 4e95e3824d8389521a20a27169da75cf5e097a32..88be9351a82cf20bde8f6b1ebe4f77d4c267c4f0 100644 (file)
--- 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
index 301dd68b4eb48fd3d6515ec1330157225fb93af9..594cd1199bf6e9cf675cbce90469bc6e99319866 100644 (file)
@@ -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]
 </IfModule>
index 217afb57f581d58f68b83bd43b4dddd0c68590a7..8a52fa8244627f0953e0f7fc7fcb5de24cdbb3b7 100644 (file)
@@ -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';
 
index 187aeb30db7a367f524117d7d9126393a1765865..574408273dbd4519caf3ee3baa047effe3557efa 100644 (file)
 
 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
index f56c741019a832d8e8e8f2794d75d70428747d9f..821e8d0ca8e97b8d80368d0072639bed49bc3b5a 100644 (file)
 
 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 (file)
index 0000000..1c73340
--- /dev/null
@@ -0,0 +1,2 @@
+<p><?php echo $i18n->t('text.404'); ?></p>
+<p><a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a></p>
diff --git a/webroot/view/404/404.php b/webroot/view/404/404.php
new file mode 100644 (file)
index 0000000..1469ae6
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * scientia
+ *
+ * Copyright 2023 - 2026 Johannes Keßler
+ *
+ * https://www.bananas-playground.net/projekt/scientia/
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/gpl-3.0.
+ */
+
+http_response_code(404);
diff --git a/webroot/view/category/category.html b/webroot/view/category/category.html
new file mode 100644 (file)
index 0000000..b9287c2
--- /dev/null
@@ -0,0 +1,44 @@
+<p>
+       <a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a>
+       | <a href="<?php echo PATH_WEBROOT; ?>/category"><?php echo $i18n->t('text.category'); ?></a>
+       | <a href="<?php echo PATH_WEBROOT; ?>/new"><?php echo $i18n->t('text.new'); ?></a>
+</p>
+
+<form method="post">
+       <table>
+               <thead>
+                       <tr>
+                               <th><?php echo $i18n->t('form.cat.name'); ?></th>
+                               <th><?php echo $i18n->t('form.cat.new.name'); ?></th>
+                               <th><?php echo $i18n->t('form.cat.deletion'); ?></th>
+                       </tr>
+               </thead>
+               <tbody>
+                       <tr>
+                               <td>
+                                       <?php echo $i18n->t('form.cat.new'); ?>
+                               </td>
+                               <td>
+                                       <input type="text" name="category[]" />
+                               </td>
+                               <td>
+                                       <input type="checkbox" name="deletecategory" value="delete" />
+                                       <small style="color: indianred"><?php echo $i18n->t('form.checkbox.deleteentry'); ?></small>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                       <a href=""></a>
+                               </td>
+                               <td>
+                                       <input type="text" name="category[]" />
+                               </td>
+                               <td>
+                                       <input type="checkbox" name="deletecategory" value="delete" />
+                                       <small style="color: indianred"><?php echo $i18n->t('form.checkbox.deleteentry'); ?></small>
+                               </td>
+                       </tr>
+               </tbody>
+       </table>
+       <input type="submit" name="updateCategories" value="<?php echo $i18n->t('form.button.save'); ?>">
+</form>
diff --git a/webroot/view/category/category.php b/webroot/view/category/category.php
new file mode 100644 (file)
index 0000000..622316f
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ * scientia
+ *
+ * Copyright 2023 - 2026 Johannes Keßler
+ *
+ * https://www.bananas-playground.net/projekt/scientia/
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/gpl-3.0.
+ */
index e9c992a288f30fc4536e8286035d6f4c1c2c32a8..af3cae5d6df514b7c62c86fbaaff1629489d0871 100644 (file)
@@ -1,4 +1,6 @@
-<p><a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a> | <a href="<?php echo PATH_WEBROOT; ?>/new"><?php echo $i18n->t('text.new'); ?></a></p>
+<p><a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a>
+       | <a href="<?php echo PATH_WEBROOT; ?>/new"><?php echo $i18n->t('text.new'); ?></a>
+</p>
 <p>
 <?php if(!empty($TemplateData['data'])) {
     $_link = '';
@@ -20,5 +22,9 @@
 <form method="post">
     <textarea rows="25" placeholder="write here" name="fdata[entry]"><?php echo $TemplateData['data']['body'] ?? ''; ?></textarea>
     <input type="submit" name="submitForm" value="<?php echo $i18n->t('form.button.save'); ?>">
+    <select name="category" id="cat-select">
+        <option value="">Category</option>
+        <hr />
+    </select>
     <input type="checkbox" name="deleteEntry" value="yes" /> <small style="color: indianred"><?php echo $i18n->t('form.checkbox.deleteentry'); ?></small>
 </form>
index 427f9f4c411aacc7c7f2e4b3482ae212e7c1f561..01ce745fdefe786d881b3e168ed5005c7ba25717 100644 (file)
 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);
index 9617a6e140f1ddcaa5e688383c3ac40d9bb4ac5d..d8814434c4700a6b64b4f19e224fd758c316f333 100644 (file)
@@ -3,7 +3,11 @@
     <input type="submit" name="submitForm" value="<?php echo $i18n->t('form.button.search'); ?>">
 </form>
 <?php if(!empty($TemplateData['entries'])) { ?>
-<p><a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a> | <a href="<?php echo PATH_WEBROOT; ?>/new"><?php echo $i18n->t('text.new'); ?></a></p>
+<p>
+    <a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a>
+    | <a href="<?php echo PATH_WEBROOT; ?>/category"><?php echo $i18n->t('text.category'); ?></a>
+    | <a href="<?php echo PATH_WEBROOT; ?>/new"><?php echo $i18n->t('text.new'); ?></a>
+</p>
 <?php
     foreach($TemplateData['entries'] as $k=>$v) {
         echo '<p>';