/****************************************************
This is the main page that displays the form.
All functions related to the form are included
from this form eventually.
*****************************************************/
require_once('conf.php');//get configs
require_once('httppost.php'); //get method to post to ASP
require '../libs/Smarty.class.php';
include('../configs/config.db.inc.php');
include('../configs/config.var.inc.php');
require ("../lang/lang_$language.php");
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->template_dir="../templates";
$smarty->compile_dir = '../templates_c';
$smarty->config_dir = '../configs';
$smarty->assign("toptext","By taking a moment to register below you will have access to nursing jobs of all varieties across the United States and you'll get access to the nursing jobs boards that can best serve your nursing career needs. We have partnered with the leading hospitals, travel nurse companies and recruitment agencies, so fill out the form below and get on your way to your dream job!");
$smarty->assign("a2kTemplate",$a2kTemplate);
$smarty->assign("FilePath",$FilePath);
$smarty->assign("RootUrl",$RootUrl);
$smarty->assign("L",$L);
// This file parses `prof.xml` to get profession javascripts
$headtext = file_get_contents(PHP_WORKING_DIR."/jsfunctions.php");
$headtext .="
";
// This file contains a bunch of functions for PHP error checking of form
include('informer.php');
// If we have posted values, lets error check them.
// Otherwise, set the showsection variable, which deciced which
// portion of the form to display if paginating is used.
// This variable is ignored if not paginating form.
if(!empty($_POST))
checkForm();
else
{
$showsection = ORDER_FIRST;
if(SET_FOCUS)
$onLoadString = SET_FOCUS_ELEMENT;
}
$headtext .="
";
// This file parses cform.xml to create the form html. This is all stored
// into the variable $formdata
include('cform.php');
// Everything read from a file is interpreted as literal text, so
// we need to eval the string to convert variables into their
// actual values.
eval("\$formdata = \"$formdata\";");
// Echo out form. Here we could assign this variable to smarty if needed.
//echo $formdata;
$smarty->assign("RegForm",$formdata);
$smarty->assign("headtext",$headtext);
$temp_name= "$a2kTemplate" . "/form.tpl";
$smarty->display($temp_name);
/*=========================================*/
//=\\=//=\\=//=|| FUNCTIONS ||=//=\\=//=\\=//
/*=========================================*/
function checkForm()
{//this function calls the XML parser to do form error checking, then handles errors.
global $expertiseOptionNumber,$has_errors,$showsection,$onLoadString,$updateForm,$smarty,$a2kTemplate,$headtext;
$headtext .="";
}
function errorstartFormElement($parser, $name, $attr)
{//This function is triggered when XML parser finds an element opening
global $inSection,$inElement,$errorCheckString;
switch($name)
{
case 'SECTION':
$inSection++;//holds which section we currently are in
break;
case 'CHECK':
$errorCheckString .="$attr[FUNC](";//starts PHP function call
break;
}
$inElement[] = $name;//Stack of which element we are in
}
function errorendFormElement($parser, $name)
{//This function is triggered when XML parser finds an element closing
global $inSection,$inElement,$errorCheckString,$errorCSS,$has_errors,$showsection,$onLoadString,$headtext;
array_pop($inElement);//Manage element Stack
switch($name)
{
case 'CHECK':
$errorCheckString = substr($errorCheckString,0,-1);
$errorCheckString .=")";
if(!(DISPLAY_PAGINATED && $inSection != $showsection))
{//as long as we aren't both paginated and in a section
//the user didn't see, execute the PHP error function
eval("\$result = $errorCheckString;");
if(!$result)
{//if function returns false, display error
$headtext.= "#".$errorCSS."_error{display:block;}\n";
if(!$has_errors)
$onLoadString = $errorCSS;
$has_errors = 1;
}
}
unset($GLOBALS['errorCheckString']);
break;
}
}
function errorFormcharacterData($parser, $data)
{//This function is triggered when XML parser finds character data(non attribute/element text)
global $inSection,$inElement,$errorCheckString,$errorCSS;
$lastElement = $inElement[count($inElement)-1];
if($lastElement=='IDARG')
$errorCheckString .='$_POST['.$data.'],';
if($lastElement=='ARG')
$errorCheckString .="$data,";
if($lastElement=='ERRORID')
$errorCSS = $data;
}
function sendmail()
{
$htmlemail = CONF_MAIL_HTMLTEXT;
eval("\$htmlemail = \"$htmlemail\";");
$textemail = CONF_MAIL_CLEARTEXT;
eval("\$textemail = \"$textemail\";");
$mailsubject = CONF_MAIL_SUBJECT;
eval("\$mailsubject = \"$mailsubject\";");
if(MAIL_HTML)
{
//add From: header
$headers = "From: ".CONF_MAIL_FROM."\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("ANREG");
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\r\n\r\n";
//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
//plain text version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($textemail));
//HTML version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($htmlemail));
//send message
mail($_POST['email'], $mailsubject, "", $headers);
}
else
{
//add From: header
$headers = "From: ".CONF_MAIL_FROM."\r\n";
//send message
mail($_POST['email'], $mailsubject, $textemail, $headers);
}
}
?>