<?php
//  Copyright (c) 2004-2008 randshop
//  http://www.randshop.com
//
//  Unter Lizenz von randshop
//	
//	Letzte Bearbeitung: 22.08.2008


	session_start();

	// Hauptkonfigurationsdatei
	include_once("../../conf/config.inc.php");
	include_once(DATEIPFAD . "conf/db.inc.php");
	include_once(DATEIPFAD . "includes/shopinitialize.inc.php");
	if(KUNDENGRUPPEN) {
		include_once(DATEIPFAD . "includes/functions.mod.kundengruppen.inc.php");
	} else {
		include_once(DATEIPFAD . "includes/functions.kundengruppen.inc.php");
	}
	include_once(DATEIPFAD . "includes/functions.artikel.inc.php");
  include_once(DATEIPFAD . "includes/functions.merkmale.inc.php");
	include_once(DATEIPFAD . "includes/functions.kategorie.inc.php");
	//Sessionregister
	include_once(DATEIPFAD . "includes/session_register.inc.php");
	include_once(DATEIPFAD . "includes/functions.global.inc.php");
	//Spracheninclude
	if (@fopen(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php",r)) {
		include_once(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php");
} else {
	include_once(DATEIPFAD . "includes/language/langu_de.inc.php");
}	

if($katId == "")
{
	$_SESSION['kat'] = "";
}
	// Header
	include_once(DATEIPFAD . "includes/header.inc.php");
	
	
if(!$_GET["menueId"]) {
	$_GET["menueId"] = $_POST["menueId"];
}

$tpl_menueId = $_GET["menueId"];
	
$GetMenueObject = GetMenueDetails($_GET["menueId"], $_SESSION["languageid"]);

// Abfrage nach Online Status
if($GetMenueObject->aktiv == "1") {



$tpl_topnaviName = $GetMenueObject->headline;
if($GetMenueObject->bigImage != "") {
	if(file_exists("../../images/dbimages/" . $GetMenueObject->bigImage)) 	{
		$imageSize = getimagesize("../../images/dbimages/" . $GetMenueObject->bigImage);
		$tpl_topImage =  "<img src=\"../../images/dbimages/" . $GetMenueObject->bigImage . "\" width=\"" . $imageSize[0] . "\" height=\"" . $imageSize[1] . "\" border=\"0\" align=\"left\">\n";
	}
}
$tpl_topEintrag = stripslashes($GetMenueObject->textEintrag) . "\n";
	
	
if($_POST["submit"]) {
	if (($_POST["name"] == "") || ($_POST["tel"] == "") || ($_POST["betreff"] == "") || ($_POST["nachricht"] == "")) {
		$tpl_formFehlerText = $u_sternFelder;
  } 	elseif(is_mail($_POST["formEmail"]) == false) {
		$tpl_formFehlerText = $lang_emailInkorrekt;
	} else {
	  if (FALSE !== strpos($_POST["formEmail"], "\r") || FALSE !== strpos($_POST["formEmail"], "\n")) {
			echo "Spammer";
		} else {
			$mailText = "Anfrage zum Thema " . $_POST["betreff"] . "\n\nName: " . $_POST["name"] . "\nFirma:" . $_POST["firma"] . "\nTelefon:" . $_POST["tel"] . "\nFax: " . $_POST["fax"] . "\nE-Mail: " . $_POST["formEmail"] . "\n\n".$_POST["nachricht"];
    		$e_mail = mail($rowAll->email,$rowAll->firmen_titel . " " . $_POST["betreff"], $mailText, "From: ".$_POST["formEmail"]."\nReply-To: ".$_POST["formEmail"] ."\nContent-Type: text/plain; charset=".CHARSET);
		}		

   	$_POST["name"] ="";
		$_POST["firma"] ="";
		$_POST["tel"] ="";
		$_POST["fax"] ="";
		$_POST["formEmail"] ="";
		$_POST["betreff"] ="";
		$_POST["nachricht"] ="";
	  $tpl_formErfolgreich = $lang_anfrage_erfolgreich;
	}
}


$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/kontakt/formular.tpl";
	
	


} // Ende Abfrage onlinestatus
else {
	$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/kein_inhalt.tpl";
}


// Letzte globale Zusammenfassung z.B. fuer Warenkorbanzeige, bevor das Template geladen wird.
include_once(DATEIPFAD . "includes/footer.inc.php");


// Template
if($mobilestyle) {
    include_once(DATEIPFAD . "templates/" . $rowTemp->name . "/mobile/layout.phtml");
} else {
    include_once(DATEIPFAD . "templates/" . $rowTemp->name . "/website/index.tpl");
}

	
@mysql_close($db);
?>
