<?php

/*
	Pagemap (Content Publishing System)
	Copyright (C) Nico Wenig. All rights reserved.
*/



/**
 * System file header
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-11-23
 */

	umask(0000);
	set_time_limit(30);
	mb_internal_encoding('utf-8');

	session_start();

	header('content-type: text/html; charset=utf-8');

/**
 * Defaults for user data
 *
 * @category   User settings
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2011-11-28
 */

    $user_data = array(
    	'author' => '',
    	'email' => '',
    	'frontend languages' => 'de',
    	'quick help' => 1,
    	'error reporting' => 0,
    	'site title' => 'New Pagemap Website',
    	'base url' => '',
    	'url rewrite' => 0,
    	'backend language' => 'de',
    	'frontend template' => 'default',
    	'frontend template style' => 'none',
    	'date format print' => 'd.m.Y, H:i',
    	'date format sort' => 'Y',
    	'sort by' => 'none',
    	'sort ascending' => 1,
    	'show sort headlines' => 1,
    	'show info pages' => 1,
    	'rss title' => '',
    	'rss description' => '',
    	'rss url' => 'index.php?feed=rss',
    	'rss only news' => 1,
    	'rss items' => 9,
    	'info category' => 'Info Pages',
    	'content preview' => 'short',
    	'logo' => '',
    	'latitude' => '',
    	'longitude' => '',
    	'region' => '',
    	'placename' => '',
    	'meta language' => 0,
    	'meta last-modified' => 1,
    	'meta page-topic' => 1,
    	'meta noodp' => 1,
    	'meta canonical' => 0
    );

/**
 * Laod main system files
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-06-14
 */

	include('pagemap/settings.php');
	if(file_exists($system_data['file']['user data'])) include($system_data['file']['user data']);
	include($system_data['folder']['sources'] . 'functions.php');
	
	$system_data['frontend']['href attribute'] = $user_data['url rewrite'] == false ? 'index.php/' : '';

/**
 * System error handling
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-11-23
 */

	error_reporting($user_data['error reporting'] == 1 ? E_ALL : 0);

/**
 * Create RSS output
 *
 * @category   RSS
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-05-24
 */

	if(isset($_GET['feed'])) {
		switch($_GET['feed']) {
			case 'rss' : $_GET['feed'] = 'rss.php'; break;
			default : $_GET['feed'] = 'rss.php';
		}
		
		include($system_data['folder']['extensions'] . 'feed/' . $_GET['feed']);
		die();
	}

/**
 * Find base url if not set
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-06-29
 */
	
	if($user_data['base url'] == '') {
		$user_data['base url'] = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
		$user_data['base url'] = strpos($user_data['base url'], 'index.php') !== false ? str_replace('index.php', '', dirname($user_data['base url'])) : $user_data['base url'];
		$user_data['base url'] = trim($user_data['base url'], '/') . '/';
	}
	
/**
 * Load extensions
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-12-21
 */
	
	$extension_paths = dirlist($system_data['folder']['extensions'], array(), true);
	
	foreach($extension_paths as $tmp_path) {
		$tmp_name = str_replace($system_data['folder']['extensions'], '', $tmp_path);
		$tmp_path = $tmp_path . '/';
		$tmp_info_file = $tmp_path . $system_data['file']['extension info file'];
		$tmp_exe_file = $tmp_path . $system_data['file']['extension exe file'];

   		if(file_exists($tmp_info_file)) {
   			// Create defaults
   			$extensions[$tmp_name] = array(
   				'key' => $tmp_name,
   				'active' => is_file($system_data['folder']['settings'] . 'extensions/' . $tmp_name . '/DISABLED') ? 0 : 1,
   				'name' => $tmp_name,
   				'description' => '',
   				'version' => 'n/a',
   				'pagemap version' => 'n/a',
   				'author' => 'n/a',
   				'support' => '',
   				'protected' => 0
   			);
   			
   			// Overwrite defaults
   			include($tmp_info_file);
   			
   			// Load init file
   			if(file_exists($tmp_exe_file) && $extensions[$tmp_name]['active'] == 1) include($tmp_exe_file);
   		}
	}
	
/**
 * Redirect on error
 *
 * @category   Page loading
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-11-25
 */
	
	if(!isset($_GET['backend'])) {
		$dirname = trim(dirname($_SERVER['PHP_SELF']), '/ ');
		$pagename = strtolower(trim(str_replace($dirname, '', $_SERVER['REQUEST_URI']), '/'));
		$pagename_constant = $pagename;

		// Create SEO friendly URL sheme
		if(strpos($_SERVER['REQUEST_URI'], '/index.php/') !== false) {
			preg_match("@/index\.php/([^/]+)@", $_SERVER['REQUEST_URI'], $page_matches);
			if(isset($page_matches[1])) $pagename = $page_matches[1];
		}

		$pagename = str_replace('index.php', '', $pagename);
		$pagename = trim($pagename, '/?');
		$pagename = (strpos($pagename, '/') === false) ? $pagename : substr($pagename, 0, strpos($pagename, '/'));
		$pagename = trim($pagename, '&');
		$pagename = (strpos($pagename, '&') === false) ? $pagename : substr($pagename, 0, strpos($pagename, '&'));
		
		$_GET['page'] = $pagename;

		// Convert GET vars
		$get_vars = explode('&', $pagename_constant);
				
		foreach($get_vars as $var_entry) {
			$var_name = $var_entry;
			$var_value = '';
			
			if(strpos($var_entry, '=') !== false) {
				$var_name = substr($var_entry, 0, strpos($var_entry, '='));
				$var_value = substr($var_entry, strpos($var_entry, '=') + 1);
			}
			
			$_GET[$var_name] = $var_value;
		}
		
		// Load home page if page not given
		if((!isset($_GET['page']) || $_GET['page'] == '')) $_GET['page'] = $system_data['file']['homepage'];
		
		// Load error page if page not exists
		if(!in_array($_GET['page'], array($system_data['file']['404'], $system_data['file']['homepage']))) {
			$folder_page = $system_data['folder']['pages'] . $_GET['page'] . '/';
			
			if(!is_dir($folder_page) || !is_file($folder_page . $system_data['file']['index page'])) {
				connector('error 404 found');
				
				header('HTTP/1.1 404');
				header('location: ' . $user_data['base url'] . $system_data['frontend']['href attribute'] . $system_data['file']['404']);
			}
		}
	}

/**
 * Localization (frontend and backend)
 *
 * @category   Localization
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2011-12-02
 */
	
	// Get current frontend language
	$frontend_languages = explode(',', $user_data['frontend languages']);
	if(!is_array($frontend_languages)) $frontend_languages = array($frontend_languages);
	
	// Set website language to client (browser) language
	if(!isset($_SESSION['language'])) {
		$client_language = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
		$_SESSION['language'] = array_search($client_language, $frontend_languages) === false ? $frontend_languages[0] : $client_language;
	}
	
	// Set language to user choice
	if(get_url_value('language') != false) $_SESSION['language'] = get_url_value('language');

	$system_data['frontend']['session language'] = $_SESSION['language'];
	
	// Change language code for frontend / backend
	define('language', isset($_GET['backend']) ? $user_data['backend language'] : $_SESSION['language']);
	
	// Include standard texts
	include_txt('global', $system_data['folder']['languages'] . 'global/');
	
/**
 * Check basic requirements
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-05-06
 */
	
	if(phpversion() < 5) stop_script(txt('global', 'Pagemap benötigt mindestens PHP 5. Bitte aktualisieren Sie PHP auf eine neuere Version. In den meisten Fällen können Sie dies über den Administrationsbereich Ihres Webhosting-Anbieters erledigen.'));
	
	if(!is_writable($system_data['folder']['pages'])) stop_script(txt('global', 'Das Verzeichnis „pages” existiert nicht oder ist schreibgeschützt. Bitte erstellen Sie das Verzeichnis neu oder ändern Sie die Verzeichnisrechte mit einem FTP-Programm.'));
	if(!is_writable($system_data['folder']['settings'])) stop_script(txt('global', 'Das Verzeichnis „user” existiert nicht oder ist schreibgeschützt. Bitte erstellen Sie das Verzeichnis neu oder ändern Sie die Verzeichnisrechte mit einem FTP-Programm.'));
	
	if(!is_dir($system_data['folder']['pages'] . $system_data['file']['homepage']))
		rcopy($system_data['folder']['defaults'] . 'pages/homepage/', $system_data['folder']['pages'] . $system_data['file']['homepage']); 

	if(!is_dir($system_data['folder']['pages'] . $system_data['file']['404']))
		rcopy($system_data['folder']['defaults'] . 'pages/404/', $system_data['folder']['pages'] . $system_data['file']['404']); 

	if(!is_dir($system_data['folder']['database'] . 'standard/'))
		rmkdir($system_data['folder']['database'] . 'standard/');
	
	if(!is_file($system_data['folder']['database'] . 'standard/' . $system_data['backend']['info pages id'] . '.cat'))
		rcopy($system_data['folder']['defaults'] . 'database/' . $system_data['backend']['info pages id'] . '.cat', $system_data['folder']['database'] . 'standard/' . $system_data['backend']['info pages id'] . '.cat');
	
	if(!is_file($system_data['folder']['database'] . 'standard/catalogue.xml'))
		rcopy($system_data['folder']['defaults'] . 'database/catalogue.xml', $system_data['folder']['database'] . 'standard/catalogue.xml');
	
/**
 * Defaults for template data
 *
 * @category   Frontend template
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-07-10
 */
	
	$template_data = array(
		'syntax' => 'html',
		'title' => 'n/a',
		'version' => 'n/a',
		'author' => 'n/a',
		'copyright' => 'n/a',
		'description' => 'n/a',
		'home' => '',
		'sn' => 'n/a',
		'screenshot' => 'n/a',
		'css file' => 'index.css',
		'css selectors' => '',
		'css ids' => '',
		'backend mask' => 'n/a',
	);
	
/**
 * Get template data from template info file (info.php)
 *
 * @category   Frontend template
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-07-05
 */

	$system_data['folder']['frontend template'] = $system_data['folder']['templates'] . $user_data['frontend template'] . '/';
	if(file_exists($system_data['folder']['frontend template'] . 'info.php')) include($system_data['folder']['frontend template'] . 'info.php');

/**
 * Get page data and set header
 *
 * @category   Page info
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-11-19
 */

	if(isset($_GET['page'])) {
		$page_info = get_page_info($_GET['page']);
		$page_info->href = $system_data['frontend']['href attribute'] . $page_info->alias;
		
		$index_file = $system_data['folder']['pages'] . $_GET['page'] . '/' . $system_data['file']['index page'];
		
		if(is_file($index_file)) {
			$page_info->lastchanged = filemtime($index_file);
			$page_info->timestamp = $page_info->timestamp == '' ? time() : $page_info->timestamp;
			header('last-modified: ' . date('D, d M Y H:i:s', intval($page_info->timestamp)) . ' GMT');
		}
	}

/**
 * Redirect page to url
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-06-30
 */

	if(isset($page_info) && !isset($_GET['backend']) && $page_info->url != '') {
		header('HTTP/1.1 302');
		header('location: ' . htmlspecialchars_decode($page_info->url));
	}

/**
 * Get page info link elements (previous, next, last, first etc.)
 *
 * @category   Page info
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2011-10-26
 */

	if(isset($page_info) && !isset($_GET['backend'])) {
		// Get Standard Pages catalogue
		$cfile_path = $system_data['folder']['database'] . $page_info->pagetype . '/' . $page_info->catalogue . '.cat';
		if(is_file($cfile_path)) $cfile = file($cfile_path);

		// Get News Pages catalogue
		if($page_info->pagetype == 'news') {
			$cfile_path = $system_data['folder']['database'] . $page_info->pagetype . '/' . $page_info->catalogue;
			
			if(is_file($cfile_path)) {
				$cfile_xml = simplexml_load_file($cfile_path);
				foreach($cfile_xml->page as $page_entry) $cfile[] = strval($page_entry->alias);
			}
		}
		
		// Get available pages in catalogue file and current page position
		if(isset($cfile)) {
			$number_of_pages = 0;
			$i = 0;
			
			foreach($cfile as $page_entry) {
				$page_entry_xml = get_page_info(trim($page_entry));

				if(($page_entry_xml->published == 1 || strval($page_entry_xml->alias) == $page_info->alias) && ($page_entry_xml->language == $_SESSION['language'] || $page_entry_xml->language == '')) {
					$number_of_pages++;
					
					$pages_in_cfile[trim($page_entry)] = $page_entry_xml;
					
					if(trim($page_entry) == strval($page_info->alias)) $current = $page_entry_xml;
						else if(!isset($current)) { next($pages_in_cfile); $i++; }
				}
			}
			
			// Get page position
			$page_info->pages = $number_of_pages;
			$page_info->position = $i + 1;
			
			$temp_pages_in_cfile = $pages_in_cfile;
			$first_page_in_cfile = reset($temp_pages_in_cfile);
			$last_page_in_cfile = end($temp_pages_in_cfile);
						
			// Get previous page in same catalogue
			if($page_info->alias != strval($first_page_in_cfile->alias)) {
				$previous = prev($pages_in_cfile);
				
				if(is_object($previous)) {
					foreach($previous->children() as $entry => $value) $page_info->previous->$entry = $value;
					$page_info->previous->href = $system_data['frontend']['href attribute'] . $previous->alias;
					next($pages_in_cfile);
				}
			} else
				$previous_not_found = true;
	
			// Get next page in same catalogue
			if($page_info->alias != strval($last_page_in_cfile->alias)) {
				$next = next($pages_in_cfile);
				
				if(is_object($next)) {
					foreach($next->children() as $entry => $value) $page_info->next->$entry = $value;
					$page_info->next->href = $system_data['frontend']['href attribute'] . $next->alias;
				}
			} else
				$next_not_found = true;
			
			// Get first and last page in same catalogue
			$first = reset($pages_in_cfile);
			foreach($first->children() as $entry => $value) $page_info->first->$entry = $value;

			$last = end($pages_in_cfile);
			foreach($last->children() as $entry => $value) $page_info->last->$entry = $value;

			// If previous or next page could not be found in same catalogue
			if(isset($previous_not_found) || isset($next_not_found)) {
				// Standard Pages
				$database_file = $system_data['folder']['database'] . $page_info->pagetype . '/catalogue.xml';
				if(is_file($database_file)) $database_xml = simplexml_load_file($database_file);
				
				if(isset($database_xml)) {
					$i = 0;
					
					foreach($database_xml->cfile as $cfile_entry) {
						if($cfile_entry->published == 1) {
							if(strval($cfile_entry->id) == $page_info->catalogue) $position = $i;
							$available_catalogues[] = $cfile_entry;
							$i++;
						}
					}
					
					if(isset($position)) {
						// Get previous page in previous catalogue
						if(isset($previous_not_found) && isset($available_catalogues[$position - 1]) && strval($available_catalogues[$position - 1]->id) != $page_info->catalogue) {
							$cfile_path = $system_data['folder']['database'] . $page_info->pagetype . '/' . $available_catalogues[$position - 1]->id . '.cat';
							$cfile = is_file($cfile_path) ? file($cfile_path) : array();
							$page_info_xml = get_page_info(trim(end($cfile)));
							foreach($page_info_xml->children() as $child_entry => $value) $page_info->previous->$child_entry = $value;
						}
	
						// Get next page in next catalogue
						if(isset($next_not_found) && isset($available_catalogues[$position + 1]) && strval($available_catalogues[$position + 1]->id) != $page_info->catalogue) {
							$cfile_path = $system_data['folder']['database'] . $page_info->pagetype . '/' . $available_catalogues[$position + 1]->id . '.cat';
							$cfile = is_file($cfile_path) ? file($cfile_path) : array();
							$page_info_xml = get_page_info(isset($cfile[0]) ? trim($cfile[0]) : '');
							foreach($page_info_xml->children() as $child_entry => $value) $page_info->next->$child_entry = $value;
						}
					}
				} 
				
				if($page_info->pagetype == 'news') {
					$news_database_folder = $system_data['folder']['database'] . 'news/';
					$news_database_files = filelist($news_database_folder, 'xml', 0, array('topics.xml'), true);

					sort($news_database_files);
					
					$current_key = array_search($news_database_folder . strval($page_info->catalogue), $news_database_files);
					
					// Get previous page in previous catalogue
					if(isset($previous_not_found)) {
						if(isset($news_database_files[$current_key - 1])) {
							$previous_catalogue_pages = array();
							$database_xml = simplexml_load_file($news_database_files[$current_key - 1]);

							for($i = 0; $i < count($database_xml->page); $i++) {
								$temp_page_info = get_page_info($database_xml->page[$i]->alias);
								if($temp_page_info->published == 1) $previous_catalogue_pages[] = $temp_page_info->alias;
							}
							
							if(isset($previous_catalogue_pages[count($previous_catalogue_pages) - 1])) {
								$page_info_xml = get_page_info($previous_catalogue_pages[count($previous_catalogue_pages) - 1]);
								foreach($page_info_xml->children() as $child_entry => $value) $page_info->previous->$child_entry = $value;
							}
						}
					}
					
					// Get next page in next catalogue
					if(isset($next_not_found)) {
						if(isset($news_database_files[$current_key + 1])) {
							$previous_catalogue_pages = array();
							$database_xml = simplexml_load_file($news_database_files[$current_key + 1]);
							
							for($i = 0; $i < count($database_xml->page); $i++) {
								$temp_page_info = get_page_info($database_xml->page[$i]->alias);
								if($temp_page_info->published == 1) $previous_catalogue_pages[] = $temp_page_info->alias;
							}
							
							if(isset($previous_catalogue_pages[0])) {
								$page_info_xml = get_page_info($previous_catalogue_pages[0]);
								foreach($page_info_xml->children() as $child_entry => $value) $page_info->next->$child_entry = $value;
							}
						}
					}
				}
			}
		}
	}

/**
 * Get category data
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-11-21
 */
	
	$database_folder = $system_data['folder']['database'] . 'standard/';
	$database_file_categories = $database_folder . 'catalogue.xml';

	$database_categories = is_file($database_file_categories) ? simplexml_load_file($database_file_categories) : simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><cfiles></cfiles>');
	
	// Add category data to current page data
	if(isset($_GET['page']) && $_GET['page'] != '' && is_dir($system_data['folder']['pages'] . $_GET['page'])) {
		if(!isset($_GET['backend']))
			$page_info->metatitle = $page_info->metatitle == '' ? $page_info->title : $page_info->metatitle;

	    foreach($database_categories->cfile as $category_entry) {
	    	if(intval($category_entry->id) == intval($page_info->catalogue)) {
	    		$category_info = $category_entry;
	    		$page_info->category = ($page_info->category != '') ? $category_entry->title : '';
	    		
	    		if(!isset($_GET['backend'])) {
	    			$page_info->published = ($page_info->published == 0 || $category_entry->published == 0) ? 0 : 1;
	    			$page_info->template = ($category_entry->template == '' || $page_info->template != '') ? $page_info->template : $category_entry->template;
					
	    			$page_info->description = $page_info->description . ($page_info->description == '' || $category_info->description == '' ? '' : ' ') . $category_info->description;
	    			$page_info->tags = $page_info->tags . ($page_info->tags == '' || $category_info->tags == '' ? '' : ', ') . $category_info->tags;
	    			$page_info->pagetopic = $page_info->pagetopic . ($page_info->pagetopic == '' || $category_info->pagetopic == '' ? '' : ' ') . $category_info->pagetopic;
	    		}
	    		
	    		break;
	    	}
	    }
	}
	
/**
 * Load template for frontend or backend
 *
 * @category   System start
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-07-13
 */
 	
 	connector('system start');

	if(isset($_GET['backend'])) {
		include($system_data['folder']['sources'] . 'index.php');
	} else {
		// Load frontend HTML header and footer
		$system_data['frontend']['header'] .= is_file($system_data['file']['frontend html header file']) ? file_get_contents($system_data['file']['frontend html header file']) : '';
		$system_data['frontend']['footer'] .= is_file($system_data['file']['frontend html footer file']) ? file_get_contents($system_data['file']['frontend html footer file']) : '';
		
		// Close tags for XHTML
		$te = $template_data['syntax'] == 'xhtml' ? ' /' : '';
		
		// Create Geo Tags
		if(!empty($user_data['placename']) && !empty($user_data['region']) && !empty($user_data['latitude']) && !empty($user_data['longitude'])) {
			$system_data['frontend']['header'] .= '<meta name="geo.position" content="' . $user_data['latitude'] . ';' . $user_data['longitude'] . '"' . $te . '>' . "\n";
			$system_data['frontend']['header'] .= '	<meta name="ICBM" content="' . $user_data['latitude'] . ', ' . $user_data['longitude'] . '"' . $te . '>' . "\n";
			$system_data['frontend']['header'] .= '	<meta name="geo.region" content="' . $user_data['region'] . '"' . $te . '>' . "\n";
			$system_data['frontend']['header'] .= '	<meta name="geo.placename" content="' . $user_data['placename'] . '"' . $te . '>' . "\n";
		}
		
		// Create additional Meta Tags
		if($user_data['meta language'] == 1 && !empty($page_info->language)) $system_data['frontend']['header'] .= "\n" . '	<meta name="language" content="' . (strpos($page_info->language, ',') > 0 ? substr($page_info->language, 0, strpos($page_info->language, ',')) : $page_info->language) . '"' . $te . '>' . "\n";
		if($user_data['meta last-modified'] == 1) $system_data['frontend']['header'] .= '	<meta name="last-modified" content="' . date('D, d M Y H:i:s', intval($page_info->timestamp)) . ' GMT"' . $te . '>' . "\n";
		if($user_data['meta page-topic'] == 1 && !empty($page_info->pagetopic) && $page_info->searchable == 1) $system_data['frontend']['header'] .= '	<meta name="page-topic" content="' . $page_info->pagetopic . '"' . $te . '>' . "\n";
		if($user_data['meta noodp'] == 1 && $page_info->searchable == 1) $system_data['frontend']['header'] .= '	<meta name="robots" content="noodp"' . $te . '>' . "\n";
		if($user_data['meta canonical'] == 1 && !empty($user_data['base url'])) $system_data['frontend']['header'] .= '	<link rel="canonical" href="' . $user_data['base url'] . $page_info->href . '">' . "\n";
		
		// Use preview text from news page for Meta Tag Description if this is empty
		if($page_info->pagetype == 'news' && empty($page_info->description)) $page_info->description = strip_tags($page_info->teaser);
		
		// Load frontend template file
		$pagetype_template_file = $system_data['folder']['frontend template'] . $page_info->pagetype . '.tpl';
		$preferred_template_file = is_file($pagetype_template_file) ? $page_info->pagetype . '.tpl' : $system_data['file']['template index'];
		$template_file = $system_data['folder']['frontend template'] . ($page_info->template != '' && is_file($system_data['folder']['frontend template'] . $page_info->template) ? $page_info->template : $preferred_template_file);
		is_file($template_file) ? include($template_file) : stop_script(txt('global', 'Die angegebene Seitenvorlage konnte nicht gefunden werden.'));
	}

?>