#!/usr/local/bin/perl $dot = "../../.."; require("$dot/.BIN/lib/general_subroutine.lib"); require("$dot/.BIN/lib/members_subroutine.lib"); require("$dot/.BIN/setup/core_setup.lib"); require("$dot/.BIN/setup/members_setup.lib"); require("$dot/ssi/public/top_bottom.lib"); require("$dot/ssi/public/html_functions.lib"); require("./fetch_attr.lib"); require("./error.lib"); $method = $ENV{'REQUEST_METHOD'}; &parseCGI($method,*Form); &printHeader(); ########################################################################### $Time = $Form{'Time'}; &removeXtraChars(*Time); $memberId = $Form{'memberId'}; &removeXtraChars(*memberId); $senderName = $Form{'senderName'}; &removeXtraChars(*senderName); $senderEmail = $Form{'senderEmail'}; &removeXtraChars(*senderEmail); $MailSendFlag = $Form{'MailSendFlag'}; &removeXtraChars(*MailSendFlag); $sendMsg = $Form{'sendMsg'}; $sendMsg4NextPage = $sendMsg; &replaceHtMLChars(*sendMsg4NextPage); #$sendMsgDisp = &processMsg2Disp($sendMsg,"50"); $sendMsgDisp = $sendMsg; $sendMsgDisp =~ s/([\n]+)/
/g; ######### Validation of message ########################################## if(!$memberId){ $title = "Member's Id is missing"; $heading = $title; $messge = "Go back to the previous page to correct the problem"; #print "$message"; &userError($title,$heading,$message); exit; } if (!$senderName ){ $title = "Sender Name is Missing!"; $heading = $title; $message = "Go back to the previous page to enter the sender name."; &userError($title,$heading,$message); exit; } $emailFlag = &emailChecker($senderEmail); #print "
$emailFlag
"; if ($emailFlag eq "bad"){ if($senderEmail eq ""){$senderEmail = "Nothing entered!";} $title = "Sender E-mail failed during validation!"; $heading = $title; $message = "Go back to the previous page to correct your email address"; $message .= "

Entered E-mail address:"; $message .= "$senderEmail"; &userError($title,$heading,$message); exit; } &removeXtraChars(*sendMsg); if (!$sendMsg){ $title = "Send Message is Missing!"; $heading = $title; $message = "Go back to the previous page to enter the email message."; &userError($title,$heading,$message); exit; } #---------- Parse data from CGI HIDDEN Data ------------------------------- $memberId = $Form{'memberId'}; &removeXtraChars(*memberId); $profession = $Form{'profession'}; &removeXtraChars(*profession); $nameLast = $Form{'nameLast'}; &removeXtraChars(*nameLast); $nameFirst = $Form{'nameFirst'}; &removeXtraChars(*nameFirst); $nameMiddle = $Form{'nameMiddle'}; &removeXtraChars(*nameMiddle); $credentials = $Form{'credentials'}; &removeXtraChars(*credentials); $curSpeciality = $Form{'curSpeciality'}; &removeXtraChars(*curSpeciality); $emailPref = $Form{'emailPref'}; &removeXtraChars(*emailPref); $emailOther = $Form{'emailOther'}; &removeXtraChars(*emailOther); $addrCity = $Form{'addrCity'}; &removeXtraChars(*addrCity); $addrProv = $Form{'addrProv'}; &removeXtraChars(*addrProv); $addrCountry = $Form{'addrCountry'}; &removeXtraChars(*addrCountry); $memTitle = $Form{'memTitle'}; &removeXtraChars(*memTitle); $statEmailPref = $Form{'statEmailPref'}; &removeXtraChars(*statEmailPref); $statEmailOther = $Form{'statEmailOther'}; &removeXtraChars(*statEmailOther); #-------------------------------------------------------------------------- #Construct the mail flag################################# $mailflag = $Form{'mailflag'}; &removeXtraChars(*mailflag); $mailflag_pref = $Form{'mailflag_pref'}; &removeXtraChars(*mailflag_pref); $mailflag_other = $Form{'mailflag_other'}; &removeXtraChars(*mailflag_other); #$x0 = "siva"; $xx0 = length($x0); #$x1 = "a"; $xx1 = length($x1); #print "
$xx0/$xx1
"; #print "
$mailflag/$mailflag_pref/$mailflag_other
"; # 00 00 # 01 00 # 10 00 # 11 00 Pref only # 00 01 # 01 01 # 10 01 # 11 01 Pref only # 00 10 # 01 10 # 10 10 # 11 10 Pref only # 00 11 Alt only # 01 11 Alt only # 10 11 Alt only # 11 11 Both. ######################################################### if($mailflag_pref eq "11" || $mailflag_other eq "11") { if($mailflag_pref eq "11"){$emailPref = "Available/Active";} else{$emailPref = "Not Available";} if($mailflag_other eq "11"){$emailOther= "Available/Active";} else{$emailOther = "Not Available";} $curSpecialtyDisp = $SPECIALTY{$curSpecialty}; $professionDisp = $PROFESSION{$profession}; $descriptionDisp = $description; &processQuote(*descriptionDisp,"0"); # Build Name .... $nameMem = $memTitle.". "; $nameMem .= $nameFirst." "; if($nameMiddle){$nameMem .= $nameMiddle." ";} $nameMem .= $nameLast; # Build Location.... $location = $addrCity; if($addrProv){$location .= ", ".$addrProv;} $location .= ", ".$addrCountry; #print "
"; $title = "Preview the mail to ".$nameMem; $heading = $title; &top("","",3,"00","10","01","99","99","99",$title,$heading); print $topPublic; print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ if(($profession eq "P01" || $profession eq "P02") && $curSpecialtyDisp ne ""){ print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ } print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ print " "; if($mailflag_pref eq "11" && $mailflag_other ne "11") { print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ } elsif($mailflag_pref ne "11" && $mailflag_other eq "11") { print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ } elsif($mailflag_pref eq "11" && $mailflag_other eq "11") { print <<___HtmlCodeEnd___; ___HtmlCodeEnd___ } print <<___HtmlCodeEnd___;
Send To:

Name: 

$nameMem
Credentials:  $credentials
Profession:  $professionDisp
Specialty:  $curSpecialtyDisp
Location  $location
Member Id:  $memberId


Preferred Email: 


$emailPref
Alternate Email:  $emailOther
Note: Mail will be sent to the Preferred Email address only.
 
Note: Mail will be sent to the Alternate Email address only.
 
Note: Both Preferred and Alternate email addresses are available. ___HtmlCodeEnd___ if($MailSendFlag eq "Yes"){ print "
>> You have selected to send your e-mail message to both addresses!"; } if($MailSendFlag eq "No"){ print "
> You have selected to send your e-mail message only to
> the Preferred Email address!"; } print <<___HtmlCodeEnd___;
 
 
Send From:
Your Name:  $senderName
Your E-mail:  $senderEmail

Composed mail message to $nameMem:
$sendMsgDisp



Note:
1. If you are satisfied with the email message, please press the SEND MAIL button to send your email message to $nameMem.

2. If you would like to edit your mail, please press <= Back button from the browser menu. (This can be accessed mostly by pressing right mouse button in the client window area.)

___HtmlCodeEnd___ print $bottomPublic; &bottom("","",3,"00","10","01","99","99","99",$title,$heading); } #end-if(email address valid) else{ #if invalid email address # Build Name .... $nameMem = $memTitle.". "; $nameMem .= $nameFirst." "; if($nameMiddle){$nameMem .= $nameMiddle." ";} $nameMem .= $nameLast; $title = "$nameMem does not have a valid e-mail address"; $heading = "No valid email address"; &top("","",3,"00","10","01","99","99","99",$title,$heading); print $topPublic; print <<___HtmlCodeEnd___;
$nameMem does not have a valid e-mail address

Click here to go back to information page of $nameMem.

-OR-

Click here to go to the current online member list.

-OR-

Click here to contact MIFT.

___HtmlCodeEnd___ print $bottomPublic; &bottom("","",3,"00","10","01","99","99","99",$title,$heading); exit; } ########################################## sub processMsg2Disp{ local($msg,$length) = @_; local($line, $lengthLine, $Msg2Disp,@singleLineArray,@singleCharArray,$linecount,$i, $j); $Msg2Disp = ""; @singleLineArray = split(/\n/,$msg); foreach $line (@singleLineArray){ $lengthLine = length($line); print "
$line -- $lengthLine"; if($lengthLine == 0){ $Msg2Disp .= " >Para\!
\n"; } # end if a paragraph else{ $siva = 0; print "
"; @singleCharArray = split(//,$line); for($j=0; $j < $lengthLine; $j++){ for($i=0; $i <= $length; $i++){ #print "<$singleCharArray[$j]>"; $sivaindex = $i + $siva * $length; print "$length/$j/$i/$siva/$sivaindex/$singleCharArray[$sivaindex]
"; $Msg2Disp .= $singleCharArray[$sivaindex]; if($i > $lengthLine){$i = $length + 1;} } $siva++; $Msg2Disp .= " >Ins\!
\n"; } } # end if not a paragraph $Msg2Disp .= " >Usr\!
\n"; } #end foreach line $Msg2Disp; } #end function exit; if ($emailFlag eq "bad"){ &senderEmailError($senderEmail); } if (!$sendMsg){ print "User Error - No Message\n"; print "\n"; print "

User Error - No Message


"; print "
  • You did not enter any Message
  • Please go back to the previous level and
    enter your message..."; exit; } $sendMsg = &Split($sendMsg); $Msg2Send = &ReplaceXtraChars($sendMsg); #&checkMsg($sendMsg,*msglengthcount,"51",*lenthMsgs); &checkMsg($sendMsg,*msglengthcount,"65",*lenthMsgs); if ($msglengthcount > 0){ $word = "They are:"; if($msglengthcount == 1){$times = "Once"; $word = "It is:";} elsif($msglengthcount == 2){$times = "Twice";} else{$times = $msglengthcount." Times";} print "User Error - No Message\n"; print "\n"; print "

    User Error - Message is Lengthy


    "; print "
  • You did not Hit Enter after each line $times  in your Message
  • $word

    $lenthMsgs


  • Please go back to the previous level and
    correct your message..."; exit; } $title = "E-mail Viewer"; $heading = "First-Contact/Quick-mail Viewer (Hartley On-line)"; &top($title,$heading,"600","hr_no","hartleyites"); print "

    Hartley On-line : First-Contact/Quick-mail Viewer

    \n
    \n \n \n \n"; #---------------------------------- $mail = " Following mail was auto-generated by the Hartley On-line E-mail Utility ... _________________________________________ Requested By : ".$senderName." Sender E-mail: ".$senderEmail." Message: ".$sendMsg."\n _________________________________________ Service brought to you by Hartley On-line http://www.HartleyCollege.org/ "; #---------------------------------- open (WR, ">$junk"); print WR $mail; close(WR); print "

    $mail
    

    \n"; print "\n"; print "\n"; print "
    Your Message will be sent to:
    $FIRSTNAME$LASTNAME


    Please Note:

  • If you would like to edit your mail, please press Back button from netscape menu.
    (This can be accessed mostly by pressing right mouse button in the client window area.)
  • "; &bottom(); #########( Subroutines are below here )############################################# sub senderEmailError{ local ($Email)=@_; if($Email eq ""){$Email = "None";} print "User Error E-mail\n"; print "\n"; print "

    User Error (E-mail)


    "; print "
  • The E-mail addresses have to be filled out properly
  • Submitted Email: $Email
  • Please go back to the previous level and
    edit the Your E-mail Field..."; exit; } sub RecEmailError{ local ($num,$rec_num)=@_; print "User Error E-mail\n"; print "\n"; print "

    User Error (E-mail)


    "; print "
  • The E-mail addresses have to be filled out properly\n"; if($rec_num > 1){ print "
  • Please go back to the previous level and Check the Receiver No: $num's E-mail Field...\n"; } else{ print "
  • Please go back to the previous level and Check the Receiver E-mail Field...\n"; } print ""; exit; } sub Split{ local ($msg)=@_; @fstory=split(//,$msg); $msg = &EditXtraChars($msg); $msg; } sub Split_keepthis{ local ($msg)=@_; @fstory=split(//,$msg); $tmp=$#fstory; for($i=0; $i <= $tmp; $i++){ $kkk = $i+2; if(($fstory[$i] eq "\n") && ($fstory[$kkk] eq "\n")) { $fstory[$i]="\n"; $fstory[$kkk]=""; $i=$i+1; } } for($i=0; $i <= $tmp; $i++){ if($fstory[$i] eq "\n"){ $fstory[$i]=""; } } $tmpf_story=""; for($i=0; $i <= $tmp; $i++){ $tmpf_story = $tmpf_story.$fstory[$i]; } $msg = $tmpf_story; $msg = &EditXtraChars($msg); $msg; } sub RmoveXtraChars { local($variable) = @_; $variable =~ s/(["]+)//g; #Gets ride of special characters. $variable =~ s/([>]+)//g; #Gets ride of special characters. $variable =~ s/([<]+)//g; #Gets ride of special characters. $variable =~ s/([\f\r\t\n]+)/ /g; #Gets ride of special characters. $variable =~ s/( *$)//; #Gets rid of extra spaces on end. $variable =~ s/(^ *)//; #Gets rid of extra spaces at the beginning. $variable =~ s/( +)/ /g; #Gets rid of multiple spaces. $return = $variable; $return; } sub EditXtraChars { local($variable) = @_; #$variable =~ s/([\f\r\n]+)/ /g; #Gets ride of special characters. #$variable =~ s/([ ]+)/\n/g; #Gets ride of special characters. $variable =~ s/( *$)//; #Gets rid of extra spaces on end. $variable =~ s/(^ *)//; #Gets rid of extra spaces at the beginning. $variable =~ s/( +)/ /g; #Gets rid of multiple spaces. $variable =~ s/([\t]+)/ /g; #Gets ride of special characters. $return = $variable; $return; } sub ReplaceXtraChars { local($variable) = @_; $variable =~ s/(["]+)/:::/g; #Gets ride of special characters. $variable =~ s/([>]+)/gtgt/g; #Gets ride of special characters. $variable =~ s/([<]+)/ltlt/g; #Gets ride of special characters. $return = $variable; $return; } sub read4Hartleyites{ local($col,$file,$serial) = @_; open(READ,"$file") || die"cannot open $file
    "; @hart_array = ; $num_hartleyites = $#hart_array + 1; close(READ); for ($i=0; $i < $num_hartleyites; $i++){ $serial_db = (split(/<::>/,$hart_array[$i]))[4]; #print "********$serial_db = $serial*******"; if($serial_db eq $serial){ $needed_index = $i; $i = $num_hartleyites; } } $return = $hart_array[$needed_index]; $return; } #endfunction sub checkMsg{ local($msg,*counTer, $length, *lenthMsgs) = @_; local(@array,$linecount); $counTer = 0; $linecount = 0; $lenthMsgs = ""; @array = split(/\n/,$msg); foreach $element (@array){ $linecount++; if(length($element) > $length){ $counTer++; $lenthMsgs = $lenthMsgs."Line ".$linecount.": ".$element."
    "; } } return 1; } #endfunction