remove non-word characters from query
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 12 Oct 2010 12:05:34 +0000 (12:05 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 12 Oct 2010 12:05:34 +0000 (12:05 +0000)
This helps with queries which include "&", "-" or something
similar which return nothing in previous implementation

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1340 07558da8-63fa-0310-ba24-9fe276d99e06

vhost/webpac2.cgi

index 1a678c9..9cf686f 100755 (executable)
@@ -234,6 +234,9 @@ if ( my $search = param('search') ) {
                                   $template =~ s{Q}{$v};
                                $whitespace = " AND " if $whitespace;
 
+                               # don't return -* &* and other non-word characters
+                               return '' if $template =~ m/^\W\*$/;
+
                                return
                                        $whitespace .
                                        $attr . '="' . $template . '"';