--- db/prgsrc/db.cgi 2004/11/21 13:37:29 1.138 +++ 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||=""; @@ -44,7 +45,7 @@ if ($^O =~ /win/i) { $realHTMLDIR="/html/znatoki/baza/"; } else { - $realHTMLDIR="/home/piataev/public_html/dimrub/db/files/"; + $realHTMLDIR="/home/znatoki/chgk-db/public_html/dimrub/db/files/"; } @@ -67,7 +68,7 @@ $outputkvo=100 if $outputkvo>100; if (param('debug')) {$debug=1; $printqueries=1} *STDERR=*STDOUT if $debug; -if ($url !~ /db\.chgk\.info/ && $url !~ /localhost/ && $url !~ /bilbo/ && $url !~ /zaba/) { +if ($url !~ /db\.chgk\.info/ && $url !~ /localhost/ && $url !~ /bilbo/ && $url !~ /zaba/ && $url !~ /question\.chgk\.info/ ) { my $u="http://db.chgk.info/cgi-bin/db.cgi?$qs"; Redirect ($u); exit; @@ -130,8 +131,8 @@ my $all=param('all'); $all=0 if lc $all eq 'no'; my ($PWD) = `pwd` if $^O!~/win/i; chomp $PWD if $PWD; -my ($SRCPATH) = "/home/piataev/public_html/dimrub/src"; -my ($ZIP) = "/usr/local/bin/zip"; +my ($SRCPATH) = "/home/db-chgk/public_html/dimrub/src"; +my ($ZIP) = "/usr/bin/zip"; my $DUMPFILE = "/tmp/chgkdump"; my ($SENDMAIL) = "/usr/sbin/sendmail"; my ($TMPDIR) = "/var/tmp"; @@ -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 { @@ -433,9 +436,9 @@ action="/znatoki/cgi-bin/db.cgi"> -
Если при попытке поиска выдаётся сообщение об ошибке,
+
EOT
@@ -904,7 +907,7 @@ sub PrintList {
for (my $i = $first; $i <= $last; $i++) {
my $q=$q{$$Questions[$i-1]};
my $output;
- $output = &PrintQuestion($dbh, $q, 1, 0, 1,0,1 );
+ $output = &PrintQuestion($dbh, $q, 1, 0, 1,$text,1 );
# if (param('metod') && (param('metod') eq 'rus' || param('metod') eq 'proxy'))
{
$output=~s/\b($shablon)\b/\$1\<\/strong\>/gi;
@@ -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;
}
@@ -1278,7 +1284,7 @@ sub PrintTour {
my $sth=SelectQuestions($dbh,\@Questions,0);
for ($q = 0; $q <= $#Questions; $q++) {
fetchquestion($sth,\%q,0);
- $output .= &PrintQuestion($dbh, \%q, $answer, 0,0,0,1);
+ $output .= &PrintQuestion($dbh, \%q, $answer, 0,0,$text,1);
}
$sth->finish;
$output .= hr({-'align'=>'center', -'width'=>'80%'});
@@ -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,14 +1512,19 @@ $output.=""
}
$output=~s/\(pic: ([^\)]*)\)/ /g unless $text;
+ $output=~s/\(aud: ([^\)]*)\)/