#!/usr/bin/perl -T -I. use CGI qw(:standard); use CGI::Cookie; use print_includes; use print_sema; my %court_url=(); # check referer to redirect to corporate channel version # JR 10/5/2004 if ($ENV{HTTP_REFERER} =~ /corporate/) { my $q = new CGI; print $q->redirect( -location => "/scripts/cases/clcc.html?$ENV{QUERY_STRING}", -status => 301); exit; } $QUERY_STRING = $ENV{'QUERY_STRING'}; local(%INFO); &format($QUERY_STRING, *INFO); $court = $INFO{'COURT'}; $navby = $INFO{'NAVBY'}; ## we are not displaying any alaska cases... 10242003 - slu #if ($court eq "ak" or $court eq "AK") { # print "Status: 301 Moved Permanently\nLocation: http://www.findlaw.com/11stategov/ak/laws.html\n\n"; # exit; #} print "Content-Type: text/html\n\n"; my $include_path="/home/httpd/html/cobrands/www/guide.lp.findlaw.com/includes/"; $agent = $ENV{'HTTP_USER_AGENT'}; if ($agent =~ /Keynote/i) { print "Agent response: Done."; exit; } %statenames=("al"=>"Alabama","ak"=>"Alaska","az"=>"Arizona","ar"=>"Arkansas", "ca"=>"California","co"=>"Colorado","ct"=>"Connecticut","dcapp"=>"District of Columbia","de"=>"Delaware", "fl"=>"Florida","ga"=>"Georgia","hi"=>"Hawaii","id"=>"Idaho","il"=>"Illinois", "in"=>"Indiana","ia"=>"Iowa","ks"=>"Kansas","ky"=>"Kentucky","la"=>"Louisiana", "me"=>"Maine","md"=>"Maryland","ma"=>"Massachusetts","mi"=>"Michigan", "mn"=>"Minnesota","ms"=>"Mississippi","mo"=>"Missouri","mt"=>"Montana", "ne"=>"Nebraska","nv"=>"Nevada","nh"=>"New Hampshire","nj"=>"New Jersey", "nm"=>"New Mexico","ny"=>"New York","nc"=>"North Carolina","nd"=>"North Dakota", "oh"=>"Ohio","ok"=>"Oklahoma","or"=>"Oregon","pa"=>"Pennsylvania", "ri"=>"Rhode Island","sc"=>"South Carolina","sd"=>"South Dakota", "tn"=>"Tennessee","tx"=>"Texas","ut"=>"Utah","vt"=>"Vermont","va"=>"Virginia", "wa"=>"Washington","wv"=>"West Virginia","wi"=>"Wisconsin","wy"=>"Wyoming"); # Site-specific parameters $codetop = "/home/httpd/html/content/caselaw/data/"; $codetop2 = "/home/httpd/html/content/caselaw/data2/circs/"; $metatop = "/home/httpd/html/content/caselaw/data2/meta/"; if ($court eq "ca") { $state_top="/home/httpd/html/content/caselaw/data2/".$court."_cases_html/"; $state_metatop="/home/httpd/html/content/caselaw/data2/".$court."meta/"; } else { $state_metatop = "/home/httpd/html/content/caselaw/data/".$court."/cases/"; $state_top = "/home/httpd/html/content/caselaw/data/".$court."/cases/"; } if (exists($statenames{$court})) { $court=uc($court); } $navby = lc($navby); if (! $court) { if ($navby eq "search") { $court = $INFO{'CASE'}; $court =~ s/.*\/data\/US.*/US/i; $court =~ s/.*\/data2\/circs\/([0-9FeDCthrdnus]+)\/.*/$1/i; $court =~ s/.*\/data2\/circs\/(Fedclaim)\/.*/$1/i; $court =~ s/.*\/uscircs\/([0-9FeDCthrdnus]+)\/.*/$1/i; $court =~ s/fed/Fed/i; $court =~ s/dc/DC/i; $court =~ s/Fedclaim/fedclaim/i; } else { print "HTTP/1.0 301 OK\nLocation: http://www.findlaw.com/casecode/index.html\n\n"; exit; } } # If there is a page reference without hash mark, # get it to add relative hash mark for page requests. $pageno = $INFO{'PAGENO'}; if ($INFO{"FRIEND"}){ $selfref = "/scripts/getcase.pl?court=$court&friend=$INFO{'FRIEND'}"; }else{ $selfref = "/scripts/getcase.pl?court=$court"; } # Set the directories if (exists($statenames{lc($court)})) { $meta=$state_metatop; } else { $meta = $metatop.$court."/"; } if (lc($court) eq "us") { $file = $codetop.$court."/"; } elsif (exists($statenames{lc($court)})) { $file = $state_top; } else { $file = $codetop2.$court."/"; } # Set some basic locator variables if ($INFO{'NO'}) { $page = $INFO{'NO'}; $page =~ s/\-//; $vol = ""; } else { if ($INFO{'F'}) { $vol = $INFO{'F'}."/".$INFO{'VOL'}; $vol =~ s/\//\\/g; } else { $vol = $INFO{'VOL'}; if ($court eq "fedclaim") { $page = $INFO{'VOL'}; $page =~ s/(.*?\/)(.*)/$2/; } } $page = $INFO{'INVOL'} if $court ne "fedclaim"; if ($INFO{'PAGE'} && !$page) { $page = $INFO{'PAGE'}; $pageno = $page; } } # Determine the navigational method. # Assume navigation is by case if page number is given. # Otherwise, we have a court and volume browsing if ($page) { $navby = "case"; } elsif (! $navby) { if (lc($court) eq "us") { $navby = "vol"; } else { $navby = "year"; } } # Determine the court name if (lc($court) eq "us") { $courtname = "Supreme Court"; $courtlink = "supreme"; } elsif (lc($court) eq "fedclaim") { $courtname = "Court of Federal Claims"; $courtlink = "courts\/".$court; } elsif (exists($statenames{lc($court)})) { $courtname = "$statenames{lc($court)} State Court"; $courtlink = "states\/".$court; } else { $courtname = $court." Circuit Court"; $courtlink = "courts\/".$court; } $uc_courtname=uc($courtname); $fromext = 1; $add2lnks = ""; $addlnkshtml = ""; $gapartner = ""; $linkurl = $INFO{'LINKURL'}; $graphurl = $INFO{'GRAPHURL'}; $partner = $INFO{'PARTNER'}; $partner = $INFO{'FRIEND'} if ($INFO{'FRIEND'}); $graphurl = "" if ($graphurl =~ /GRAPHURL/); $linkurl = "" if ($linkurl =~ /LINKURL/); $partner = "" if (($partner =~ /PARTNER/) || ($partner =~ /FRIEND/)); # Determine whether it is coming from other, "trusted" site if ($referer) { $fromext = 0 if ($referer =~ /findlaw\.com/i); $fromext = 0 if ($referer =~ /uscaselaw\.com/i); ################## Begin Annotation Partners ############### $gapartner = "oyez" if (($referer =~ /\.nwu\.edu/i) && ($referer =~ /oyez/i) && ($referer =~ /case_id/i)); $gapartner = "ppfa" if ($referer =~ /www\.ppfa\.org/i); $gapartner = "FACT" if ($referer =~ /w3\.trib\.com\/FACT/i); $gapartner = "washingtonpost" if ($referer =~ /washingtonpost\.com/i); ################### Begin Co-Brand Partners ############### if (! $partner) { $partner = $gapartner if ($gapartner eq "oyez"); $partner = "wisbar" if ($referer =~ /www\.wisbar\.org/i); } ################### Automatic Back-Link Gifs ############# #$graphurl = "http://www.findlaw.com/images/backto/".$partner.".gif" if ($partner eq "oyez"); $graphurl = "http://www.findlaw.com/images/backto/".$gapartner.".gif" if ($gapartner eq "washingtonpost"); } else { $fromext = 0; } if ($linkurl) { $linkurlesc = &escape($linkurl); $addlnkshtml .= ""; if (! $graphurl) { $graphurl = "http://www.findlaw.com/images/linkbacks/linkback.gif"; $add2lnks = "linkurl=$linkurlesc"; } else { $graphurlesc = &escape($graphurl); $addlnkshtml .= ""; $add2lnks = "linkurl=$linkurlesc&graphurl=$graphurlesc"; } } else { if ($graphurl) { $linkurl = $referer if $fromext; if (! $linkurl) { $graphurl = "http://www.findlaw.com/images/youricon.gif"; $linkurl = "http://www.findlaw.com/info/link/supreme.html"; } else { $linkurlesc = &escape($linkurl); $graphurlesc = &escape($graphurl); $addlnkshtml .= ""; $add2lnks = "linkurl=$linkurlesc&graphurl=$graphurlesc"; } } else { # Take the default ad # $graphurl = "http://www.findlaw.com/images/youricon.gif"; # $linkurl = "http://www.findlaw.com/info/link/supreme.html"; } } if ($partner) { $add2lnks .= "&" if $add2lnks; $add2lnks .= "friend=$partner"; } $selfref .= "&".$add2lnks if ($add2lnks); ## The main rendering routine $error = 0; # Check whether someone typed in name for volume if ($vol) { $vol =~ s/ //g; if (!(exists($statenames{lc($court)})) && ($court ne "fedclaim")) { $vol =~ s/[a-z]+//i; } if (! $vol) { &print_headers; print "
\n"; print "

Invalid Entry

Please specify a volume number."; exit; } elsif (lc($court) eq "us" && $vol>544) { &print_headers; print "
\n"; print "

Invalid Volume Number

Please specify a volume number in the range of 150 to 544, or 000 for the most recent cases."; exit; } } if ($navby eq "case") { # Already have: $page, $court if ($vol) { if ($court eq "IL") { if($page eq "1") { $filename = $file.$vol.".txt"; } elsif ($page eq "2") { $filename = $file.$vol.".html"; } else { $filename = $file.$vol.".htm"; } } elsif ($court eq "MT") { $filename = $file.$vol."-".$page.".htm"; } elsif ($court eq "UT") { $filename = $file.$vol."/".$page.".htm"; } elsif ($court eq "NY") { $filename = $file.$vol."_".$page.".html"; } elsif ($court eq "WA") { if ($page eq "1") { $filename = $file.$vol.".txt"; } elsif ($page eq "3") { $filename = $file.$vol.".htm"; } elsif ($page eq "4") { $filename = $file.$vol.".html"; } else { $filename = $file.$vol."_".$page.".txt"; } } elsif ($court eq "MA") { if ($page eq "1") { $filename = $file.$vol.".html"; } elsif ($page eq "2") { $filename = $file.$vol.".htm"; } } elsif ($court eq "KS") { $filename = $file.$vol.$page.".htm"; } elsif (($court eq "TX") or ($court eq "WI") or ($court eq "ME") or ($court eq "NH") or ($court eq "MI") or ($court eq "WV") or ($court eq "NM") or ($court eq "SC") or ($court eq "FL") or ($court eq "NJ") or ($court eq "SD") or ($court eq "AZ") or ($court eq "CO") or ($court eq "NV") or ($court eq "OR") or ($court eq "MN") or ($court eq "IN") or ($court eq "RI") or ($court eq "OH")) { if ($page eq "1") { $filename = $file.$vol.".htm"; } else { $filename = $file.$vol.".html"; } } elsif ($court eq "AL") { if ($page eq "1") { $filename = $file.$vol.".txt"; } elsif ($page eq "2") { ## added 01/04/2000 $filename = $file.$vol.".htm"; } } elsif ($court eq "WY") { $filename = $file.$vol.$page.".htm"; } elsif ($court eq "AK") { if ($vol eq "1") { $filename = $file.$page.".htm"; } else { $filename = $file.$vol.$page.".txt"; } } elsif (($court eq "AR") or ($court eq "VA")) { if ($page eq "1") { $filename = $file.$vol.".txt"; } else { $filename = $file.$vol.".html"; } } elsif (($court eq "MO") or ($court eq "OK") or ($court eq "NC")) { if (-e $file.$vol.$page.".htm") { $filename = $file.$vol.$page.".htm"; } else { $filename = $file.$vol.$page.".html"; } } elsif ($court eq "VT") { $filename = $file.$vol.$page.".OP"; } elsif (($court eq "HI") or ($court eq "ND")) { $filename = $file.$vol.".htm"; } elsif ($court eq "IA") { $filename = $file.$vol.".asp"; } elsif (($court eq "NE") or ($court eq "MS")) { $filename = $file.$vol.".html"; } elsif ($court eq "fedclaim") { if ($vol !~/1997|1998|1999|2000|2001/) { $filename = $file . $vol . ".pdf"; } else { $filename = $file . $vol . ".html"; } } else { $filename = $file.$vol."/".$page.".html"; } } else { if ($court eq "CA") { $filename=$file.substr($page,0,1)."/".$page.".html"; } elsif (exists($statenames{lc($court)})) { $filename=$file; } else { $filename = $file.$page.".html"; } } $filename=~s/\\/\//g; ## added 01/27/2000 $filename =lc($filename); ## added 04/05/2000 if ((lc($court) eq "us") or (exists($statenames{lc($court)})) or ($INFO{'EXACT'})) { $newfilename=$filename; $newfilename=~s/\..*$/.pdf/; # begin correction block: some case numbers erroneously get - added to them (although this is usually legitimate) if ((!(-e $newfilename)) && ($newfilename =~ /-/)) { $newfilename =~ s/-//gs; } if ((!(-e $filename)) && ($filename =~ /-/)) { $filename =~ s/-//gs; } # end correction block if (-e $newfilename) { # Only works for 8th circuit exact matching .pdf files open(CASE, '<', $newfilename); binmode(CASE); while(read(CASE, $buf, 16384)) { print $buf; } close(CASE); exit; } elsif (open(CASE, '<', $filename)) { &print_case(); close(CASE); if($partner eq "ccc") { print "
\n"; &parse_includes("right"); &parse_includes("bottom"); } elsif (-e "/home/httpd/html/content/caselaw/data2/meta/partners/".$partner."_footer.html") { open(FOOTER, '<', "/home/httpd/html/content/caselaw/data2/meta/partners/".$partner."_footer.html"); print
\n"; print "\n\n" if $court !~/us|tx|nj|ne|co|nh|ar|fl|9th|5th|in|ks|ma|me|mi|ia|il|mn|mo|mt|nc|nd|nv|or|ri|sc|al|sd|ok|ut/i; ## e.g.: ../getcase.pl?court=nm&vol=99ca-099&invol=2 &print_file("right.html"); &print_file("bottom.html"); } exit; } elsif (lc($court) ne "us") { # Could not find it directly. So try to look it up # in the index file (in case it is an older one). $error= "Could not access $filename and file=$file and page=$page"; if ($INFO{'R'}) { $error = $filename; } else { $navby = "docket"; $selfref .= "&r=2"; } } elsif ((!$fromext) && $INFO{'INVOL'}) { $error = $filename; } else { # Apparently an "at"--try to catch lowest one. $case = "0"; if (opendir(DDIR, $file.$vol)) { @dfiles = readdir(DDIR); closedir(DDIR); @dfiles = sort numerically @dfiles; foreach $f (@dfiles) { next if $f eq "."; next if $f eq ".."; next if $f eq "index"; next if $f eq "YEAR"; next if $f eq "000"; $f =~ s/\.html//; if ($f < $page) { if ($f > $case) { $case = $f; } } } } else { $error="Sorry, there are no cases in volume $vol"; } if ($case eq "0") { $navby = "vol"; } else { $page = $case; $filename = $file.$vol."/".$case.".html"; if (open(CASE, '<', $filename)) { &print_case(); close(CASE); if (-e "/home/httpd/html/content/caselaw/data2/meta/partners/".$partner."_footer.html") { open(FOOTER, '<', "/home/httpd/html/content/caselaw/data2/meta/partners/".$partner."_footer.html"); print