Diff for /db/prgsrc/db.cgi between versions 1.91 and 1.92

version 1.91, 2003/02/21 19:39:46 version 1.92, 2003/02/22 01:40:28
Line 8  use POSIX qw(locale_h); Line 8  use POSIX qw(locale_h);
 use locale;  use locale;
 open STDERR, ">/var/tmp/errors1";  open STDERR, ">/var/tmp/errors1";
 my $newsurl='http://news.chgk.info/';  my $newsurl='http://news.chgk.info/';
   my $cashednumber=500;
 my ($proxyptext,$proxysstr);  my ($proxyptext,$proxysstr);
 my $printqueries=0;  my $printqueries=0;
 my %forbidden=();  my %forbidden=();
Line 633  sub PrintList { Line 634  sub PrintList {
         my $sstr=param('sstr')||'';          my $sstr=param('sstr')||'';
         $qs=~s/sstr=[^\&]+/sstr=$sstr/;          $qs=~s/sstr=[^\&]+/sstr=$sstr/;
         $qs=~s/\&was=[^\&]+//;          $qs=~s/\&was=[^\&]+//;
         $qs.="&was=$was"||'';          $qs.="&was=$was" if $was;
            my $fkvo=param('fkvo')||$#$Questions;
           $qs.="&fkvo=$fkvo" if $was;
         if ($first>$kvo*3+1)          if ($first>$kvo*3+1)
         {          {
            $nav.=             $nav.=
Line 645  sub PrintList { Line 648  sub PrintList {
         else {$nav.=' 'x15;}          else {$nav.=' 'x15;}
   
      my ($fprint,$lprint);       my ($fprint,$lprint);
      my $llprint=$#$Questions- ($#$Questions+1)%$kvo+2;       my $llprint=$fkvo- ($fkvo+1)%$kvo+2;
      if ($#$Questions+1<=$kvo*7)       if ($fkvo+1<=$kvo*7)
      {         $fprint=1;       {         $fprint=1;
                $lprint=$llprint;                 $lprint=$llprint;
      }       }
      elsif ($first>$kvo*3 && $#$Questions+1-$first>$kvo*3)       elsif ($first>$kvo*3 && $fkvo+1-$first>$kvo*3)
      {       {
        $fprint=$first-$kvo*3;         $fprint=$first-$kvo*3;
        $lprint=$first+$kvo*3;         $lprint=$first+$kvo*3;
Line 679  sub PrintList { Line 682  sub PrintList {
         {          {
 #         next if $first-$f>$kvo*3;  #         next if $first-$f>$kvo*3;
           $l=$f+$kvo-1;            $l=$f+$kvo-1;
           $l=$#$Questions+1 if $l>$#$Questions+1;            $l=$#$Questions+1 if $l>$fkvo+1;
           if ($f==$first) {$nav.="[$f-$l] ";}            if ($f==$first) {$nav.="[$f-$l] ";}
           else {            else {
                   $nav.= "[".a({href=>(url."?".$qs."\&first=$f")},"$f-$l")."] ";}                    $nav.= "[".a({href=>(url."?".$qs."\&first=$f")},"$f-$l")."] ";}
         }          }
         if ($lprint+$kvo<$#$Questions)          if ($lprint+$kvo<$fkvo)
         {          {
            $nav.=             $nav.=
             ("&nbsp;"x4).              ("&nbsp;"x4).
Line 717  sub PrintSearch { Line 720  sub PrintSearch {
         print printform;          print printform;
         my @allnf;          my @allnf;
         my @Questions;          my @Questions;
         if ($was)          $was=0 if $metod eq 'proxy';
           if ($was && ($metod ne 'proxy'))
         {          {
           my $sth=$dbh->prepare ("select sstr,questions,allnf from lastqueries where id=".param('was'));            my $sth=$dbh->prepare ("select sstr,questions,allnf from lastqueries where id=".param('was'));
           $sth->execute;            $sth->execute;
Line 726  sub PrintSearch { Line 730  sub PrintSearch {
           @Questions=unpack 'L*',$q;             @Questions=unpack 'L*',$q; 
           @allnf=unpack 'L*',$nf;                    @allnf=unpack 'L*',$nf;        
           $sth->finish;            $sth->finish;
         } else           }  
           if (!$was || ($metod eq 'proxy') || (param('first')+param('kvo')>$cashednumber))
         {          {
              @Questions=&Search($dbh, \$sstr,$metod,$all,\@allnf);               @Questions=&Search($dbh, \$sstr,$metod,$all,\@allnf);
              my $tmp=$dbh->quote(pack("L*",@Questions));               my $tmp=$dbh->quote(pack("L*",@Questions[0..$cashednumber]));
              my $qsstr=$dbh->quote($sstr);               my $qsstr=$dbh->quote($sstr);
              my $nf=$dbh->quote(pack("L*", @allnf));               my $nf=$dbh->quote(pack("L*", @allnf));
              my $ss=200;               my $ss=200;
Line 772  print "$query" if $printqueries; Line 777  print "$query" if $printqueries;
   
         }          }
   
           $hits=param("fkvo")||$hits;
   
         if ($hits =~ /1.$/  || $hits =~ /[5-90]$/) {          if ($hits =~ /1.$/  || $hits =~ /[5-90]$/) {
                 $suffix = 'Ê';                  $suffix = 'Ê';
Line 1773  EOT Line 1778  EOT
                 &PrintQOfAuthor($dbh,param('qofauthor'));                  &PrintQOfAuthor($dbh,param('qofauthor'));
         }          }
           elsif (param('sstr')||param('was')) {            elsif (param('sstr')||param('was')) {
                 &PrintSearch($dbh, param('sstr'), param('metod'),param('was'));                  &PrintSearch($dbh, $sstr||' ', param('metod')||'',param('was'));
                 $dbh->do("delete from lastqueries where                  $dbh->do("delete from lastqueries where
                       (TO_DAYS(NOW()) - TO_DAYS(t) >= 2) OR                        (TO_DAYS(NOW()) - TO_DAYS(t) >= 2) OR
                            (time_to_sec(now())-time_to_sec(t) >3600)")                             (time_to_sec(now())-time_to_sec(t) >3600)")
         }           } 
           elsif (param('qid')) {            elsif (param('qid')) {
               &PrintSearch($dbh, $sstr, 'proxy');                &PrintSearch($dbh, $sstr||'', 'proxy');
         }          }
         elsif (param('getfile')){          elsif (param('getfile')){
           print &writefile            print &writefile

Removed from v.1.91  
changed lines
  Added in v.1.92


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>