gmnifaq

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/gmnifaq.git
Log | Files | Refs | README | LICENSE

commit fae1610eb1c7a29f29244578926a97477471e5b7
parent 6cc21c44f0e1ca40fcd3408ed4a3edae0c6c7b47
Author: René Wagner <rwagner@rw-net.de>
Date:   Tue, 24 Nov 2020 21:41:40 +0100

add URI-handling

Diffstat:
MTODO.md | 2--
Mdata/data.sqlite.example | 0
Mfaqs.pl | 3++-
Msearch.pl | 6++++--
4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1,9 +1,7 @@ # initial todo - avoid serving of data files?! - search using FTS -- URI:encode/decode for params - built admin interface - consolidate things - header generation - footer generation - - config slurp diff --git a/data/data.sqlite.example b/data/data.sqlite.example Binary files differ. diff --git a/faqs.pl b/faqs.pl @@ -5,6 +5,7 @@ use strict; use DBI; +use URI::Escape; use lib 'lib/'; use gmnifaq; @@ -30,7 +31,7 @@ exit; sub sql { - my $query = $ENV{'QUERY_STRING'}; + my $query = lc(uri_unescape($ENV{'QUERY_STRING'})); if ( $query eq '' ) { return "SELECT * FROM questions q ORDER BY question;"; diff --git a/search.pl b/search.pl @@ -5,6 +5,7 @@ use strict; use DBI; +use URI::Escape; use lib 'lib/'; use gmnifaq; @@ -19,7 +20,7 @@ if (!defined($ENV{'SERVER_PROTOCOL'}) || $ENV{'SERVER_PROTOCOL'} ne 'GEMINI') { write_response('CGI_ERROR', 'CGI execution error', undef); } -my $query = lc($ENV{'QUERY_STRING'}); +my $query = lc(uri_unescape($ENV{'QUERY_STRING'})); if ($query eq '') { write_response('INPUT', 'Search faqs for the following terms (blank-space separated):', undef); @@ -50,10 +51,11 @@ sub search foreach (@matchingtags) { push @result, sprintf("=> faqs.pl?tag=%d %s (%d entrys)", @$_[0], @$_[1], @$_[2]); } + push @result, ''; } if ( scalar(@matchingfaqs)) { - push @result, '## matching tags'; + push @result, '## matching FAQs'; push @result, ''; foreach (@matchingfaqs) { push @result, sprintf("=> faqs.pl?faq=%d %s", @$_[0], @$_[1]);