--- db/prgsrc/db.cgi 2006/09/24 19:53:59 1.143 +++ db/prgsrc/db.cgi 2008/11/09 20:02:36 1.149 @@ -14,6 +14,7 @@ use Getopt::Std; eval {require "dbdefs.pl";} ; my $url=url||''; my @used_stop=(); +my $showNearQuestions=0; $dbuser||="piataev"; $dbname||="chgk"; $dbpass||=""; @@ -279,15 +280,17 @@ sub tourhref { my $res; if ($usehtml) { $res=$t; + $res=~s/\-q$//; + $res=~s/\-a$//; $res.=$a?"-a":"-q" unless $gr; $res.=".html"; $res=~s/(\#\d+)(.*)$/$2$1/; my $t=$res; $t=~s/\#.*$//; - $res=~s/\.1// unless -e "$realHTMLDIR$t"; +# $res=~s/\.1// unless $gr ||$res=~/\.\d+$/;#-e "$realHTMLDIR$t"; $t=$res; $t=~s/\#.*$//; - $res=~s/\.html/-q\.html/ unless -e "$realHTMLDIR$t"; +# $res=~s/\.html/-q\.html/ unless -e "$realHTMLDIR$t"; $res="$HTMLDIR$res" unless $opt_z; return $res; } else { @@ -1191,7 +1194,6 @@ sub PrintTournament { p("Дополнительная информация об этом турнире - по адресу " . a({-'href'=>$URL}, $URL)); } - if ($Copyright) { $output .= p("Копирайт: " . $Copyright); } @@ -1201,6 +1203,10 @@ sub PrintTournament { if ($Info) { $output .= p($Info); } + + $output.=p("XML"); + + return $output; } @@ -1297,6 +1303,13 @@ sub PrintTour { $output .= p($Tournament{'Info'}); } + if ($Tour{'Info'}) { + $output .= p($Tour{'Info'}); + } + + + $output.=p("XML"); + my $n=$Tour{'Number'}; if ($answer == 0) { my $nn=".$n"; @@ -1499,6 +1512,8 @@ $output.="" } $output=~s/\(pic: ([^\)]*)\)/

/g unless $text; + $output=~s/\(aud: ([^\)]*)\)/

<\/embed>

/g unless $text; + $output=~s/⌡/\ï/g; $output=~s/⌠/\Ï/g; @@ -1507,9 +1522,9 @@ $output.="" $fname||=param('tour'); my $qid=$fname ? ($fname.".$Question{'Number'}" ): ''; - $output.=br.a({href=> $url."?metod=proxy& + $output.=br.a({href=> "/search/"."?metod=proxy& qid=$qid"}, 'Близкие вопросы').p - if $answer>0 && !$text && $qid; + if $answer>0 && !$text && $qid && $showNearQuestions; return $output; } @@ -1991,17 +2006,17 @@ MAIN: print end_html; die "Can't connect to DB chgk\n"; }; + $dbh->do("set names koi8r"); - - if (param('qid') && (param('qid')=~/^\d+$/) || $tour && $tour=~/^\d+$/) { +# if (param('qid') && (param('qid')=~/^\d+$/) || $tour && $tour=~/^\d+$/) { # my $destination='http://chgk.zaba.ru/search.html'; # print header (-'Content-Type' => 'text/html', # -'Location:'=> 'http:\\db.chgk.info'); - Redirect($destination); - exit - } +# Redirect($destination); +# exit +# } - if ($tour && !param('qnumber') && (!param('answers')||(param('answers')<=1))) + if (0 && $tour && !param('qnumber') && (!param('answers')||(param('answers')<=1))) { my $n=param('tour'); $n=~s/.txt$//;