<?php
	error_reporting(0);
	ini_set("display_errors", "0");
	// Smarty Standardkonfiguration
	require('./smarty/libs/Smarty.class.php');
	require('./admin/libs/classes/class_db.inc.php5');
	require('./admin/libs/database_functions.inc.php5');
	
	$smarty = new smarty();
	$smarty->template_dir = './templates/';
	$smarty->compile_dir = './templates_c/';
	$smarty->config_dir = './configs/';
	$smarty->cache_dir = './cache/';
	
	// Smarty - Einstellungen
	$smarty->compile_check = false;
	$smarty->debugging = false;
	$smarty->caching = false;
	
	
	srand((double)microtime()*1000000);
	$zufallszahl = rand(1,3);
	$smarty->assign('picnr', $zufallszahl);

	//
	if(isset($_GET['inc'])) {
		$inc = str_replace(array(".","/","\\"), "", $_GET['inc']);
		if(!empty($inc) AND preg_match("/^[a-zA-Z]{1,20}$/", $inc)) {
		  	$module_path = "./website/";
		  	$module = $module_path.$inc.".php5";
			if(is_file($module) AND file_exists($module) AND is_readable($module)) {
				include($module);
			}
			else {
				$smarty->assign("error_type", "missing_file");
				$smarty->assign("error_message", "Datei existiert nicht!");
				$smarty->display('error.tpl');
			}
		}
		else {
			$smarty->assign("error_type", "invalid_parameter");
			$smarty->assign("error_message", "Ung&uuml;ltiger Parameter!");
			$smarty->display('error.tpl');		  
		}		
	}
	else {
	  	include('./website/news.php5');
	}
?>