session_start();
require_once('./ws_php/caching/AutoExpires.class.php');
require_once('./ws_php/geoplugin.class/geoplugin.class.php');
// Configure to check if content was modified (ignore expires time)
AutoExpires::setStrategies(array('if-modified'));
// Start
AutoExpires::start();
include ("./control/inc/connect.php");
$_SESSION['my_host']=HostConfiguration::HOST;
if($_SESSION['lang']==""){
/*$geoplugin = new geoPlugin();
$geoplugin->locate();
$countrycode=$geoplugin->countryCode;
if($countrycode=="AT"||$countrycode=="DE"){
$_SESSION['lang']=0;
}else
$_SESSION['lang']=1;*/
$_SESSION['lang']=0;
}
//if ($HTTP_HOST!="www.".$_SESSION['my_host']&&$_REQUEST['control_mode']!=1) {
if ($HTTP_HOST!="".$_SESSION['my_host']&&$_REQUEST['control_mode']!=1) {
//header ('HTTP/1.1 301 Moved Permanently');
//header ('Location: http://www.'.$_SESSION['my_host'].$_SERVER["REQUEST_URI"]);
//header ('Location: http://'.$_SESSION['my_host'].$_SERVER["REQUEST_URI"]);
}
//session_start();
$dat=substr($_SERVER['SCRIPT_URL'],1);
$filename=substr($dat,0,strlen($dat)-4);
$_SESSION['akt_rsyms']=Array();
if(isset($_REQUEST['nomobile']))
$_SESSION['nomobile']=$_REQUEST['nomobile'];
if($filename!=""){
/*
$link= $filename;
while(dirname($link)!="."){
$link=dirname($link);
$_SESSION['akt_rsyms'][]="../";
}
if(implode($_SESSION['akt_rsyms'])!="")
chdir(implode($_SESSION['akt_rsyms']));
*/
}
include ("./control/inc/func.php");
include ("./control/inc/class_lib.php");
include ("./control/inc/spezial_lib.php");
include ("./control/inc/merkmalEditor_lib.php");
include ("./control/inc/tree_lib.php");
include("./control/inc/newsletter_lib.php");
include("./control/inc/webshop_lib.php");
init_system();
//echo $_SESSION['lang'];
if($_SESSION['lang']==0||$_SESSION['lang']=="")setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
if($_SESSION['lang']==1)setlocale(LC_ALL, 'en_EN@euro', 'en_EN', 'en_en');
if($_SESSION['lang']==2)setlocale(LC_ALL, 'it_IT@euro', 'it_it', 'it_it');
if($_SESSION['lang']==3)setlocale(LC_ALL, 'fr_FR@euro', 'fr_fr', 'fr_fr');
require(SmartyConfiguration::SMARTY_DIR.'/libs/Smarty.class.php');
//if(isset($_POST['search'])&&$_POST['search']!=""){
if(isset($_POST['search'])){
$_REQUEST['id']=19;
$textclass=new textClass();
$SearchTextData=$textclass->GetSearchTextData($_POST['search']);
}
$merkmalset=new merkmalSet('site');
if(isset($_REQUEST['id'])&&$_REQUEST['id']!=""){
$sitedata=$merkmalset->getLinkedidRealDataSet($_REQUEST['id']);
if(is_file($sitedata[192]['val'].'.htm')&&$sitedata[192]['val']!=""&&$_REQUEST['control_mode']!=1&&($_SERVER["REQUEST_URI"]=='/'||$_SERVER["REQUEST_URI"]=='/index.php')){
//header("HTTP/1.1 301 Moved Permanently");
//header("Location: http://www.".$_SESSION['my_host']."/".$sitedata[192]['val'].".htm");
//header("Location: http://".$_SESSION['my_host']."/".$sitedata[192]['val'].".htm");
//header("Connection: close");
}
}
if($filename!=""&&$filename!="index"){
$id=$merkmalset->getLinkedidBySymlink($filename,192);
if($id!=false&&$_REQUEST['id']=="")$_REQUEST['id']=$id['linkedid'];
}
if(isset($_REQUEST['logout'])&&$_REQUEST['logout']==1){
$login=new websiteUser();
$login->Logout();
header("Location: ./index.php");
}
if($_REQUEST['id']==""){
$id=$merkmalset->getLinkedidBySymlink(1,40000);
if($id!=false&&$_REQUEST['id']=="")$_REQUEST['id']=$id['linkedid'];
}
$sitedata=$merkmalset->getLinkedidRealDataSet($_REQUEST['id']);
/*if($sitedata[2145]['val']!=1 && $WEBSITELOGIN['linkedid']=="" && $control_mode!=1){
$_REQUEST['id']=62;
$sitedata=$merkmalset->getLinkedidRealDataSet($_REQUEST['id']);
}*/
//$ribbondata=$merkmalset->getRibbonSet('site');
$menu_tree=new Tree($PEAR_dsn,'site','menu','1');
$site_menudata=$menu_tree->getNodeData($_REQUEST['id']);
$menuid=$_REQUEST['id'];
if($sitedata[177]['val']==1){
$temp=$menu_tree->getChildren($site_menudata['id']);
reset($temp);
$first_child=current($temp);
$_REQUEST['id']=$first_child['linkedid'];
$sitedata=$merkmalset->getLinkedidRealDataSet($_REQUEST['id']);
$menu_tree=new Tree($PEAR_dsn,'site','menu','1');
$site_menudata=$menu_tree->getNodeData($_REQUEST['id']);
}
if($sitedata[2115]['val']!=""){
//$menuid=$_REQUEST['id'];
$_REQUEST['id']=$sitedata[2115]['val'];
$sitedata=$merkmalset->getLinkedidRealDataSet($_REQUEST['id']);
$menu_tree=new Tree($PEAR_dsn,'site','menu','1');
$site_menudata=$menu_tree->getNodeData($_REQUEST['id']);
}
$parentsite_menudata=$menu_tree->getNodeDatabyId($site_menudata['sub']);
$parentparentsite_menudata=$menu_tree->getNodeDatabyId($parentsite_menudata['sub']);
//LOGINCHECK
if($_REQUEST['control_mode']!=1){
$nodeiddata=$menu_tree->getNodeData($_REQUEST['id']);
$parents=$menu_tree->getParents($nodeiddata['id']);
$linkedid_array=array();
foreach($parents as $p){
$linkedid_array[]=$p['linkedid'];
}
$linkedid_array[]=$_REQUEST['id'];
$linkedid_array=array_reverse ($linkedid_array);
//var_dump($linkedid_array);
$treeparents_sitedata=array();
$checklogin['mode']=false;
foreach($linkedid_array as $l){
$treeparents_sitedata[$l]=$merkmalset->getLinkedidDataSet($l);
if($treeparents_sitedata[$l][2145]['val']!=""){
$checklogin['mode']='gruppe';
$checklogin['val']=$treeparents_sitedata[$l][2145]['val'];
break;
}
if($treeparents_sitedata[$l][40199]['val']!=""){
$checklogin['mode']='user';
$checklogin['val']=$treeparents_sitedata[$l][40199]['val'];
break;
}
}
//die($_SESSION['WEBSITELOGIN']['153']."!=".$checklogin['val']."!=".$checklogin['mode']);
if(($_SESSION['WEBSITELOGIN']['linkedid']==""||!isset($_SESSION['WEBSITELOGIN']))&&$checklogin['mode']!=false){
header("Location: http://".$_SESSION['my_host']."/?id=43&goto=".$_REQUEST['id']);
}else{
if(
($checklogin['mode']!=false)&&
(
($checklogin['mode']=='user'&&$_SESSION['WEBSITELOGIN']['linkedid']!=$checklogin['val'])||
($checklogin['mode']=='gruppe'&&$_SESSION['WEBSITELOGIN']['153']!=$checklogin['val'])
)
){
header("Location: http://".$_SESSION['my_host']."/?id=43&goto=".$_REQUEST['id']);
}
}
}
//ENDLOGINCHECK
$smarty = new Smarty();
$smarty->setTemplateDir(SmartyConfiguration::SMARTY_DIR.'/templates');
$smarty->setCompileDir(SmartyConfiguration::SMARTY_DIR.'/templates_c');
$smarty->setCacheDir(SmartyConfiguration::SMARTY_DIR.'/cache');
$smarty->setConfigDir(SmartyConfiguration::SMARTY_DIR.'/configs');
$textclass=new textClass($_REQUEST['id']);
$textdata=$textclass->GetAllSiteTextData();
foreach($textdata as $td)
$smarty->assign($td[130], $td[132]);
$smarty->assign("sitedata", $sitedata,true);
if($sitedata[128]['val']=="")$sitedata[128]['val']='text.tpl';
$smarty->assign("rquestvars", $_REQUEST);
$smarty->assign("sessionvars", $_SESSION);
$smarty->assign("websitelogin", $_SESSION['WEBSITELOGIN']);
$smarty->assign("Title", $sitedata[120]['val'],true);
$smarty->assign("Name", $sitedata[119]['val'],true);
$smarty->assign("Description", $sitedata[121]['val'],true);
$smarty->assign("Keywords", $sitedata[122]['val'],true);
$smarty->assign("Stylesheet", $sitedata[124]['val'],true);
$smarty->assign("ContentLanguage", $sitedata[125]['val'],true);
$smarty->assign("Generator", $sitedata[126]['val'],true);
$smarty->assign("treenodeid", $_REQUEST['treenodeid'],true);
$smarty->assign("id", $_REQUEST['id'],true);
$smarty->assign("menuid", $menuid,true);
$smarty->assign("parentid", $parentsite_menudata['linkedid'],true);
$smarty->assign("parentparentid", $parentparentsite_menudata['linkedid'],true);
$smarty->assign("control_mode", $_REQUEST['control_mode'],true);
$smarty->assign("nomobile", $_SESSION['nomobile'],true);
$smarty->assign("searchresults", $SearchTextData);
if(CacheConfiguration::CACHE_SMARTY=="1")$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
$vererbt=Array(
Array(250,239),
Array(251,240),
Array(252,241),
Array(253,242),
Array(254,125),
Array(255,243),
Array(256,244),
Array(257,246),
Array(258,245),
Array(259,247)
);
foreach($vererbt as $ve){
if($sitedata[$ve[0]]['val']!=""&&$sitedata[$ve[1]]['val']==""){
$tempdata=$merkmalset->getLinkedidRealDataSet($sitedata[$ve[0]]['orig_val']);
$sitedata[$ve[1]]['val']=$tempdata[$ve[1]]['val'];
}
}
//$smarty->display($sitedata[128]['val']);
if($_REQUEST['clearAllCache']==1){
$smarty->clearAllCache();
echo '
';
}
if($_REQUEST['control_mode']==1) {
$smarty->clearCache($sitedata[128]['val'], $_REQUEST['id']);
}else{
/* if(!$smarty->isCached($sitedata[128]['val'], $_REQUEST['id'])){
echo "kein Cache gefunden(".$sitedata[128]['val'].",".$_REQUEST['id']."), also Variablen zuweisen";
}else{
echo "Cache gefunden(".$sitedata[128]['val'].",".$_REQUEST['id'].")";
}
*/
}
$smarty->assign("sitedata", $sitedata,true);
if($_REQUEST['nlonlineid']!="")$site=$smarty->fetch('text_nl.tpl', $_REQUEST['id']);
else $site=$smarty->fetch($sitedata[128]['val'], $_REQUEST['id']);
foreach($merkmalset->getAllSymlinks() as $symlink){
$site = preg_replace('/(index.php\?id='.$symlink[0].')([^0-9])/', "/".$symlink[1].'.htm$2', $site);
$site = preg_replace('/(\/\?id='.$symlink[0].')([^0-9])/', "http://".$_SERVER['HTTP_HOST']."/".$symlink[1].'.htm$2', $site);
$site = preg_replace('/(\?id='.$symlink[0].')([^0-9])/', "http://".$_SERVER['HTTP_HOST']."/".$symlink[1].'.htm$2', $site);
$site = str_replace("http://".$_SERVER['HTTP_HOST']."/".$symlink[1].'.htm&', "http://".$_SERVER['HTTP_HOST']."/".$symlink[1].'.htm?', $site);
}
if($_GET['nlo']==1){
$site=str_replace('[#abmelde_link]', "hier",$site);
$site=str_replace('[#bestaetigungs_link]', "hier",$site);
}
if($_GET['te']!=""){
session_regenerate_id();
$menu_tree=new Tree($PEAR_dsn,'site','menu','1');
$menudata=$menu_tree->getNodeData($_REQUEST['tn']);
$parentsite_menudata=$menu_tree->getNodeDatabyId($menudata['sub']);
$merkmalset=new merkmalSet('site','site');
$nl_cat_site_data=$merkmalset->getLinkedidDataSet($nl_cat_site_id);
$sql = "SELECT *
FROM mailqueue_emails where id=:id";
$pdoparams = array(
':id' => $_REQUEST['ti']
);
try {
$stmt = MyDB::getInstance()->prepare($sql);
$stmt->execute($pdoparams);
}
catch(PDOException $e){
echo $e->getMessage();
}
$aussendungsdata=$stmt->fetch();
if (crypt($aussendungsdata['email'], $_REQUEST['te']) == $_REQUEST['te']) {
$websiteUser=new websiteUser();
$userid=$websiteUser->getLinkedidbyEmail($aussendungsdata['email']);
if($userid!=false){
$_SESSION['NLTRACKING']['linkedid']=$userid['linkedid'];
}else
$_SESSION['NLTRACKING']['linkedid']="";
$_SESSION['NLTRACKING']['trackingNL']=$parentsite_menudata['linkedid'];
$_SESSION['NLTRACKING']['email']=$aussendungsdata['email'];
}
}
echo $site;
?>