]> 91.132.146.200 Git - scientia.git/commitdiff
fixed search.
authorBanana <mail@bananas-playground.net>
Wed, 11 Nov 2026 22:49:53 +0000 (23:49 +0100)
committerBanana <mail@bananas-playground.net>
Wed, 11 Nov 2026 22:49:53 +0000 (23:49 +0100)
added a simple title

Signed-off-by: Banana <mail@bananas-playground.net>
CHANGELOG
README.md
webroot/config/config.php.default
webroot/lib/entry.class.php
webroot/view/_head.php
webroot/view/entry/entry.php
webroot/view/list/list.html
webroot/view/list/list.php

index d2c4611b00bb96fe2e7ebd68cc731daf2fc8a945..3f4c27ecea4ff80bbd0c4aca330c9245e4094b3d 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,8 @@
     + Config change. Important breaking changes. See upgrade-from-1.1.md for more details.
     + 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 5e02755220a929cb8bec5abf503bcd140286843d..176a8ad2efe846133eca3929cb7f511e5620b19c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Searchable with mysql fulltext search. Protected by BASIC AUTH, single user only
 Install it and access it with a browser.
 
 After login you can browse and search every note. They are sorted by date and grouped by year. Selecting a year
-does limit the view to this year only. After selecting an entry you are able to filter by day and month by using the `breadcrumb`.
+does limit the view to this year only. After selecting an entry you are able to filter by day and month by using the `Breadcrumb`.
 
 Adding, with the action `New`,  does create it with the current date and creates a uniq url.
 
index 9ffa90895a07fff5f9494e156b64a050de57db1f..f0d849f0f7b4ef0bd5cb0230f5d74d1f6c4c1335 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * scientia
  *
- * Copyright 2023 - 2024 Johannes Keßler
+ * Copyright 2023 - 2026 Johannes Keßler
  *
  * https://www.bananas-playground.net/projekt/scientia/
  *
@@ -21,9 +21,9 @@
  */
 
 # set to true if you need debug messages in error log file
-const DEBUG = true;
+const DEBUG = false;
 # set to ture if you need query log messages in error log file.
-const QUERY_DEBUG = true;
+const QUERY_DEBUG = false;
 
 # timezone settings
 const TIMEZONE = 'Europe/Berlin';
index 3cb6297af3cf211dcf9c0287864ee1f6d40d6500..1f1b8e4815d957bd97626d33e2efad39305c0a89 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * scientia
  *
- * Copyright 2023 - 2024 Johannes Keßler
+ * Copyright 2023 - 2026 Johannes Keßler
  *
  * https://www.bananas-playground.net/projekt/scientia/
  *
@@ -202,13 +202,20 @@ class Entry {
         $ret = array();
 
         $queryStr = "SELECT e.ident, e.date, SUBSTRING(e.body,1,100) AS body 
-                    FROM `".DB_PREFIX."_entry` AS e";
-        if(!empty($intervalStart) && !empty($intervalEnd)) {
-            $queryStr .= " WHERE e.date >= '".$intervalStart."' AND e.date <= '".$intervalEnd."'";
+                    FROM `".DB_PREFIX."_entry` AS e ";
+        $queryWhere = array();
+        if(!empty($intervalStart) || !empty($intervalEnd) || !empty($searchTerm)) {
+            if(!empty($intervalStart) && !empty($intervalEnd)) {
+                $queryWhere[] = "(e.date BETWEEN '".$intervalStart."' AND '".$intervalEnd."')";
+            }
+            if(!empty($searchTerm)) {
+                $queryWhere[] = "MATCH(e.words) AGAINST('".$this->_DB->real_escape_string($searchTerm)."' IN NATURAL LANGUAGE MODE)";
+            }
         }
-        if(!empty($searchTerm)) {
-            $queryStr .= " AND MATCH(e.words) AGAINST('".$this->_DB->real_escape_string($searchTerm)."' IN BOOLEAN MODE)";
+        if(!empty($queryWhere)) {
+            $queryStr .= "WHERE ".implode(" AND ",$queryWhere);
         }
+
         $queryStr .= " ORDER BY `created` DESC";
         $queryStr .= " LIMIT $limit";
 
index de043654b95094d9771944ed124855aa9e9f66d1..4134d4a46bca0d31857b6d28ffacbb6c02f7b114 100644 (file)
@@ -7,5 +7,6 @@
             max-width: 90%;
         }
     </style>
+       <title><?php echo $TemplateData['title'] ?? ''; ?> scientia</title>
 </head>
 <body>
index 7a50ebb1ef12b755c4be04c6f6eb2dac8e27328f..427f9f4c411aacc7c7f2e4b3482ae212e7c1f561 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * scientia
  *
- * Copyright 2023 - 2024 Johannes Keßler
+ * Copyright 2023 - 2026 Johannes Keßler
  *
  * https://www.bananas-playground.net/projekt/scientia/
  *
@@ -27,6 +27,7 @@ $TemplateData['data'] = array();
 if(!empty($_id)) {
     $TemplateData['data'] = $Entry->load($_year,$_month,$_day,$_id);
     $TemplateData['data']['breadcrumb'] = array($_year,$_month,$_day);
+    $TemplateData['title'] = implode(" | ",array($_year,$_month,$_day));
 }
 
 if(isset($_POST['submitForm']) && isset($_POST['fdata'])) {
index b04147beea1e00c6e2661924f1fe7873b8752424..9617a6e140f1ddcaa5e688383c3ac40d9bb4ac5d 100644 (file)
@@ -27,5 +27,6 @@
 <?php
     }
 } else { ?>
+<p><a href="<?php echo PATH_WEBROOT; ?>/"><?php echo $i18n->t('text.home'); ?></a></p>
 <p><?php echo $i18n->t('text.noentries'); ?></p>
 <?php } ?>
index b8aa002f1094b57ababfbf75a1ac0edef380fbae..bd657fd106890f39e93d1b458cb365de77f6af47 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * scientia
  *
- * Copyright 2023 - 2024 Johannes Keßler
+ * Copyright 2023 - 2026 Johannes Keßler
  *
  * https://www.bananas-playground.net/projekt/scientia/
  *
@@ -39,6 +39,7 @@ $_groupByFormat = $_year;
 $breadcrumb = array('Y');
 $_intervalStart = '';
 $_intervalEnd = '';
+$_hasTitle = false;
 if(!empty($_requestDateProvided)) {
     if($_requestDateProvided === 'Y-m-d') {
         $queryLimit = "";
@@ -60,6 +61,7 @@ if(!empty($_requestDateProvided)) {
         $_intervalStart = $_groupByFormat.'-01-01';
         $_intervalEnd = $_groupByFormat.'-12-31';
     }
+    $_hasTitle = true;
 } else {
     $_requestDateProvided = 'Y';
 }
@@ -74,4 +76,5 @@ foreach($entries as $k=>$entry) {
     $TemplateData['entries'][$_d->format($_requestDateProvided)]['breadcrumb'] = $_breadcrumb;
     $TemplateData['entries'][$_d->format($_requestDateProvided)]['e'][$entry['ident']] = $entry;
     $TemplateData['entries'][$_d->format($_requestDateProvided)]['e'][$entry['ident']]['link'] = str_replace('-','/',$entry['date']).'/'.$entry['ident'];
+    if($_hasTitle) $TemplateData['title'] = implode(" | ", $_breadcrumb);
 }