Changeset 351


Ignore:
Timestamp:
10/06/06 12:23:39 (18 years ago)
Author:
Kris Deugau
Message:

/trunk

Backport bugfixes from r303, r307, r309, r318, r319, and r323
(search.cgi)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/search.cgi

    r320 r351  
    3737
    3838# Global variables
    39 my $RESULTS_PER_PAGE = 10;
     39my $RESULTS_PER_PAGE = 25;
    4040my %webvar = parse_post();
    4141cleanInput(\%webvar);
     
    105105
    106106  # First chunk of SQL.  Filter on custid, description, and notes as necessary.
    107   my $sql = "(select $cols from searchme where $webvar{custexclude} custid ilike '%$webvar{custid}%')".
    108         " $sqlconcat $webvar{custexclude} oldcustid ilike '%$webvar{custid}%')".
     107  my $sql = "(select $cols from searchme where".
     108        " $webvar{custexclude} (custid ilike '%$webvar{custid}%'".
     109        " OR $webvar{custexclude} oldcustid ilike '%$webvar{custid}%'))".
    109110        " $sqlconcat (select $cols from searchme where $webvar{descexclude} description ilike '%$webvar{desc}%')".
    110111        " $sqlconcat (select $cols from searchme where $webvar{notesexclude} notes ilike '%$webvar{notes}%')";
     
    141142  ## CIDR query options.
    142143  $webvar{cidr} =~ s/\s+//;     # Hates the nasty spaceseseses we does.
    143   if ($webvar{cidr} == '') { # We has a blank CIDR.  Ignore it.
     144  if ($webvar{cidr} eq '') { # We has a blank CIDR.  Ignore it.
    144145  } elsif ($webvar{cidr} =~ /\//) {
    145146    # 209.91.179/26 should show all /26 subnets in 209.91.179
     
    149150      # we'll be getting a class A anytime soon.  <g>
    150151      $sql .= " $sqlconcat (select $cols from searchme where ".
    151         "$webvar{cidrexclude} cidr='$webvar{cidr}')";
     152        "$webvar{cidrexclude} cidr<<='$webvar{cidr}')";
    152153    } else {
    153154      # Partial match;  beginning of subnet and maskbits are provided
    154155      # Show any blocks with the leading octet(s) and that masklength
     156      # Need some more magic for bare /nn searches:
     157      my $condition = ($net eq '' ?
     158        "masklen(cidr)=$maskbits" : "text(cidr) like '$net%' and masklen(cidr)=$maskbits");
    155159      $sql .= " $sqlconcat (select $cols from searchme where $webvar{cidrexclude} ".
    156         "(text(cidr) like '$net%' and masklen(cidr)=$maskbits))";
     160        "($condition))";
    157161    }
    158162  } elsif ($webvar{cidr} =~ /^(\d{1,3}\.){3}\d{1,3}$/) {
     
    429433                "allcities=$webvar{allcities}&";
    430434          foreach my $key (keys %webvar) {
    431             if ($key =~ /^(?:type|city)\[/) {
     435            if ($key =~ /^(?:type|city)\[/ || $key =~ /exclude$/) {
    432436              print "$key=$webvar{$key}&";
    433437            }
Note: See TracChangeset for help on using the changeset viewer.