// web page emailer
$homepage = "/";
$hometext = "Back to CRAB Radio Rock and Blues";
#$background = "/dfd/data/bg_grid.gif";
$bgcolor = "#eeffff";
//ENGLISH
$langAdminError = "Administrator Error";
// $langBsGuestbook = "Contact CRAB Radio";
$langBsEmail = "Contact CRAB Radio";
$langEmail = "E-mail :";
$langGbAdmin = "Administration";
$langMessage = "* Message :";
$langName = "* Name :";
$langOpenError = "Error opening file !
Be sure writing is allowed in this directory.";
$langSubmit = "Send your message";
$langSystemError = "System Error";
$langSystemMessage = "System Message";
// carbonCopy = 1 enables mail sending to mailRecipient.
// mailRecipient receives a mail each times an entry is entered (if carbonCopy = 1)
// mailSubject is the subject of the mail which is sent.
$carbonCopy = 1;
$mailRecipient = "cap";
$mailSubject = "CRAB Radio Web Mail";
/********************************
* Configuration Step 3 : Colors *
********************************/
// Choosing colors (Remove the unwanted color-model)
// Standard (Greys, bright background)
$colorWhite = "#FFFFFF";
$colorBlack = "#000000";
$colorHeads = "#555555";
$colorBody1 = "#FFFFFF";
$colorBody2 = "#EEEEEE";
// Data submission form colors
$formHeadColor = $colorHeads;
$formBodyColor = $colorBody1;
$formTailColor = $colorBody2;
$formHeadText = $colorWhite;
$formBodyText = $colorBlack;
$formThColor = "#000066";
// Guestbook entries colors
$entryHeadColor = $colorHeads;
$entryBodyColor1 = $colorBody2;
$entryBodyColor2 = $colorBody1;
$entryHeadText = "#ffff00";
$entryBodyText1 = $colorBlack;
$entryBodyText2 = $colorHeads;
// Messages colors
$adminHeadColor = $colorHeads;
$adminHeadText = $colorWhite;
$adminBodyColor1 = $colorBody2;
$adminBodyText1 = $colorBlack;
$adminBodyColor2 = $colorBody1;
$adminBodyText2 = $colorHeads;
/********************************
* Configuration Step 4 : Header *
********************************/
function displayHeader()
{
global $langBsEmail, $bgcolor, $background;
header ("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
// echo ("\n");
// You migh use and include instead of all this :
// include ("head.inc");
echo ("\n");
echo ("
$hometxt\n");
}
//******************************************************************************
// function displayMessage displays the $errorMessage error message.
function displayMessage($errorMessage,$msgType)
{
global $adminHeadColor;
global $adminHeadText;
global $adminBodyColor1;
global $adminBodyText1;
global $adminBodyColor2;
global $adminBodyText2;
global $langAdminError;
global $langSystemError;
global $langSystemMessage;
global $langBsEmail;
displayHeader();
echo ("
");
echo ("");
echo (" $langBsEmail ");
echo (" | | ");
if ($msgType=="1") // Admin Message
echo (" $langAdminError");
if ($msgType=="2") // System Error
echo (" $langSystemError");
if ($msgType=="3") // System Message
echo (" $langSystemMessage");
echo ("");
echo (" | ");
echo ("");
echo (" $errorMessage
");
echo (" |
\n");
echo (" |
");
displayFooter();
exit;
}
//******************************************************************************
// function standardizeText filters ambiguous chains in $str
function standardizeStoredText($str)
{
$str = str_replace("\\'", "'", $str);
$str = str_replace("\\\"", "\"", $str);
$str = htmlspecialchars($str);
$str = str_replace("\n", "
", $str);
$str = str_replace("$", "$", $str);
return $str;
}
function standardizeDisplayedText($str)
{
return $str;
}
function standardizeAdminText($str)
{
return $str;
}
function seekHttp($rawText)
{
$pattern = array(
"/http:\/\/((\w|\.|\?|\%|=|\/|-)*)/",
"/mailto:((\w|\.|@|-)*)/");
$replacement = array(
"
http://\\1",
"
\\1");
$hyperLinkedText=preg_replace($pattern, $replacement, $rawText);
return $hyperLinkedText;
}
//******************************************************************************
// function Xfopen : opens a file $fileName and locks it
function Xfopen($fileName, $openMode, $sharing)
{
global $langOpenError;
$fp=@fopen($fileName, $openMode);
if (!$fp)
{
displayMessage($langOpenError,2);
}
if ($sharing==true)
{
$op=1;
}
else
{
$op=2;
}
if (!@flock($fp,$op))
{
@flock($fp,3);
displayMessage("
flock timeout",2);
}
return $fp;
}
//******************************************************************************
// function Xfclose : unlocks the file $fp and closes it
function Xfclose($fp)
{
@flock($fp,3);
@fclose($fp);
}
//******************************************************************************
// function fullDisplay
function fullDisplay() {
global $displayStep,$displayBegin ;
global $entryHeadColor,$entryHeadText, $entryBodyColor1,$entryBodyText1, $entryBodyColor2,$entryBodyText2 ;
global $relativeScriptPath;
global $index;
global $archive_mail, $archive_name, $archive_text, $archive_date;
global $allowAutoLink;
global $bgcolor, $background;
displayHeader();
// Displays the entry form to enable the client to type a message.
displayForm();
displayFooter();
return;
}
//******************************************************************************
if (!isset($name)) { $name=""; $message=""; }
if ($name=="" || $message=="") {
/****************************************************************************************
* Use Case no 1-A *
* *
* This case is encountered when a client simply wants to add a message to the *
* guestbook. (Every variable is empty); *
************************************************************************************/
fullDisplay();
exit;
}
else {
/********************************************************************************
* Use Case no 1-B *
* *
* Case is encountered when a client has just filled in the appropriate fields *
* (name, mail, message). *
* $name = "Some Name" *
* $email = "Some@Email" *
* $message = "Some Message" *
* Simply add message in the top of all previous messages. *
********************************************************************************/
// Sending a mail to $mailRecipient with the subject $mailSubject.
$message = str_replace("
", "\n", $message);
$mailBody = "From: $name <$email>\n$insert_msgdate\n\n$message";
mail($mailRecipient,$mailSubject,$mailBody,"From: $email\nReply-to: $name <$email>");
if (strpos($HTTP_REFERER, "?")==false) $page=$HTTP_REFERER;
else $page=substr($HTTP_REFERER, 0, strpos($HTTP_REFERER, "?"));
//header("Location: $page?");
//displayHeader();
echo ("\n");
echo ("
$langBsEmail ");
echo ("
\n");
echo ("\n");
echo ("
Your Message Has Been Sent");
echo ("
$hometext
");
displayFooter();
exit;
}
?>