<?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(file_exists(DATEIPFAD . "data/widerrufsformular.pdf")) {
    $widerrufDatei = '<a href="' . URLPFAD . 'data/widerrufsformular.pdf">Laden Sie hier das Widerrufsformular als PDF runter</a>';
}

if($_POST["submit"]) {
	if ($_POST["formEmail"] == "") {
		$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 = "Widerruf einer Bestellung\n\nArtikel: " . $_POST["artikel"] . "\nbestellt am: " . $_POST["bestellt"] . "\nerhalten am: " . $_POST["erhalten"] . "\nAnschrift: " . $_POST["verbraucheranschrift"] . "\nE-Mail: " . $_POST["formEmail"] . "\n\n";
          $e_mail = mail($rowAll->email,"Widerrufsformular einer Bestellung", $mailText, "From: ".$_POST["formEmail"]."\nReply-To: ".$_POST["formEmail"] ."\nContent-Type: text/plain; charset=".CHARSET);
	      //var_dump($mailText);	
        }		

   	    $_POST["artikel"] ="";
		$_POST["bestellt"] ="";
		$_POST["erhalten"] ="";
		$_POST["verbraucheranschrift"] ="";
		$_POST["formEmail"] ="";
		$_POST["betreff"] ="";
		$tpl_formErfolgreich = $lang_anfrage_erfolgreich;
	}
}


$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/topnavi/widerruf.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);
?>
