version 1.130, 2004/03/11 07:14:14
|
version 1.133, 2004/03/17 10:59:16
|
Line 2
|
Line 2
|
|
|
use DBI; |
use DBI; |
use CGI ':all'; |
use CGI ':all'; |
use strict; |
#use strict; |
use Time::Local; |
use Time::Local; |
|
my $proxyredirect=1; |
use POSIX qw(locale_h); |
use POSIX qw(locale_h); |
use locale; |
use locale; |
use vars qw($opt_z); |
use vars qw($opt_z); |
use Getopt::Std; |
use Getopt::Std; |
my ($dbuser,$dbname,$dbpass,$dbhost); |
#my ($dbuser,$dbname,$dbpass,$dbhost); |
require "dbdefs.pl"; |
require "dbdefs.pl"; |
|
my $url=url||''; |
$dbuser||="piataev"; |
$dbuser||="piataev"; |
$dbname||="chgk"; |
$dbname||="chgk"; |
$dbpass||=""; |
$dbpass||=""; |
Line 24 open STDERR, ">/var/tmp/errors1";
|
Line 26 open STDERR, ">/var/tmp/errors1";
|
my $newsurl='http://news.chgk.info/'; |
my $newsurl='http://news.chgk.info/'; |
my $reklama="../dimrub/db/reklama.html"; |
my $reklama="../dimrub/db/reklama.html"; |
my $footer="../dimrub/db/footer.html"; |
my $footer="../dimrub/db/footer.html"; |
|
$footer="../../chgk/footer.html" if $url=~/zaba/; |
|
$reklama="../../chgk/reklama.html" if $url=~/zaba/; |
my $datefooter="../dimrub/db/date"; |
my $datefooter="../dimrub/db/date"; |
|
$datefooter="../../chgk/date" if $url=~/zaba/; |
|
|
my $fname; |
my $fname; |
$reklama="../reklama.html" if $opt_z; |
$reklama="../reklama.html" if $opt_z; |
Line 40 if ($^O =~ /win/i) {
|
Line 44 if ($^O =~ /win/i) {
|
{ |
{ |
$realHTMLDIR="/home/piataev/public_html/dimrub/db/files/"; |
$realHTMLDIR="/home/piataev/public_html/dimrub/db/files/"; |
} |
} |
my $url=url||''; |
|
|
|
my $usehtml=$opt_z||0; |
my $usehtml=$opt_z||0; |
$usehtml=1; |
$usehtml=1; |
Line 67 if ($url !~ /db\.chgk\.info/ && $url !~
|
Line 71 if ($url !~ /db\.chgk\.info/ && $url !~
|
exit; |
exit; |
} |
} |
|
|
if ($metod=~/proxy/ && $url !~ /localhost/ && $url !~ /bilbo/ && $url !~ /zaba/) { |
if ($proxyredirect && $metod=~/proxy/ && $url !~ /localhost/ && $url !~ /bilbo/ && $url !~ /zaba/) { |
my $u="http://chgk.zaba.ru/cgi-bin/db.cgi?$qs"; |
my $u="http://chgk.zaba.ru/cgi-bin/db.cgi?$qs"; |
Redirect ($u); |
Redirect ($u); |
exit; |
exit; |
Line 286 sub tourhref {
|
Line 290 sub tourhref {
|
return $res; |
return $res; |
} else { |
} else { |
$res=$url; |
$res=$url; |
$res.="?tour=$t"; |
$res.=$a?"?answers=1&":"?"; |
$res.=$a?"&answers=1":""; |
$res.="tour=$t"; |
|
|
return $res; |
return $res; |
} |
} |
|
|
Line 424 action="/znatoki/cgi-bin/db.cgi">
|
Line 429 action="/znatoki/cgi-bin/db.cgi">
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
|
<p><i>Если при попытке поиска выдаётся сообщение об ошибке, |
|
попробуйте воспользоваться |
|
<a href="http://chgk.zaba.ru/search.html">зеркалом базы</a></i> |
</center> |
</center> |
|
|
EOT |
EOT |
Line 462 sub makeproxysstr {
|
Line 470 sub makeproxysstr {
|
# $good{$words[$_]}=1 foreach 0..4; |
# $good{$words[$_]}=1 foreach 0..4; |
foreach (@words) |
foreach (@words) |
{ |
{ |
$good{$_}=1 if $c{$_}<200; |
$good{$_}=1 if $c{$_}<200 && length $_>2; |
} |
} |
|
|
$good{$words[$_]}=0 foreach 16..$#words; |
$good{$words[$_]}=0 foreach 16..$#words; |
Line 1326 sub PrintField {
|
Line 1334 sub PrintField {
|
sub PrintQuestion { |
sub PrintQuestion { |
my ($dbh, $Id, $answer, $qnum, $title, $text,$h) = @_; |
my ($dbh, $Id, $answer, $qnum, $title, $text,$h) = @_; |
my ($output, $titles) = ('', ''); |
my ($output, $titles) = ('', ''); |
|
my $fname; |
my (%Question); |
my (%Question); |
if ($h) { |
if ($h) { |
%Question=%$Id; |
%Question=%$Id; |
Line 1347 sub PrintQuestion {
|
Line 1356 sub PrintQuestion {
|
if (!$text) { |
if (!$text) { |
$output .= hr({width=>"50%"}) if $answer>=0; |
$output .= hr({width=>"50%"}) if $answer>=0; |
if ($title) { |
if ($title) { |
my $fname=$Question{'FileName'}; |
$fname=$Question{'FileName'}; |
$fname=~s/\.txt//; |
$fname=~s/\.txt//; |
$titles .= |
$titles .= |
dd(img({src=>"/icons/folder.open.gif"}) . " " . |
dd(img({src=>"/icons/folder.open.gif"}) . " " . |
Line 1453 $output.="</span>"
|
Line 1462 $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; |
$paramtour||=param("tour"); |
$paramtour||=param("tour"); |
my $qid=$paramtour ? ($paramtour.".$Question{'Number'}" ): ''; |
$fname=$fname.".$Question{'TourNumber'}" if $fname && $Question{'TourNumber'}; |
|
$fname||=param('tour'); |
|
my $qid=$fname ? ($fname.".$Question{'Number'}" ): ''; |
|
|
$output.=br.a({href=> $url."?metod=proxy& |
$output.=br.a({href=> $url."?metod=proxy& |
qid=$qid"}, 'Близкие вопросы').p |
qid=$qid"}, 'Близкие вопросы').p |
Line 1957 MAIN:
|
Line 1968 MAIN:
|
my $d=$destination; |
my $d=$destination; |
$d=~s/$HTMLDIR/$realHTMLDIR/; |
$d=~s/$HTMLDIR/$realHTMLDIR/; |
# print header.$destination; |
# print header.$destination; |
print header."$d|".(-e "$realHTMLDIR$n.html"); |
# print header."$d|".(-e "$realHTMLDIR$n.html"); |
if (-e $d) { |
if (-e $d) { |
Redirect($destination); |
Redirect($destination); |
exit |
exit |
} |
} |
$d=~s/\.\d+//; |
$d=~s/\.\d+//; |
$destination=~s/\.\d+//; |
$destination=~s/\.\d+//; |
print br.br.$d; |
|
if (-e $d) { |
if (-e $d) { |
Redirect($destination); |
Redirect($destination); |
exit |
exit |
Line 2052 print br.br.$d;
|
Line 2062 print br.br.$d;
|
my $title="Результаты поиска на \"". ($proxysstr||$sstr) .'"' |
my $title="Результаты поиска на \"". ($proxysstr||$sstr) .'"' |
if ($proxysstr||$sstr); |
if ($proxysstr||$sstr); |
$title||="База вопросов"; |
$title||="База вопросов"; |
|
|
$globaloutput.=start_html(-"title"=>$title, |
$globaloutput.=start_html(-"title"=>$title, |
-author=>'dimrub@icomverse.com', |
-author=>'dimrub@icomverse.com', |
-bgcolor=>'#fff0e0', |
-bgcolor=>'#fff0e0', |
-vlink=>'#800020'); |
-vlink=>'#800020');#} |
$globaloutput.="<style> |
$globaloutput.="<style> |
td {font-size: x-small; font-family : sans-serif} |
td {font-size: x-small; font-family : sans-serif} |
th {font-size: x-small; font-family : sans-serif} |
th {font-size: x-small; font-family : sans-serif} |