version 1.141, 2005/10/28 15:12:24
|
version 1.149, 2008/11/09 20:02:36
|
Line 14 use Getopt::Std;
|
Line 14 use Getopt::Std;
|
eval {require "dbdefs.pl";} ; |
eval {require "dbdefs.pl";} ; |
my $url=url||''; |
my $url=url||''; |
my @used_stop=(); |
my @used_stop=(); |
|
my $showNearQuestions=0; |
$dbuser||="piataev"; |
$dbuser||="piataev"; |
$dbname||="chgk"; |
$dbname||="chgk"; |
$dbpass||=""; |
$dbpass||=""; |
Line 44 if ($^O =~ /win/i) {
|
Line 45 if ($^O =~ /win/i) {
|
$realHTMLDIR="/html/znatoki/baza/"; |
$realHTMLDIR="/html/znatoki/baza/"; |
} else |
} else |
{ |
{ |
$realHTMLDIR="/home/piataev/public_html/dimrub/db/files/"; |
$realHTMLDIR="/home/znatoki/chgk-db/public_html/dimrub/db/files/"; |
} |
} |
|
|
|
|
Line 67 $outputkvo=100 if $outputkvo>100;
|
Line 68 $outputkvo=100 if $outputkvo>100;
|
|
|
if (param('debug')) {$debug=1; $printqueries=1} |
if (param('debug')) {$debug=1; $printqueries=1} |
*STDERR=*STDOUT if $debug; |
*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"; |
my $u="http://db.chgk.info/cgi-bin/db.cgi?$qs"; |
Redirect ($u); |
Redirect ($u); |
exit; |
exit; |
Line 130 my $all=param('all');
|
Line 131 my $all=param('all');
|
$all=0 if lc $all eq 'no'; |
$all=0 if lc $all eq 'no'; |
my ($PWD) = `pwd` if $^O!~/win/i; |
my ($PWD) = `pwd` if $^O!~/win/i; |
chomp $PWD if $PWD; |
chomp $PWD if $PWD; |
my ($SRCPATH) = "/home/piataev/public_html/dimrub/src"; |
my ($SRCPATH) = "/home/db-chgk/public_html/dimrub/src"; |
my ($ZIP) = "/usr/local/bin/zip"; |
my ($ZIP) = "/usr/bin/zip"; |
my $DUMPFILE = "/tmp/chgkdump"; |
my $DUMPFILE = "/tmp/chgkdump"; |
my ($SENDMAIL) = "/usr/sbin/sendmail"; |
my ($SENDMAIL) = "/usr/sbin/sendmail"; |
my ($TMPDIR) = "/var/tmp"; |
my ($TMPDIR) = "/var/tmp"; |
Line 279 sub tourhref {
|
Line 280 sub tourhref {
|
my $res; |
my $res; |
if ($usehtml) { |
if ($usehtml) { |
$res=$t; |
$res=$t; |
|
$res=~s/\-q$//; |
|
$res=~s/\-a$//; |
$res.=$a?"-a":"-q" unless $gr; |
$res.=$a?"-a":"-q" unless $gr; |
$res.=".html"; |
$res.=".html"; |
$res=~s/(\#\d+)(.*)$/$2$1/; |
$res=~s/(\#\d+)(.*)$/$2$1/; |
my $t=$res; |
my $t=$res; |
$t=~s/\#.*$//; |
$t=~s/\#.*$//; |
$res=~s/\.1// unless -e "$realHTMLDIR$t"; |
# $res=~s/\.1// unless $gr ||$res=~/\.\d+$/;#-e "$realHTMLDIR$t"; |
$t=$res; |
$t=$res; |
$t=~s/\#.*$//; |
$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; |
$res="$HTMLDIR$res" unless $opt_z; |
return $res; |
return $res; |
} else { |
} else { |
Line 1191 sub PrintTournament {
|
Line 1194 sub PrintTournament {
|
p("Дополнительная информация об этом турнире - по адресу " . |
p("Дополнительная информация об этом турнире - по адресу " . |
a({-'href'=>$URL}, $URL)); |
a({-'href'=>$URL}, $URL)); |
} |
} |
|
|
if ($Copyright) { |
if ($Copyright) { |
$output .= p("Копирайт: " . $Copyright); |
$output .= p("Копирайт: " . $Copyright); |
} |
} |
Line 1201 sub PrintTournament {
|
Line 1203 sub PrintTournament {
|
if ($Info) { |
if ($Info) { |
$output .= p($Info); |
$output .= p($Info); |
} |
} |
|
|
|
$output.=p("<a href='/dbxml.php?tour=".param('tour')."'>XML</a>"); |
|
|
|
|
return $output; |
return $output; |
} |
} |
|
|
Line 1297 sub PrintTour {
|
Line 1303 sub PrintTour {
|
$output .= p($Tournament{'Info'}); |
$output .= p($Tournament{'Info'}); |
} |
} |
|
|
|
if ($Tour{'Info'}) { |
|
$output .= p($Tour{'Info'}); |
|
} |
|
|
|
|
|
$output.=p("<a href='/dbxml.php?tour=".param('tour')."'>XML</a>"); |
|
|
my $n=$Tour{'Number'}; |
my $n=$Tour{'Number'}; |
if ($answer == 0) { |
if ($answer == 0) { |
my $nn=".$n"; |
my $nn=".$n"; |
Line 1499 $output.="</span>"
|
Line 1512 $output.="</span>"
|
|
|
} |
} |
$output=~s/\(pic: ([^\)]*)\)/<p><img src="\/znatoki\/images\/db\/$1"><p>/g unless $text; |
$output=~s/\(pic: ([^\)]*)\)/<p><img src="\/znatoki\/images\/db\/$1"><p>/g unless $text; |
|
$output=~s/\(aud: ([^\)]*)\)/<p><embed src="\/znatoki\/sounds\/db\/$1"><\/embed><p>/g unless $text; |
|
|
$output=~s/⌡/\ï/g; |
$output=~s/⌡/\ï/g; |
$output=~s/⌠/\Ï/g; |
$output=~s/⌠/\Ï/g; |
|
|
Line 1507 $output.="</span>"
|
Line 1522 $output.="</span>"
|
$fname||=param('tour'); |
$fname||=param('tour'); |
my $qid=$fname ? ($fname.".$Question{'Number'}" ): ''; |
my $qid=$fname ? ($fname.".$Question{'Number'}" ): ''; |
|
|
$output.=br.a({href=> $url."?metod=proxy& |
$output.=br.a({href=> "/search/"."?metod=proxy& |
qid=$qid"}, 'Близкие вопросы').p |
qid=$qid"}, 'Близкие вопросы').p |
if $answer>0 && !$text && $qid; |
if $answer>0 && !$text && $qid && $showNearQuestions; |
return $output; |
return $output; |
} |
} |
|
|
Line 1982 MAIN:
|
Line 1997 MAIN:
|
my $texttour=$tour; |
my $texttour=$tour; |
my ($sth,$dbh); |
my ($sth,$dbh); |
my($dsn) = "DBI:mysql:database=$dbname;host=$dbhost"; |
my($dsn) = "DBI:mysql:database=$dbname;host=$dbhost"; |
$dbh = DBI->connect($dsn, $dbuser, $dbpass) |
$dbh = DBI->connect($dsn, $dbuser, $dbpass) |
# $dbh = DBI->connect("DBI:mysql:$dbname", $username, $dbpass) |
# $dbh = DBI->connect("DBI:mysql:$dbname", $username, $dbpass) |
or do { |
or do { |
print header.h1("Временные проблемы") . "База вопросов временно не |
print header.h1("Временные проблемы") . "База вопросов временно не |
Line 1991 MAIN:
|
Line 2006 MAIN:
|
print end_html; |
print end_html; |
die "Can't connect to DB chgk\n"; |
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'; |
# my $destination='http://chgk.zaba.ru/search.html'; |
# print header (-'Content-Type' => 'text/html', |
# print header (-'Content-Type' => 'text/html', |
# -'Location:'=> 'http:\\db.chgk.info'); |
# -'Location:'=> 'http:\\db.chgk.info'); |
Redirect($destination); |
# Redirect($destination); |
exit |
# exit |
} |
# } |
|
|
if ($tour && !param('qnumber') && (!param('answers')||(param('answers')<=1))) |
if (0 && $tour && !param('qnumber') && (!param('answers')||(param('answers')<=1))) |
{ |
{ |
my $n=param('tour'); |
my $n=param('tour'); |
$n=~s/.txt$//; |
$n=~s/.txt$//; |