#!/usr/bin/perl # Author : bobf http://frenock.net # Date : 06 April 2005 # unshift (@INC, "_CGI-BIN"); unshift (@INC, "_MAIL"); require "cgi-lib.pl" ; require "addCss.pl" ; require "emailCheck.pl" ; require "basicSendmail.pl" ; &ReadParse(*input); print &PrintHeader; $sendingPage = $ENV{'HTTP_REFERER'} ; $templateStartPath = "CONTENT/templateStart.dat" ; $templateEndPath = "CONTENT/templateEnd.dat" ; if($input{func} eq "contact"){ &contact ; } if(! $input{p}){ $input{p} = "home" ; } $path = "CONTENT/" . $input{p} . ".dat" ; unless (open (CONTENT, "<$path")){ $msg = "Unable to open content file ($path) for reading (line# 83)."; &pageError($msg) ; } @content = ; close (CONTENT); &templateStart ; &addCss ; if($content[0] =~ /imgDisplay/){ ($null,$input{dir},$null) = split(/\|/,$content[0]) ; # ---- START CONTENT ---- &getPicListing ; # Get pics from user input dir, excluding files that begin with _tn ... &picPageSettings ; # Get variables from $input{dir}/picPageSettings into assoc array $setting{} ... # headerText (like "CDC - Alder Hill Project" -- printed both thumb and indiv pages), # footerText (like "Alder Hill Project" -- only printed if individual pic) # and picture descriptions (not invoked yet) ... &print_pContent ; # if a particular pic input, get it and display it ... &dispThumbsOrOnePic ; # if(! $input{pic}, disp thumbnail page, else display one pic with prev and next links ... if(! $input{pic} ){&printPicPageEnd } # Prints spacer and $setting{footerText} ... # ---- END CONTENT ---- }else{ &printContent ; } &templateEnd ; exit ; sub printContent{ undef $twoColumns ; undef $columnOne ; undef $columnTwo ; undef $colOneOutput ; undef $colTwoOutput ; undef $output ; foreach $line (@content){ if($line =~ /columnone/i ){ $columnOne = 1 ; }elsif($line =~ /columntwo/i ){ $columnTwo = 1 ; }elsif($columnOne && ! $columnTwo){ $colOneOutput .= $line ; }elsif($columnOne && $columnTwo){ $colTwoOutput .= $line ; }else{ $output .= $line ; } } # END of foreach $line (@content){ if($columnOne && $columnTwo){ $output = qq~
$colOneOutput
$colTwoOutput
~ ; } # END of if($columnOne && $columnTwo){ print $output ; } # END of sub printContent{ sub printTemplateEnd{ foreach $line (@templateEnd){ print $line ; } &housingSummitReport ; } sub housingSummitReport{ if($input{p} eq "housingSummit"){ $path = "REGISTER/registrations.DB" ; unless (open (REG, "<$path")){ print"Cant open DB

"; exit; } @regs = ; close (REG); foreach $line (@regs){ $count++ ; @rec = split(/\|/,$line) ; #Yes|HomeOwnership|None|Yes if($rec[12] eq "Yes"){ $lunch++} if($rec[15] eq "Yes"){ $evening++} if($rec[13] eq "Homeless"){ $mHome++} if($rec[14] eq "Homeless"){ $aHome++} if($rec[13] eq "Special Needs / Transitional"){ $mSpecial++} if($rec[14] eq "Special Needs / Transitional"){ $aSpecial++} if($rec[13] eq "Multi-Family / Subsidized"){ $mMulti++} if($rec[14] eq "Multi-Family / Subsidized"){ $aMulti++} if($rec[13] eq "Home Ownership"){ $mHome++} if($rec[14] eq "Home Ownership"){ $aHome++} } print"

 

($count:$lunch,$evening.morn:$mHomeless,$mSpecial,$mMulti,$mHome.after:$aHomeless,$aSpecial,$aMulti,$aHome)

 

"; } } sub contact{ if($input{origEmail}){ if(! &emailCheck($input{origEmail})){ # returns 0 (failed) or 1 (passed) $msg = "You have entered an invalid email address. Please back up and correct your entry" ; &pageError($msg) ; } } $input{orig} =~ s/[^a-zA-Z0-9 \.']//g ; $input{body} =~ s/[`\\]//g ; $input{body} =~ s/\n/

/g ; $input{sendingPage} =~ s/[^a-zA-Z0-9 \.',:;?\n\t\$#@\/]//g ; $input{textColor} =~ s/[a-zA-Z0-9#]//g ; $subject = "Lincolncdc.org Contact Form Response" ; $scriptFromAddress = "website\@lincolncdc.org" ; $toRecipients = "support\@lincolncdc.org, Debra\@lincolncdc.org" ; # support@lincolncdc.org, Debra\@lincolncdc.org $bccRecipients = "2005\@frenock.com, bob.fren\@frenock.com" ; $mailFormat = "100" ; $pageHTML = qq~

 

Sender's Name: $input{orig} Sender's Email: $input{origEmail} Referring Page: $input{sendingPage}

 

Message:

$input{body}

~ ; $success = &basicSendmail ; if(! $success){ $input{p} = "contactResponse" ; }else{ print"\$success = :$success:

"; $input{p} = "poorContactResponse" ; } } sub pageError{ if(! $templateStart && ! $templateStartError){ &templateStart ; } my $msg = shift ; print qq~

 

\n

\n

 

$msg

 

~ ; if(! $templateEndError){ &templateEnd ; } exit ; } #_________________________________________________________________________________________________________________________ sub templateStart{ if(! $templateStart){ unless (open (TEMPLATE, "<$templateStartPath")){ $msg = "Unable to open \$templateStartPath ($templateStartPath) for reading (line# 2093).

"; $templateStartError = 1 ; &pageError($msg) ; } @templateStart =