Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea.iki.rssi.ru/Z-90/list3.pl~
Дата изменения: Sun Dec 12 20:44:15 2004
Дата индексирования: Mon Oct 1 19:59:01 2012
Кодировка:
#!/usr/bin/perl

#use Text::BibTeX;


require "bp.pl";

# get current time and data
@TIME = localtime(time);
$DATE = @TIME[3].".".(@TIME[4]+1).".".(@TIME[5]+1900);
$time = @TIME[2].":".@TIME[1].":".@TIME[0];


$bib_file1="/export/web/www/Z-90/data/z90-form.bib";
$bib_file2="/export/web/www/Z-90/data/reg-db.bib";

$head="/export/web/www/Z-90/head.html";
$tail="/export/web/www/Z-90/tail.html";
$form="form";

@TIME = localtime(time);
$DATE = @TIME[3].".".(@TIME[4]+1).".".(@TIME[5]+1900);
$time = @TIME[2].":".@TIME[1].":".@TIME[0];
$query;

if($ENV{'REQUEST_METHOD'} eq 'GET'){
$query = $ENV{'QUERY_STRING'};
}elsif($ENV{'REQUEST_METHOD'} eq 'POST'){
sysread(STDIN,$query,$ENV{'CONTENT_LENGTH'});
}
$query=urldecode($query);



if($query ne ''){
@fvalues = split(/&/,$query);

foreach $i (0 .. $#fvalues){
$str=$fvalues[$i];
($name,$val) = split(/=/,$fvalues[$i],2);
$name=&urldecode($name);
$val=&urldecode($val);
$field{$name} = $val;
}
}

$bib_file=$bib_file1;
if(defined $field{'db'}){
$bib_file=$bib_file1 if ($field{'db'} eq "1");
$bib_file=$bib_file2 if ($field{'db'} eq "2");
}

print "Content-Type: text/html\n\n";


if(checkf($head)){
open FD,"<$head" ;
while (){
print;
}close FD;
}

$totrecs = 0;


if(checkf($tail)){
open FD,"<$tail" ;
while (){
print;
}close FD;
}



sub urldecode{
local($val)=@_;
#$val =~ s/\+/ /g;
$val =~ s/%([0-9a-hA-H]{2})/pack('C',hex($1))/ge;
return $val;
}


sub check{
&bib'format("auto");

%prelist=();

print "";

$oral=1;

start:
$totrecs=0;
$cdinner=0;
$calive=0;
%prelist=();
foreach $file ($bib_file1,$bib_file2){

next unless &bib'open($file);
while ($record = &bib'read($file)){
%entry = &bib'explode($record);
next if(defined $entry{'unable'});
next if(defined $entry{'hide'});
next if(defined $entry{'no_report'});
next if(defined $entry{'use_preregistration'});
$poster="";
$hotel="";


if($oral){
next unless(defined $entry{'oral'});
$poster="hotel" if(defined $entry{'confirmed'});
}else{
next if(defined $entry{'oral'});
$poster="confirm" if(defined $entry{'confirm_poster'});
}


$entry{'author'} = $entry{'author1'}." ".$entry{'author2'} unless(defined $entry{'author'});
@l = split " ",$entry{'author'};
$key = pop @l; push @l," $key";

if(defined $prelist{$key}){
$key.=$idx++;
print "WARNING: $prelist{$key}
" if(defined $prelist{$key});
}
$prelist{$key}.="$entry{'author'}\n";

if($entry{'abstract'} ne ""){
$abstract=$entry{abstract};
$abstract=~s/\'+/\'\'/g;
$abstract=~s/\"/_/g;
$abstract=~s/\\+/\\\\/g;




$prelist{$key}.=
"$entry{'title'}\n";
}else{
$prelist{$key}.=" $entry{'title'}\n";
}

if(defined $entry{'take_me_to_the_dinner'}){
$cdinner+=($entry{'dinner_apersons'}+1);
$prelist{$key}.=" ".($entry{'dinner_apersons'}+1)."\n";
}else{
$prelist{$key}.=" 0\n";
}


$prelist{$key}.=" $poster\n";
$prelist{$key}.=" $entry{'poster_num'}\n";

if(defined $entry{'alive'}){
$calive++;
$prelist{$key}.=" $entry{'alive'}\n";
}else{
$prelist{$key}.=" \n";
}
$prelist{$key}.="\n";
$totrecs++;
}
&bib'close($file);
}


if($oral){
print "

Oral speakers:

";
}else{
print "

Planned poster session:

";
}

print "";
#print "";

foreach $i (sort keys %prelist){
print "$prelist{$i}";
}
print "
ParticipantP (\%)Title From...
";

print "
Total number of partisipants is $totrecs.

";

print "
Total number of alive is $calive.

";

print "
Total number of dinner is $cdinner.

";

if($oral){
$oral=0;
goto start;
}

print "";

}

sub checkf{
unless (-f $_[0]){
print "ERROR: Can\'t open file \"$_[0]\"" ;
return false;
}else{
return true;
}
}