--- db/prgsrc/db.cgi 2005/10/28 15:08:51 1.140
+++ db/prgsrc/db.cgi 2008/03/02 05:25:30 1.147
@@ -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 {
@@ -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;
}
@@ -1296,6 +1302,7 @@ sub PrintTour {
if ($Tournament{'Info'}) {
$output .= p($Tournament{'Info'});
}
+ $output.=p("XML");
my $n=$Tour{'Number'};
if ($answer == 0) {
@@ -1507,9 +1514,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;
}
@@ -1982,7 +1989,7 @@ MAIN:
my $texttour=$tour;
my ($sth,$dbh);
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)
or do {
print header.h1("Временные проблемы") . "База вопросов временно не
@@ -1991,17 +1998,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+$/) {
- my $destination='http://chgk.zaba.ru/search.html';
+# my $destination='http://chgk.zaba.ru/search.html';
# print header (-'Content-Type' => 'text/html',
# -'Location:'=> 'http:\\db.chgk.info');
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$//;