Diff for /db/prgsrc/db.cgi between versions 1.57 and 1.71

version 1.57, 2002/01/08 23:15:31 version 1.71, 2002/08/01 23:14:00
Line 2 Line 2
   
 use DBI;  use DBI;
 use CGI ':all';  use CGI ':all';
 #use Text::Query;  
 use strict;  use strict;
 use Time::Local;  use Time::Local;
 use POSIX qw(locale_h);  use POSIX qw(locale_h);
 use locale;  use locale;
 open STDERR, ">errors1";  open STDERR, ">>errors1";
 my $printqueries=0;  my $printqueries=0;
 my %forbidden=();  my %forbidden=();
 my $debug=0; #added by R7  my $debug=0; #added by R7
Line 43  my ($SRCPATH) = "$PWD/../dimrub/src"; Line 42  my ($SRCPATH) = "$PWD/../dimrub/src";
 my ($ZIP) = "/home/piataev/bin/zip";  my ($ZIP) = "/home/piataev/bin/zip";
 my $DUMPFILE = "/tmp/chgkdump";  my $DUMPFILE = "/tmp/chgkdump";
 my ($SENDMAIL) = "/usr/sbin/sendmail";  my ($SENDMAIL) = "/usr/sbin/sendmail";
   my ($TMPDIR) = "/tmp";
 my ($TMSECS) = 30*24*60*60;  my ($TMSECS) = 30*24*60*60;
 my (%RevMonths) =  my (%RevMonths) =
         ('Jan', '0', 'Feb', '1', 'Mar', '2', 'Apr', '3', 'May', '4', 'Jun', '5',          ('Jan', '0', 'Feb', '1', 'Mar', '2', 'Apr', '3', 'May', '4', 'Jun', '5',
Line 51  my (%RevMonths) = Line 51  my (%RevMonths) =
          'Янв', '0', 'Фев', 1, 'Мар', 2, 'Апр', 3, 'Май', '4',           'Янв', '0', 'Фев', 1, 'Мар', 2, 'Апр', 3, 'Май', '4',
          'Июн', '5', 'Июл', 6, 'Авг', '7', 'Сен', '8',           'Июн', '5', 'Июл', 6, 'Авг', '7', 'Сен', '8',
          'Окт', '9', 'Ноя', '19', 'Дек', '11');           'Окт', '9', 'Ноя', '19', 'Дек', '11');
   my @months=('000','Jan',"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",
             "Nov","Dec");
   
   
 # Determine whether the given time is within 2 months from now.  # Determine whether the given time is within 2 months from now.
 sub NewEnough {  sub NewEnough {
Line 106  sub GetTourQuestions { Line 109  sub GetTourQuestions {
         my (@arr, @Questions);          my (@arr, @Questions);
   
         my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions          my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions
                 WHERE ParentId=$ParentId");                  WHERE ParentId=$ParentId order by Number");
   
         $sth->execute;          $sth->execute;
   
Line 157  sub printform Line 160  sub printform
   my $inputstring=textfield(-name=>'sstr',    my $inputstring=textfield(-name=>'sstr',
                          -default=>param('sstr')||'',                           -default=>param('sstr')||'',
                          -size=>30,                           -size=>30,
                          -maxlength=>30);                           -maxlength=>50);
   my $qnumber="Выводить по".br. textfield(-name=>'kvo',    my $qnumber="Выводить по".br. textfield(-name=>'kvo',
                          -default=>param('kvo')||'150',                           -default=>param('kvo')||'150',
                          -size=>3,                           -size=>3,
Line 354  print "$query\n",br if $printqueries; Line 357  print "$query\n",br if $printqueries;
                  {                   {
                     ($field,$lo,$hi,$wordnumber)=@blob[$ii..($ii+3)];                      ($field,$lo,$hi,$wordnumber)=@blob[$ii..($ii+3)];
                     $ii+=4;                      $ii+=4;
                     $number=$lo+$hi*256;                      my $addnumber=($field >> 4) << 16;
                     $field=$fieldname{$field};                      $number=(($field >> 4) << 16)+($hi << 8) + $lo;
                       $field=$fieldname{$field & 0xF};
                     if ($searchin{$field})                      if ($searchin{$field})
                     {                      {
                       push @{$tasksof{$i}{$number}}, $wordnumber;                        push @{$tasksof{$i}{$number}}, $wordnumber;
Line 640  sub PrintList { Line 644  sub PrintList {
   
         print "$nav".br."\n";          print "$nav".br."\n";
         for (my $i = $first; $i <= $last; $i++) {          for (my $i = $first; $i <= $last; $i++) {
                 my $output = &PrintQuestion($dbh, $$Questions[$i-1], 1, $i, 1);                  my $output = &PrintQuestion($dbh, $$Questions[$i-1], 1, 0, 1);
                 if (param('metod') eq 'rus' || param('metod') eq 'proxy')                  if (param('metod') eq 'rus' || param('metod') eq 'proxy')
                 {                  {
                      $output=~s/\b($shablon)\b/\<strong\>$1\<\/strong\>/gi;                       $output=~s/\b($shablon)\b/\<strong\>$1\<\/strong\>/gi;
Line 668  sub PrintSearch { Line 672  sub PrintSearch {
           $sth->execute;            $sth->execute;
           my ($q,$nf);            my ($q,$nf);
           ($sstr, $q,$nf)=($sth->fetchrow);            ($sstr, $q,$nf)=($sth->fetchrow);
           @Questions=unpack 'S*',$q;             @Questions=unpack 'L*',$q; 
           @allnf=unpack 'S*',$nf;                    @allnf=unpack 'L*',$nf;        
           $sth->finish;            $sth->finish;
         } else           } else 
         {          {
              @Questions=&Search($dbh, \$sstr,$metod,$all,\@allnf);               @Questions=&Search($dbh, \$sstr,$metod,$all,\@allnf);
              my $tmp=$dbh->quote(pack("S*",@Questions));               my $tmp=$dbh->quote(pack("L*",@Questions));
              my $qsstr=$dbh->quote($sstr);               my $qsstr=$dbh->quote($sstr);
              my $nf=$dbh->quote(pack("S*", @allnf));               my $nf=$dbh->quote(pack("L*", @allnf));
              my $ss=200;               my $ss=200;
              do                do 
              {               {
Line 768  sub PrintRandom { Line 772  sub PrintRandom {
   
 sub PrintEditor {  sub PrintEditor {
        my $t=shift; #ссылка на Хэш с полями         my $t=shift; #ссылка на Хэш с полями
        my $ed=$$t{'Editors'};         my $ed=$$t{'Editors'}||'';
        my $edname=($ed=~/\,/ ) ? "Редакторы"  : "Редактор" ;         my $edname=($ed=~/\,/ ) ? "Редакторы"  : "Редактор" ;
        return $ed? h4({align=>"center"},"$edname: $ed" ): '';         return $ed? h4({align=>"center"},"$edname: $ed" ): '';
 }  }
Line 816  sub PrintTournament { Line 820  sub PrintTournament {
                 }                  }
         } else {          } else {
                 my ($qnum) = GetQNum($dbh);                  my ($qnum) = GetQNum($dbh);
                 $output .= h2("Банк Вопросов: $qnum вопросов") . p . "\n";                  $output .= h2("Банк Вопросов: $qnum вопрос".&Suffix($qnum)) 
                             . p . "\n";
         }          }
   
         for ($i = 0; $i <= $#Tours; $i++) {          for ($i = 0; $i <= $#Tours; $i++) {
Line 835  sub PrintTournament { Line 840  sub PrintTournament {
                         $qnum = '';                          $qnum = '';
                 }                  }
                 if ($Tournament{'Type'} =~ /Г/) {                  if ($Tournament{'Type'} =~ /Г/) {
                       $SingleTour=0;
                         $imgsrc = "/icons/folder.gif";                          $imgsrc = "/icons/folder.gif";
                         $alt = "[*]";                          $alt = "[*]";
                 } else {                  } else {
Line 867  sub PrintTournament { Line 873  sub PrintTournament {
                   "вопросы + ответы") . "]")                    "вопросы + ответы") . "]")
                                 );                                  );
                 } else {                  } else {
                         $list .= dd(a({href=>url . "?tour=$textid&comp=1"},                          $list .= dd(#a({href=>url . "?tour=$textid&comp=1"},
                                 img({src=>'/icons/compressed.gif', alt=>'[ZIP]', border=>1}))                                  #img({src=>'/icons/compressed.gif', alt=>'[ZIP]', border=>1})). " " . 
                                 . " " . img({src=>$imgsrc, alt=>$alt})                                  img({src=>$imgsrc, alt=>$alt})
                                 . " " . a({href=>url . "?tour=$textid&answer=0"},                                  . " " . a({href=>url . "?tour=$textid&answer=0"},
                                 $Tournament{'Title'}. " ".                                  $Tournament{'Title'}. " ".
                                           $Tournament{'PlayedAt'}) . $qnum);                                            $Tournament{'PlayedAt'}) . $qnum);
Line 878  sub PrintTournament { Line 884  sub PrintTournament {
         $output .= dl($list);          $output .= dl($list);
   
         if ($URL) {          if ($URL) {
                   if (url=~/zaba\.ru/ && $URL=~/^\//){$URL="http://info.chgk.info$URL"}
                 $output .=                  $output .=
                 p("Дополнительная информация об этом турнире - по адресу " .                  p("Дополнительная информация об этом турнире - по адресу " .
                         a({-'href'=>$URL}, $URL));                          a({-'href'=>$URL}, $URL));
Line 999  sub PrintTour { Line 1006  sub PrintTour {
 sub PrintField {  sub PrintField {
         my ($header, $value, $text) = @_;          my ($header, $value, $text) = @_;
         if ($text) {          if ($text) {
             $value =~ s/<[\/\w]*>//sg;              $value =~ s/<[\/\w]*?>//sg;
         } else {          } else {
             $value =~ s/^\s+/<br>&nbsp;&nbsp;&nbsp;&nbsp;/mg;              $value =~ s/^\s+/<br>&nbsp;&nbsp;&nbsp;&nbsp;/mg;
             $value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg;              $value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg;
               $value =~ s/\s+-+\s+/&nbsp;&#0150; /mg;
   #           $value =~ s/(\s)"/$1&#147;/mg;
   #           $value =~ s/^"/&#147;/mg;
   #           $value =~ s/"/&#148;/mg;
         }          }
   
   
         return $text ? "$header:\n$value\n\n" :          return $text ? "$header:\n$value\n\n" :
                 strong("$header: ") . $value . p . "\n";                  strong("$header: ") . $value . p . "\n";
 }  }
Line 1015  sub PrintQuestion { Line 1027  sub PrintQuestion {
         my ($dbh, $Id, $answer, $qnum, $title, $text) = @_;          my ($dbh, $Id, $answer, $qnum, $title, $text) = @_;
         my ($output, $titles) = ('', '');          my ($output, $titles) = ('', '');
         my (%Question) = &GetQuestion($dbh, $Id);          my (%Question) = &GetQuestion($dbh, $Id);
           $qnum = $Question{'Number'}
                   if ($qnum == 0);
         if (!$text) {          if (!$text) {
                 $output .= hr({width=>"50%"});                  $output .= hr({width=>"50%"});
                 if ($title) {                  if ($title) {
Line 1027  sub PrintQuestion { Line 1041  sub PrintQuestion {
                                          a({href=>url . "?tour=$fname"}, $Tournament{'Title'}, $Tournament{'PlayedAt'}));                                           a({href=>url . "?tour=$fname"}, $Tournament{'Title'}, $Tournament{'PlayedAt'}));
                         $titles .=                          $titles .=
                                 dl(dd(img({src=>"/icons/folder.open.gif"}) . " " .                                  dl(dd(img({src=>"/icons/folder.open.gif"}) . " " .
                                         a({href=>url . "?tour=$fname.$Tour{Number}"}, $Tour{'Title'})));                                          a({href=>url . "?tour=$fname.$Tour{Number}#$qnum"}, $Tour{'Title'})));
                 }                  }
                 $output .= dl(strong($titles));                  $output .= dl(strong($titles));
         }          }
   
         $qnum = $Question{'Number'}  
                 if ($qnum == 0);          $output.= "<a NAME=\"$qnum\">";
   
         $output .=          $output .=
                 &PrintField("Вопрос $qnum", $Question{'Question'}, $text);                  &PrintField("Вопрос $qnum", $Question{'Question'}, $text);
   
         if ($answer) {          if ($answer==1) {
                 $output .=                  $output .=
                         &PrintField("Ответ", $Question{'Answer'}, $text);                          &PrintField("Ответ", $Question{'Answer'}, $text);
   
                 if ($Question{'Authors'}) {                  if ($Question{'Authors'}) {
                       my $q=$Question{'Authors'};                        my $q=$Question{'Authors'};
   ###АВТОРА!!
 #                     my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q                        my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q
 #                                 where Authors.Id=Author And Question=$Id");                                    where Authors.Id=Author And Question=$Id");
 #                      $sth->execute;                         $sth->execute;
 #                      my ($AuthorId,$Name, $Surname,$other,$Nicks);                         my ($AuthorId,$Name, $Surname,$other,$Nicks);
   
 #                      while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId)                         while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId)
 #                      {                         {
 #                        my ($firstletter)=$Name=~m/^./g;                           my ($firstletter)=$Name=~m/^./g;
 #                         $Name=~s/\./\\\./g;                            $Name=~s/\./\\\./g;
 #                          my $sha="(?:$Name\\s+$Surname)|(?:$Surname\\s+$Name)|(?:$firstletter\\.\\s*$Surname)|(?:$Surname\\s+$firstletter\\.)|(?:$Surname)|(?:$Name)";                             my $sha="(?:$Name\\s+$Surname)|(?:$Surname\\s+$Name)|(?:$firstletter\\.\\s*$Surname)|(?:$Surname\\s+$firstletter\\.)|(?:$Surname)|(?:$Name)";
 #                          if ($Nicks)                             if ($Nicks)
 #                          {                             {
 #                            $Nicks=~s/^\|//;                               $Nicks=~s/^\|//;
 #                            foreach (split /\|/, $Nicks)                               foreach (split /\|/, $Nicks)
 #                            {                               {
 #                              s/\s+/ /g;                                 s/\s+/ /g;
 #                              s/\s+$//;                                 s/\s+$//;
 #                              s/ /\\s+/g;                                 s/ /\\s+/g;
 #                              s/\./\\\./g;                                 s/\./\\\./g;
 #                              if (s/>$//) {$sha="$sha|(?:$_)"}                                 if (s/>$//) {$sha="$sha|(?:$_)"}
 #                              else        {$sha="(?:$_)|$sha"}                                 else        {$sha="(?:$_)|$sha"}
 #                            }                               }
 #                          }                             }
 #                          $q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei;                             $q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei;
 #                      }                         }
    
                         $output .= &PrintField("Автор(ы)", $q, $text);                          $output .= &PrintField("Автор(ы)", $q, $text);
   
 #                        $output.= &PrintField("Другие вопросы", $other);  
                 }                  }
   
                 if ($Question{'Sources'}) {                  if ($Question{'Sources'}) {
Line 1084  sub PrintQuestion { Line 1097  sub PrintQuestion {
                         $output .= &PrintField("Комментарии", $Question{'Comments'}, $text);                          $output .= &PrintField("Комментарии", $Question{'Comments'}, $text);
                 }                  }
         }          }
 #       $output.=br.a({href=> url."?metod=proxy&qid=$Id"}, 'Близкие вопросы').p          elsif ($answer==2) {
 #             if $answer;            my $text=$Question{'Answer'};
             $text=~s/\n/<option>/mg;
             $output.="<select><option selected>Ответ:<option>$text</select>";
             $text=$Question{'Comments'}||'';
             if ($text) {
                $text=~s/\n/<option>/mg;
                $output.="<select><option selected>Комментарий:<option>$text</select>"
             }
           } 
           elsif ($answer==3) {
           $output.=  <<EOTT
             <div align=right STYLE="cursor:hand;" OnStart="toggle(document.all.HideShow$qnum);" OnClick="toggle(document.all.HideShow$qnum);">
             <font size=-2 color=red> Показать/убрать ответ</font></div>
             <span style="display:none" id=HideShow$qnum>
   EOTT
             .&PrintField("Ответ", $Question{'Answer'}, $text);
                   if ($Question{'Authors'}) {
                           $output .= &PrintField("Автор(ы)", $Question{'Authors'}, $text);
                   }
                   if ($Question{'Sources'}) {
                           $output .= &PrintField("Источник(и)", $Question{'Sources'}, $text);
                   }
   
                   if ($Question{'Comments'}) {
                           $output .= &PrintField("Комментарии", $Question{'Comments'}, $text);
                   }
   
   
   $output.="</span>"
   
           }
           $output.=br.a({href=> url."?metod=proxy&qid=$Id"}, 'Близкие вопросы').p
                if $answer;
         return $output;          return $output;
 }  }
   
Line 1115  sub Get12Random { Line 1160  sub Get12Random {
         my ($qnum) = &GetMaxQId($dbh);          my ($qnum) = &GetMaxQId($dbh);
         my (%chosen);          my (%chosen);
         srand;          srand;
   
         my $where=0;          my $where=0;
         my $r=int (rand(10000));          my $r=int (rand(10000));
   
Line 1127  sub Get12Random { Line 1171  sub Get12Random {
   
    $q="select QuestionId, QuestionId/$r-floor(QuestionId/$r) as val      $q="select QuestionId, QuestionId/$r-floor(QuestionId/$r) as val 
        from Questions where $where order by val limit $num";         from Questions where $where order by val limit $num";
   
 # Когда на куличках появится mysql >=3.23 надо заменить на order by rand();  # Когда на куличках появится mysql >=3.23 надо заменить на order by rand();
   
    $sth=$dbh->prepare($q);     $sth=$dbh->prepare($q);
Line 1175  sub PrintArchive { Line 1218  sub PrintArchive {
                 }                  }
                 return @list;                  return @list;
         }          }
         return "$SRCPATH/$Tournament{'FileName'} ";  #       return "$SRCPATH/$Tournament{'FileName'} ";
           return "$TMPDIR/$Tournament{'FileName'} ";
 }  }
   
 sub PrintAll {  sub PrintAll {
Line 1342  a({href=>url."?authors=surname"},"фамили Line 1386  a({href=>url."?authors=surname"},"фамили
 }  }
   
   
   sub WriteFile {
     my ($dbh,$fname) = @_;
     $fname=~s/\.txt$//;
     $fname=~s/.*\/(\w+)/$1/;
     my $query= "SELECT Id, Title, Copyright, Info, URL, 
                         Editors, EnteredBy, PlayedAt, CreatedAt 
                        from Tournaments where FileName=".$dbh->quote("$fname.txt");
     my $sth=$dbh->prepare($query);
     my (%Question,%editor,%qnumber,%copyright,%author,%vid,%tourtitle);
     $sth->execute;
     my ($Id, $Title, $Copyright, $Info, $URL, 
      $Editors, $EnteredBy, $PlayedAt, $CreatedAt)=
         $sth->fetchrow;
     return -1 unless $Id;
     open (OUT, ">$TMPDIR/$fname.txt");
     print OUT "Чемпионат:\n$Title\n\n";
     my $date=$PlayedAt;
     my ($year,$month,$day)=split /-/, $date;
   #  $month=0,$date=0 if $year && $month==1 && $day==1;
     my $pdate=sprintf("%02d-%3s-%4d",$day,$months[$month],$year);
   
     print OUT "Дата:\n$pdate\n\n" if $date;
   
     print OUT "URL:\n$URL\n\n" if $URL;
   
     print OUT "Инфо:\n$Info\n\n" if $Info;
   
     print OUT "Копирайт:\n$Copyright\n\n" if $Copyright;
   
     print OUT "Редактор:\n$Editors\n\n" if $Editors;
   
   
     $query= "SELECT Id, Title, Copyright, Editors from Tournaments where ParentId=$Id order by Id";
     $sth=$dbh->prepare($query);
     $sth->execute;
     my ($tourid,$tourtitle,$cright,$editor,@tours,$vid,$author,$tourauthor);
   
   
     while (($tourid,$tourtitle,$cright,$editor)=$sth->fetchrow,$tourid)
     {
   #    $text{$tourid}="Тур:\n$tourtitle\n\n";
       $query= "SELECT * from Questions where ParentId=$tourid order by QuestionId";
       my $sth1=$dbh->prepare($query);
       $sth1->execute;
       push(@tours,$tourid);
       $tourtitle{$tourid}=$tourtitle;
       $copyright{$tourid}=$cright;
       $editor{$tourid}=$editor;
       $vid='';
       my $author='';
       my $eqauthor=1;
       my $qnumber=0;
       my @arr;
       while ( @arr=$sth1->fetchrow, $arr[0])
       {
           my($i, $name) = 0;
           $qnumber++;
           foreach $name (@{$sth1->{NAME}}) {
                   $arr[$i]=~s/^(.*?)\s*$/$1/;
                   $Question{$tourid}[$qnumber]{$name} = $arr[$i++];
           }
           if ($vid)
           {
             if ($vid ne $Question{$tourid}[$qnumber]{'Type'}) {print STDERR "Warning: Different types for Tournament $tourid\n"}
           } else 
           {
               $vid=$Question{$tourid}[$qnumber]{'Type'};
           } 
   
           if ($author)
           {
             if ($author ne $Question{$tourid}[$qnumber]{'Authors'})  
             {
                $eqauthor=0;
             }
           } else 
           {
               $author=$Question{$tourid}[$qnumber]{'Authors'};
               $eqauthor=0 unless $author;
           } 
       }
       $vid{$tourid}=$vid;
       $qnumber{$tourid}=$qnumber;
       $author{$tourid}=$eqauthor ? $author : '';
     }
   
   
     $vid='';
     my $eqvid=1;
     my $eqauthor=1;
     foreach (@tours)
     {
        $vid||=$vid{$_};
        if ($vid{$_} ne $vid)
        {
           $eqvid=0;
        }
        $author||=$author{$_};
        if (!$author{$_} || ($author{$_} ne $author))
        {
           $eqauthor=0;
        }
     }
     
     print OUT "Вид:\n$vid\n\n" if $eqvid;
     print OUT "Автор:\n$author\n\n" if $eqauthor;
   
     foreach my $tour(@tours)
     {
        print OUT "Тур:\n$tourtitle{$tour}\n\n";
        print OUT "Вид:\n$vid{$tour}\n\n" if  !$eqvid;
        print OUT "Копирайт:\n$copyright{$tour}\n\n" if $copyright{$tour} && ($copyright{$tour} ne $Copyright);
        print OUT "Редактор:\n$editor{$tour}\n\n" if $editor{$tour} && ($editor{$tour} ne $Editors);
        $tourauthor=0;
        if (!$eqauthor && $author{$tour})
        { 
          print OUT "Автор:\n$author{$tour}\n\n";
          $tourauthor=1;
        }
        foreach my $q(1..$qnumber{$tour})
        {
           print OUT "Вопрос $q:\n".$Question{$tour}[$q]{'Question'}."\n\n";
           print OUT  "Ответ:\n".$Question{$tour}[$q]{'Answer'}."\n\n";
           print OUT  "Автор:\n".$Question{$tour}[$q]{'Authors'}."\n\n" 
                  if !$tourauthor && !$eqauthor && $Question{$tour}[$q]{'Authors'};
           print OUT  "Комментарий:\n".$Question{$tour}[$q]{'Comments'}."\n\n" 
                  if $Question{$tour}[$q]{'Comments'};
           print OUT "Источник:\n".$Question{$tour}[$q]{'Sources'}."\n\n" 
                  if $Question{$tour}[$q]{'Sources'};
           print OUT "Рейтинг:\n".$Question{$tour}[$q]{'Rating'}."\n\n" 
                  if $Question{$tour}[$q]{'Rating'};
   
        }
     }
   
     close OUT;
   
   
   
   }
   
   
 MAIN:  MAIN:
 {  {
Line 1458  $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит Line 1643  $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит
                          );                           );
             $tour = (param('tour')) ? param('tour') : 0;              $tour = (param('tour')) ? param('tour') : 0;
             my (@files) = &PrintArchive($dbh, $tour);              my (@files) = &PrintArchive($dbh, $tour);
               WriteFile($dbh,$_) foreach @files;
             open F, "$ZIP -j - $SRCPATH/COPYRIGHT @files |";              open F, "$ZIP -j - $SRCPATH/COPYRIGHT @files |";
             print (<F>);              print (<F>);
             close F;              close F;
Line 1497  $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит Line 1683  $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит
                     $tour = ($sth->fetchrow)[0];                      $tour = ($sth->fetchrow)[0];
                     $sth->finish;                      $sth->finish;
                 }                  }
                 print &PrintTournament($dbh, $tour, param('answer'));                  my $QuestionNumber=0;
                   my $qnum;
                   if ($qnum=param('qnumber')){
                     my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions
                        WHERE ParentId=$tour AND Number=$qnum");
                     $sth->execute;
                     $QuestionNumber=($sth->fetchrow)[0]||0;
                   }
                   if ($QuestionNumber) {
                     print &PrintQuestion($dbh, $QuestionNumber, param('answer')||0, $qnum, 1);
   #                                        $dbh, $Id, $answer, $qnum, $title, $text
                   } else  {
                      print &PrintTournament($dbh, $tour, param('answer'));
                   }
         }          }
         if (!$text) {          if (!$text) {
                 print &Include_virtual("../dimrub/db/footer.html");                  print &Include_virtual("../dimrub/db/footer.html");
   print <<EEE
     <SCRIPT LANGUAGE="JavaScript">
   function toggle(e) {
     if (e.style.display == "none") {
        e.style.display="";
     } else {
        e.style.display = "none";
    }
   }
   </SCRIPT>
   EEE
   ;
                 print end_html;                  print end_html;
         }          }
         $dbh->disconnect;          $dbh->disconnect;

Removed from v.1.57  
changed lines
  Added in v.1.71


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