#!/usr/bin/perl # # Dig out photos & documents for a site. require "BWcgilib.pl"; require "define.pl"; print "Content-type: text/html\n\n"; $photodir = join("/", $htmlroot, "photos"); $badges = join("/", $htmlroot, "shields"); $datadir = join("/", $htmlroot, "data"); $recentdir = join("/", $htmlroot, "recent"); $mapdir = join("/", $htmlroot, "maps"); $terraserver = join("/", $mapdir, "terraserver/images"); $topomaps = join("/", $mapdir, "topomaps"); $historydir = join("/", $htmlroot, "history"); $fn = join("/", $datadir, "perm-jss.txt"); $eufn = join("/", $datadir, "europe.txt"); $terradata = join("/", $datadir, "terraserver.txt"); if (open(TERRA, $terradata)) { @terra = ; close(TERRA); } &parse_form_data(*simple_form); $site = &noquotes($simple_form{'site'}); $zsite = &noquotes($simple_form{'zsite'}); $pic = &trim($simple_form{'pic'}); $doc = &trim($simple_form{'doc'}); $www = &trim($simple_form{'www'}); $srchkey = &trim($simple_form{'key'}); $xcountry = $simple_form{'country'}; $rec = &trim($simple_form{'rec'}); print "\n"; print "Information for $site\n"; print "\n"; print "\n"; print "\n"; unless(open(DATA, $fn)) { print "

Couldn't open database: $fn

\n"; exit; } @data = ; close(DATA); if(($xcountry ne "") && ($xcountry ne "GL") && ($xcountry ne "IS")) { @data = (); if(open(EURODATA, $eufn)) { while () { $s = $_; chop ($s) if ($s =~ /\n$/); # NL chop ($s) if ($s =~ /\r$/); # CR # Perm ID System Status Function Manning Unit Location Country Call Sign Early Equipment Equip 72 Operational Date Inactivation Date next if(&trim($s) eq ""); ($permid, $system, $status, $function, $manning, $unit, $location, $country, $callsign, $early, $equip72, $opdate, $inact, $notes) = split(/\t/, $s); $location =~ tr/?//d; if($unit eq "") { $x = ""; }else{ $x = "$unit, "; } if((&trim($location) ne "") && (&trim($country) ne "")) { $location = "$x$location, $country"; }elsif((&trim($location) eq "") && (&trim($country) ne "")) { $location = "$x$country"; }else { $location = "  "; } next if($permid eq "Perm ID"); # "PermID" "SAGE" "JSS" "Site Type" "Location" "State" "Squadron" "Equipment (early)" "Equipment (June 72)" "Operational Date" "Inactivation Date" "Comments" $x = $permid . "\t\t\t" . $system . "\t" . $location . "\t" . $country . "\t" . $unit . "\t" . $early . "\t" . $equip72 . "\t" . $opdate . "\t" . $inact . "\t" . $notes . "\t" . $callsign; push @data, $x; } } } print "

Information for $site

\n"; if(index($data[0],"PermID") > -1) { shift(@$data); } $n = @data; @sites = (); foreach $r (@data) { if($rec > 0) { $r = $data[$rec - 1]; } chop ($r) if ($r =~ /\n$/); # NL chop ($r) if ($r =~ /\r$/); # CR $r =~ tr/\"//d; #"PermID" "SAGE" "JSS" "Site Type" "Location" "State" "Squadron" "Equipment (early)" "Equipment (June 72)" "Operational Date ""Inactivation Date" "Comments" "Call Sign" "Latitude" "Longitude" "Current Use" ($permid, $sage,$jss, $stype, $city, $state, $sqdn, $equip1,$equip2,$opdate,$inact,$comments, $callsign, $latitude, $longitude, $current, $hidden) = split(/\t/,$r); # next if ($noactive && (&trim($hidden) ne "")); $xcity = $city; $xcity =~ tr/+//d; $xcity = &trim($xcity); $key = $city; $key =~ tr/\,//d; $key =~ tr/\'//d; # compress out ' single-quotes $key =~ tr/+//d; $key =~ tr/*//d; $key =~ tr/\#//d; $key =~ tr/\(//d; $key =~ tr/\)//d; $key =~ tr/\.//d; $key =~ tr/ //d; # Compress out blanks. if($rec > 0) { push @sites, $r; $site{$okey} = $r; last; } if(index($xcity, $site) > -1) { push @sites, $r; $site{$okey} = $r; last; } } $n = @sites; unless ($noactive && (&trim($hidden) ne "")) { print "

Latitude: $latitude N, Longitude: $longitude W

\n" if(&trim($latitude) ne ""); } print "

Call Sign(s): $callsign

\n" if(&trim($callsign) ne ""); if ($stype ne "GFA") { print "
\n"; $sp=index($city," AFS"); $town=substr($city,0,$sp+1); if($town ne "") { $sp=index($town,","); $town=substr($town,0,$sp); $town =~ tr/ /_/; print "\n"; print "

(If the town can't be found in weather database, you\'ll see \"ERROR\")

\n"; print ""; $img="\"Click
\n"; print "
\n"; print $img; print "

[Click for forecast]

\n"; } print "
\n"; } print "
\n"; $notes_width = 150; print "
\n"; print "\n"; print "\n"; &formhdr("Perm.
ID
", "CENTER"); &formhdr("SAGE
ID
", "CENTER"); &formhdr("JSS
ID
", "CENTER"); &formhdr("Unit\n", "CENTER"); &formhdr("Location", "CENTER"); &formhdr("Early
Equip.
", "CENTER"); &formhdr("Final
Equip.
", "CENTER"); &formhdr("Oper.
Date
", "CENTER"); &formhdr("Inact.
Date
", "CENTER"); &formhdr("Notes", "CENTER", $notes_width); print "\n"; $pid = ""; foreach $r (@sites) { $i = 0; chop ($r) if ($r =~ /\n$/); # NL chop ($r) if ($r =~ /\r$/); # CR $r =~ tr/\"//d; #"PermID" "SAGE" "JSS" "Site Type" "Location" "State" "Squadron" "Equipment (early)" "Equipment (June 72)" "Operational Date" "Inactivation Date" "Comments" ($permid, $sage,$jss, $stype, $city, $state, $sqdn, $equip1,$equip2,$opdate,$inact,$comments, $callsign) = split(/\t/,$r); $city =~ tr/+//d; $key = $city; $key =~ tr/ //d; $key =~ tr/,//d; $key =~ tr/*//d; $pid = $permid if(($pid eq "") && ($permid ne "")); print "\n"; &formcol($permid,"CENTER"); &formcol($sage,"CENTER"); &formcol($jss,"CENTER"); $sqdn = " " if($sqdn eq ""); &formcol($sqdn,"CENTER"); $z = "" . $city . ""; &formcol($city); &formcol($equip1); &formcol($equip2); # $p = index($inact, "0:00:00"); # $inact = substr($inact, 0, $p); &formcol($opdate, "CENTER"); &formcol($inact, "CENTER"); &formcol($comments,,$notes_width); print "\n"; } %id = (); # Gap-fillers foreach $r (@data) { $i = 0; chop ($r) if ($r =~ /\n$/); # NL chop ($r) if ($r =~ /\r$/); # CR $r =~ tr/\"//d; #"PermID" "SAGE" "JSS" " Type" "Location" "State" "Squadron" "Equipment (early)" "Equipment (June 72)" "Operational Date" "Inactivation Date" "Comments" ($gfpermid, $gfsage,$gfjss, $gfstype, $gfcity, $gfstate, $gfsqdn, $gfequip1,$gfequip2,$gfopdate,$gfinact,$gfcomments, $gfcallsign) = split(/\t/,$r); next if(&trim($gfstype) ne "GFA"); $pid = &trim($pid); @l = split(/\//, $gfpermid); foreach $x (sort @l) { $x = &trim($x); if(length($pid) == length($x) - 1) { if(substr($x, 0, length($pid)) eq $pid) { $id{$x} = $r; } } } } foreach $k (sort keys %id) { $r = $id{$k}; #"Site Name" "State" "Site Designator(s)" "Comments" # ($loc, $state, $desig, $notes) = split(/\t/,$r); #"PermID" "SAGE" "JSS" "Site Type" "Location" "State" "Squadron" "Equipment (early)" "Equipment (June 72)" "Operational Date" "Inactivation Date" "Comments" ($gfpermid, $gfsage,$gfjss, $gfstype, $gfcity, $gfstate, $gfsqdn, $gfequip1,$gfequip2,$gfopdate,$gfinact,$gfcomments, $gfcallsign) = split(/\t/,$r); print "\n"; &formcol($gfpermid, "CENTER"); &formcol(" "); #SAGE &formcol(" "); #JSS &formcol(" "); #Sqdn $z = "" . $gfcity . ""; &formcol($z); # &formcol($gfcity); &formcol("$gfequip1"); #equip1 &formcol(" "); #equip2 &formcol("$gfopdate"); #Op date &formcol("$gfinact"); #inact if($gfcomments ne "") { $notes = "Gap Filler; " . $gfcomments; }else{ $notes = "Gap Filler"; } &formcol($notes,,$notes_width); print "\n"; } #} print "
\n"; print "

\n"; print "Current Use: - $current

\n" if(&trim($current) ne ""); print "

\n"; print "
\n"; print "NOTICE:
\n"; print "Some photos and documents may be marked with varying degrees of classification,\n"; print "up to SECRET. Data so marked is the way it was delivered from official USAF sources,\n"; print "and have been completely declassified. To the best of our knowledge, no\n"; print "currently classified data is stored on this site.
\n"; print "The following is available:\n"; print "
    \n"; $needsul = 1; # $site = $city; $site =~ tr/ /+/; $historysite = $site; $historyfile = join("/", $historydir, $srchkey . ".txt"); print "History File: $historyfile
    \n" if($debug); print "
  • Site Roster\n"; if(substr($srchkey, 0, 10) eq "TexasTower") { print "
  • Texas Tower Page\n"; } unless(($pic eq "") && ($doc eq "") && ($www eq "")) { if($pic ne "") { # print "
  • Photographs\n"; print "
  • Photographs\n"; } if($doc ne "") { # print "
  • Documents\n"; print "
  • Documents\n"; } if($www ne "") { $www = &trim($www); $fn = join("/", $htmlroot, "webpages"); $fn = join("/", $fn, $www); if(open(WEB, $fn)) { $s = ; close(WWW); print "
  • Web Site\n"; }else{ print "Couldn\'t open $fn
    \n"; } } } $fn = join("/", $recentdir, "$srchkey\.html"); if(-e $fn) { print "
      \n" unless($needsul); $needsul = 1; print "
    • Recent photos\n"; } $fn = join("/", $mapdir, "$srchkey\.jpg"); unless ($noactive && (&trim($hidden) ne "")) { if(-e $fn) { print "
        \n" unless($needsul); $needsul = 1; print "
      • Map\n"; } } unless ($noactive && (&trim($hidden) ne "")) { foreach $w (@terra) { chop ($w) if ($w =~ /\n$/); # NL chop ($w) if ($w =~ /\r$/); # CR ($site, $loc, $image, $type, $notes, $terramain, $terracantonment, $terrahousing, $terralgatr, $terrargatr, $topomain, $topocantonment, $topohousing, $topolgatr, $toporgatr) = split(/\t/, $w); $terramain = &trim($terramain); $terracantonment = &trim($terracantonment); $terrahousing = &trim($terrahousing); $terralgatr = &trim($terralgatr); $terrargatr = &trim($terrargatr); $topomain = &trim($topomain); $topocantonment = &trim($topocantonment); $topohousing = &trim($topohousing); $topolgatr = &trim($topolgatr); $toporgatr = &trim($toporgatr); $loc = &noquotes($loc); $loc =~ tr/\,//d; $loc =~ tr/\'//d; # compress out ' single-quotes $loc =~ tr/+//d; $loc =~ tr/*//d; $loc =~ tr/\(//d; $loc =~ tr/\)//d; $loc =~ tr/\.//d; $loc =~ tr/ //d; # Compress out blanks. if(&ucase($loc) eq &ucase($srchkey)) { if(substr($terramain, 0, 7) eq "http://") { print "
\n"; if(opendir(SHIELD, $badges)) { @files = grep !/^\.\.?$/, readdir(SHIELD); closedir(SHIELD); } $n = 0; $q = @files; foreach $f (@files) { if($f =~ /$srchkey/i) { $n++; $fn = join("/", "$hrefhtml/shields", $f); print "
\n"; } } if($n == 0) { # print "\n"; print "

Emblem needed for this site

\n" if($stype ne "GFA"); print "
\n"; } print "

\n"; print "

\n"; print "
\n"; print "

Return to Search Page

\n"; print "
\n"; print "

\n"; exit; sub formhdr { local($s) = &trim($_[0]); local($al) = $_[1]; local($w) = $_[2]; $w = " width=$w" if($w ne ""); if($al ne "") { $al = " ALIGN=$al"; } $s = " " if ($s eq ""); print "$s\n"; } sub formcol { local($s) = &trim($_[0]); local($al) = $_[1]; local($w) = $_[2]; $w = " width=$w" if($w ne ""); if($al ne "") { $al = " ALIGN=$al"; } $s = " " if ($s eq ""); print "$s\n"; }