#!/usr/bin/perl # $nocache = 1; #DEBUG require($bin = qw( /usr/home/tukey/bin/common2.pl )); # E.g. http://marmacs.org/2007/confex.pl?qs=qs&ses=http://acs.confex.com/acs/htsearch.cgi $Q = $ENV{QUERY_STRING}; $Q = "MEETING.HTM" if($Q eq ""); $ENV{QUERY_STRING} = $Q; $R = $ENV{HTTP_REFERER}; $QQ = $Q; $QQ =~ s/http:\/\/((www.)?marmacs.org(\/2007)?|(acs.)?confex.com)//gs; ######### DETECT & BLOCK ABUSE: ######### DETECT & BLOCK ABUSE: ######### if($Q =~ /^\/|[;]|\b(curl|wget|powned|matheus|bot\.pl)\b|regimesyndicate|(drexel.)?bkstore.com|default.asp|^[PS][0-9]+.HTM=/is || $QQ =~ /^[a-z0-9]+:\/\/|https?:\/\//is) { $remote = $ENV{REMOTE_ADDR}; $host = `/usr/bin/host $remote 2>/dev/null || true` if($remote =~ /^\d+\./); chomp($host); LOGIT("BAD_QUERY\t$remote\t$host"); &ContentType; print < 403 ERROR: Invalid query

403 ERROR: Invalid query

EOF exit 0; } ######### Another sanity check to detect & block abuse: if($Q =~ m/^(https*:\/\/|confex\.pl)/is && $Q !~ m/confex\.com/is ) { $remote = $ENV{REMOTE_ADDR}; $host = `/usr/bin/host $remote 2>/dev/null || true` if($remote =~ /^\d+\./); chomp($host); if(0 && $R eq "") { ## Too strong! Wouldn't allow folks to keep bookmarks to sessions! LOGIT("BAD_REFERER\t$remote\t$host"); &ContentType; print ReadFile("403_forbidden.html"); exit 0; } if($host =~ /googlebot/i) { ## Does this prevent Google from indexing our program ??? ## No, since it's only external hrefs LOGIT("NO_PASS_THROUGH\t$&"); print "Location: missing.html\n\n"; ## Which doesn't exist! exit 0; # &ContentType; # print ReadFile("404_page_not_found.html"); # print "
remote=($remote)\nhost = ($host)\n";
#	exit 0;
    }
    LOGIT("REDIRECT\t$Q");
    print "Location: $Q\n\n";
    exit 0;
    ## When I discovered Google trying to index the Drexel bookstore
    ## *through* this script, I realized I needed to add this bit 
    ## of code that essentially does a pass-through for any URL that
    ## isn't "ours".  Actually, this is just a fail-safe here;
    ## the core pass-through fix is below.
}

## Why can't I do this down below???




$ENV{PATH} = "$bin:$ENV{PATH}" unless($ENV{PATH} =~ m($bin));
($C) = ($0 =~ m|([^/]*)$|);
use subs ("DE"."BUG", qw(Usage Die Warn Print ERR));
ChDir("/usr/www/users/tukey/acs/marmacs.org/2007");
&RunMeAsWebOwner;

# &ContentType;
# print "
\n";

$MARM      = "http://marmacs.org/2007";
$confex_pl = "$MARM/confex.pl?";
$BASE      = "http://acs.confex.com/acs/marm07/techprogram";
$EXTRA     = "confex-extra";

if(-f $EXTRA) {
   if(open(EXTRA,$EXTRA)) {
       while() {
	   chomp;
	   next if(/^ *#/);
	   next unless(/.\t./);
	   ($code,$url,$txt) = (split /\t/, $_);
	   $extra_url{$code} = $url;
	   $extra_txt{$code} = $txt;
       }
       close(EXTRA);
   }
}

## Uncomment next line to force use of local copies, bypassing call to confex
## (except for confex keyword searches)

 $BYPASS = "/usr/www/users/tukey/acs/marmacs.org/2007/confex/techprogram"; # Also see: $CACHE

$closewin = "";
$closewin = "
$closewin
"; $closewin = ""; $css = qq(); $base = qq(); $QUERY = $ENV{QUERY_STRING}; $ses = $ARGV[0]; $ses = $& if($QUERY =~ /^([PSD][0-9]+|ME[A-Z.]*|[A-Z][A-Z]*|http.*)/); # DEBUG "1: ses=($ses)"; %FORM = &cgiVals; #show_hash("FORM",\%FORM); #DEBUG &LOGIT; $URL = $ses; #if($URL =~ m|^[a-z]+://|i && $URL !~ m|http://confex.com/|i) { # print "Location: ($URL)\n\n\n\n"; #DEBUG # exit 0; #} &ContentType; $ses = $FORM{ses} if($FORM{ses}); $SES = $ses; $SES = $1 if($ses =~ m|/techprogram/([A-Z][0-9]+)\.HTM|); $SES =~ s/.*\///; $SES =~ s/\.[A-Z]*$//; # DEBUG "SES=($SES) ses=($ses) QUERY_STRING=($QUERY)"; #show_hash("FORM",\%FORM); #DEBUG #show_hash("ENV",\%ENV); #DEBUG if($FORM{formaction} =~ /qs=qs/) { $ses = $1 if ($FORM{formaction} =~ /ses=([^&]*)/); $FORM{formaction} = $ses; $URL = $ses; $Q = ""; for(keys %FORM) { $Q .= '&' if($Q); $Q .= "$_=".URLencode($FORM{$_}); } $URL .= "?$Q"; # DEBUG "qs=qs: URL=($URL)
\nses=($ses)"; } if($FORM{action} eq "search" && $ses !~ /^http/ && $FORM{formaction} =~ /htsearch.cgi/) { $URL = "http://acs.confex.com/acs/htsearch.cgi?"; } else { $URL = "$BASE/$ses.HTM" unless($ses =~ /^http/); $URL =~ s/(\.htm)\.htm$/$1/is; } #DEBUG "C: URL=($URL)"; if ($ses =~ /xxx/i) { # print "Content-Type: text/html\n\n"; #DEBUG print < Details Not Available Yet $css


The details for this session should be available soon

$closewin EOF exit 0; } if(0) { # Emergency bypass -- also disable &ContentType above. print "Location: $URL\n\n"; exit 0; } ChDir("/usr/www/users/tukey/acs/marmacs.org/2007"); # print "Content-Type: text/html\n\n"; $TMP = "tmp"; $CACHE = "cache"; # Also see: $BYPASS for $file (($TMP,$CACHE)) { if( -f $file) { unlink $file; } if(! -d $file) { mkdir $file || ERR $!; } } $max_mins = 30; $max_mins = 30*2*24*365*10; ## ten years, i.e. infinity! $max_mins = 0 if($nocache); # $max_mins = 0; ## Uncomment to force NO-CACHE nocache no-cache no cache #DEBUG "max_mins = $max_mins"; for $file (<$CACHE/x-*>) { $age = mins_old($file); if($age > $max_mins) { unlink $file; # DEBUG "Removed $file which was $age minutes old"; } } # $URL =~ s/acs/acx/g; #DEBUG # $URL =~ s/htm\b/html/gi; #DEBUG $md5 = md5($URL); $out = "x-$md5.htm"; $cache = "$CACHE/$out"; if(-f $cache) { # $age = mins_old($cache); DEBUG "Using $cache which is $age minutes old"; print ReadFile($cache); exit; } # DEBUG "
D: URL = ($URL) md5=($md5)
"; # exit; $URL =~ s/(['`;|]|%27|%7C|%3B|%60)//gs; # FURTHER SANITIZE URL - FAILSAFE! $cmd = "cd $TMP && wget -O $out -nv 2>&1 '$URL'"; if(-d $BYPASS) { # different from CACHE $file = $URL; $file =~ s|^.*[/?]||; # DEBUG "file=$file"; if(-f "$BYPASS/$file") { $cmd = "cd $TMP && cp $BYPASS/$file $out"; # DEBUG "bypassing confex"; } else { # DEBUG "Not bypassing confex"; } } # DEBUG "cmd=($cmd)"; $wgetrtn = $wgetrtn0 = `$cmd`; $wgetrtn =~ s/\b[^\n]* -> [^\n]*(\n|$)/$1/s; chomp($wgetrtn); $wgetrtn = Trim($wgetrtn); # print "
DEBUG: wgetrtn=($wgetrtn)
\n" if($wgetrtn); $file0 = $URL; $file0 =~ s/.*\///; $file = "$TMP/$out"; # DEBUG "wget output file=($file)"; $_ = ReadFile($file); unlink $file; #### HACK ALERT!!!! s/Joseph\s+D[.]?\s+Armstrong(\s+III)?/Shane Krska/gs; s/\bGerad\b/Gerard/gs; $zelleka = <<'EOF'; EOF $hunt = <<'EOF'; 8:40 AM--- Special Address: Re-igniting our Commitment to Science and Technology: Education, Collaboration and Innovation!

Katie Hunt, ACS President

EOF s/$zelleka/$hunt\n$&/s; s/<\/head/\n$base\n$css\n$&/is; ######### add EXTRA to abstract here if($extra_url{$SES} || $extra_txt{$SES}) { $s = " "; $s .= "[ more... ] " if($extra_url{$SES}); $s .= $extra_txt{$SES}." "; if($SES =~ /^S/) { s|()(.*?)()|$1$2$s$3|s; } else { my($old) = $_; s|(
)(.*?)(

)|$1$2$s$3|is; # DEBUG "SES=($SES). Changed? ".( ($_ eq $old)? "NO" : "YES" ); } } s||

|gs; s||

|gs; s/\n[\t ]*/\n/gs; # s/\nPresider:.*?<\/tr>/$&\n<\/td><\/tr>/s; s/(<\/td><\/tr>\n$&/gs; s/\nBack to /

$&/s; #$ttl = q( #
# # # #
#

MARM 2007 - May 16-18, 2007

#
#

#[ back #| home #| program by day #| at-a-glance #| organizers #] #

#
#
#); $ttl = q(

Technical Program

[ back | program by day | at-a-glance | organizers ]

); # q(
); unless(s//$&$ttl/s) { s/<\/head.*?>/$&$ttl/s; } s/

/$&Session:<\/i><\/b>\ \  /; s/(

)( *:)?/$1Abstract:<\/i><\/b>\ \  /; s/(Sponsor|Organizer|Presider):/$&<\/i>/gs; s/Workshop Leader:/$&<\/i>\ <\/nobr>/gs; s/]*/$& valign=top/gis; if($URL =~ /AAG/) { # s/Program-at-a-Glance/$& (preliminary)/gs; s/]*>/x1($&)/gse; sub x1 { local($_) = @_; unless(s/(border=["']?)0/${1}1/s) { s/\s/$&border=1 /s }; my($cp) = 4; unless(s/(cellpadding=["']?)[0-9]*/${1}$cp/s) { s/\s/$&cellpadding=$cp /s }; return $_; } $ntr = 0; s//


$&/gs } return $_; } s/

/

/s; s/(]*>

)(.*?)(<\/h3>\s*<\/div>\n*)//s; ($hold1,$hold2,$hold3) = ($1,$2,$3); $hold2 =~ s/h3/$& style="text-align:left;margin-top:6pt"/s; s/<\/table[^<>]*>/$&
\n$hold2/s; s/<\/form>/<\/h3>$&/s; s/Sessions:<\/b>)([^<>]*)(<)/x2($1,$2,$3)/gise; sub x2 { local($a,$b,$c) = @_; $b =~ s/; */;<\/p>

/gs; return "$a

$b

$c"; } s/(

*)([^ ][^<>]*[^ ]) *(<\/p>)/x4($1,$2,$3)/gise; sub x4 { local($a,$b,$c) = @_; local($key) = lc(Trim($b)); $key =~ s/\s*;$//; return "$a$b$c" unless($sli{$key}); $b = qq($b); return "$a$b$c"; } s/

]*>\s*View Program Details and Presentation Times<\/a>/
/s; s|


 

|

|gs; } if($URL =~ /MEETING.HTM|D37.HTM/) { s/(\n *<\/table> *\n *<\/form>)(-->)( *\n[\n ]*

*\n *<\/table>)/$1$3$2/si; s/()(.*?)(<\/span>)/x3($1,$2,$3)/gise; s/\n)(

\n)/$2$1/s; # s/

GENERAL PROGRAM/

GENERAL PROGRAM BY DAY (preliminary)/s; s/

GENERAL PROGRAM/

GENERAL PROGRAM BY DAY/s; } } if($URL =~ /action=search/) { s/<\/head/