An error occured. Please contact the site administrator
Error code: 103
"; } require_once("nof_utils.inc.php"); $nof_rootDir = GetPostVariable('nof_rootDir'); $nof_debug = GetPostVariable('nof_debug'); $nof_componentId = GetPostVariable('nof_componentId'); $nof_scriptDir = GetPostVariable('nof_scriptDir'); $nof_scriptInterfaceFile = GetPostVariable('nof_scriptInterfaceFile'); $cgiDir = ""; $nof_suiteName = "FormsHandler"; $nof_langFile = GetPostVariable('nof_langFile'); if ( !isset($nof_debug) ) $nof_debug = 'true'; if ( !file_exists($nof_langFile) ) { if($nof_debug == 'true') { echo "DEBUGINFO: Some components were left unpublished. Please check your publish settings in Fusion and republish the site.
"; } else { echo "An error occured. Please contact the site administrator
Error code: 103
"; } } $nof_resources->addFile($nof_langFile); if (NOF_fileExists('fh_xmlparser.php')) { require_once('fh_xmlparser.php'); } else { exit(); } //global variables if( GetPostVariable('nof_scriptInterfaceFile')=='' ) { $errorMessage = "Expected POST param not passed: nof_scriptInterfaceFile"; NOF_throwError(800,array("{1}"=>"nof_scriptInterfaceFile")); exit(); } $xmlPropertyFile = GetPostVariable('nof_scriptInterfaceFile'); if(!file_exists($xmlPropertyFile)) { NOF_throwError(620,array("{1}"=>NOF_mapPath($xmlPropertyFile),"{2}"=>NOF_mappath(getcwd()))); exit(); } $conf = ""; $errorField = ""; $errorLabel = ""; $fieldsDBArray = ""; $firstLineUD = ""; $FHCompIdent = "formshandler" . "." . GetPostVariable('nof_componentId') . "."; //include file with common functions. //put this include always after the //global variables cause the functions //need the global variables if (NOF_fileExists('fh_common.php')) { require_once('fh_common.php'); } else { exit(); } //reset the error flag $errorFlag=FALSE; //read the site property file into the $conf array //read contents of forms handler script properties file into the $conf array //read the configuration file for the forms handler script into the $conf array //read the email template into the $conf array //read the XML property file $conf = fhParseXmlFile($xmlPropertyFile); $emailPropertiesFile = 'fh_emailTemplate_'.strtolower($conf[$FHCompIdent.'language']).'.properties'; readEmailTemplate($emailPropertiesFile, "[EMAIL]", $FHCompIdent); if( GetPostVariable('nof_componentId')=='' ) { NOF_throwError(800,array("{1}"=>'nof_componentId')); exit(); } //get column names in the db into a global array getExpectedDBFields($FHCompIdent); //if the required parameters were unfilled if ( fhCheckIfRequiredUnfilled() ) { //display error page fhDisplayErrorPage($errorLabel,$errorField); exit(); } //if fields are not within their length limitations if( fhCheckIfFieldsLengthInvalid() ) { //set error flag to true $errorFlag = TRUE; } //if uploaded files had any errors if( checkIfUploadedFilesInvalid($FHCompIdent) ) { //set error flag to true $errorFlag = TRUE; } //if there was error if( $errorFlag ) { //display the error page fhDisplayErrorPage($errorLabel, $errorField); exit(); } else { //if no errors were encountered in user input //store the uploaded file in the directory specified in the property file getUploadedFile($FHCompIdent); if($conf[$FHCompIdent."writeToDB"] == "true" && $conf[$FHCompIdent."dbPath"] != '') { if (!file_exists(dirname($conf[$FHCompIdent . "dbPath"]))) { NOF_throwError(540,array("{1}"=>NOF_mapPath(dirname($conf[$FHCompIdent . "dbPath"])),"{2}"=>NOF_mappath(getcwd()))); } if (!is_writable(dirname($conf[$FHCompIdent . "dbPath"]))) { NOF_throwError(541,array("{1}"=>NOF_mapPath(dirname($conf[$FHCompIdent . "dbPath"])),"{2}"=>NOF_mappath(getcwd()))); } //check if DB needs to be created/overwritten //check if DB needs to be created/overwritten if (!checkIfDBmatch($FHCompIdent)) { //open DB file for writing if (!$FILE = @fopen($conf[$FHCompIdent."dbPath"], 'wb')) { NOF_throwError(500,array("{1}"=>NOF_mapPath($conf[$FHCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$FHCompIdent . "dbPath"])))); exit(); } else { //write first line of UD file, to the DB file if (!fputs($FILE, "$firstLineUD\n")) { NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$FHCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$FHCompIdent . "dbPath"])))); exit(); } //close file handle fclose($FILE); } } } //insert a row into the database with the form value $entry = fhInsertInDB(); //send an email with the form values if($conf[$FHCompIdent."sendEmail"] == "true") { fhSendFormEmail($entry); } //display the success page fhDisplaySuccessPage(); } //display the success page after a successful submission function fhDisplaySuccessPage() { global $conf, $FHCompIdent, $errors; if($errors) { return; } //make the path of the next page gathered from the property file relative to the script $conf[$FHCompIdent."nextPage"] = makeRelativeToCgiBin($conf[$FHCompIdent."nextPage"]); //print out a javascript form which directs the top frame to the next page echo ""; echo ""; echo ""; echo ""; echo ""; } //insert the field values in the DB function fhInsertInDB() { global $conf,$requiredForPassRetv,$fieldsDBArray,$firstLineUD,$FHCompIdent,$errors; //for every expected field in the DB get its value from post request for($i=0; $i