Browse Source

use relative links

small cosmetic improvements
master
René Wagner 5 months ago
parent
commit
ac99b4092b
  1. 3
      faqs.pl
  2. 2
      lib/gmnifaq.pm
  3. 16
      search.pl

3
faqs.pl

@ -61,8 +61,7 @@ sub faqs
else {
foreach (@rows) {
push @return, sprintf("### %s", @$_[1]);
push @return, '';
push @return, @$_[2];
push @return, ('', @$_[2], '');
}
}
push @return, '';

2
lib/gmnifaq.pm

@ -51,7 +51,7 @@ sub config
sub footer
{
return ('', '=> ./index.pl Home', '=> https://src.clttr.info/rwa/gmnifaq powered by gmnifaq');
return ('', '=> ./index.pl [home]', '=> https://src.clttr.info/rwa/gmnifaq powered by gmnifaq');
}
sub write_response

16
search.pl

@ -22,9 +22,9 @@ if (!defined($ENV{'SERVER_PROTOCOL'}) || $ENV{'SERVER_PROTOCOL'} ne 'GEMINI') {
}
my $query = lc(uri_unescape($ENV{'QUERY_STRING'}));
if ($query eq '')
if ($query eq '' || $query !~ /^[0-9a-z]*$/i)
{
write_response('INPUT', 'Search faqs for the following terms (blank-space separated):', undef);
write_response('INPUT', 'Search faqs for the following terms (separate by blank)', undef);
}
my @body = ();
@ -46,9 +46,12 @@ sub search
my @matchingfaqs = $dbh->selectall_array("SELECT * FROM questions WHERE question LIKE '%$term%' OR answer LIKE '%$term%'");
$dbh->disconnect();
if ( !scalar(@matchingtags) && !scalar(@matchingfaqs)) {
push @result, ('Sorry, we can\'t find an entry that matches your search data.', '');
}
if ( scalar(@matchingtags)) {
push @result, '## matching tags';
push @result, '';
push @result, ('## matching tags', '');
foreach (@matchingtags) {
push @result, sprintf("=> ./faqs.pl?tag=%d %s (%d entrys)", @$_[0], @$_[1], @$_[2]);
}
@ -56,13 +59,12 @@ sub search
}
if ( scalar(@matchingfaqs)) {
push @result, '## matching FAQs';
push @result, '';
push @result, ('## matching FAQs', '');
foreach (@matchingfaqs) {
push @result, sprintf("=> ./faqs.pl?faq=%d %s", @$_[0], @$_[1]);
}
}
push @result, '';
push @result, ('', '=> ./search.pl search again');
return @result;
}

Loading…
Cancel
Save