<?php
/**
 * @package PageMonitor
 * @copyright (C) 2008 Programac
 * Krzysztof Pawłowski
 */
	define ("_VALID_PAGE_MONITOR", true);
	
	/* No errors */
	error_reporting(1);
	
	/* Globals for install and otherwise. */
	$langs[] = array( "lang_code" => "pl", "lang name" => "Polski", "welcome" => "Proszę wybrać język:" );
	$langs[] = array( "lang_code" => "en", "lang name" => "English", "welcome" => "Please select a language:" );
	
	if( NULL != $_POST["lang"] &&
			"en" == $_POST["lang"] )
		require_once ("lang" . DIRECTORY_SEPARATOR . "lang" . "_" . "en" . ".php" );
	else if( NULL != $_POST["lang"] &&
			"pl" == $_POST["lang"] )
		require_once ("lang" . DIRECTORY_SEPARATOR . "lang" . "_" . "pl" . ".php" );
	
	/* Check if an installations folder exist. */
	if( !file_exists("install") ){
		/* Requires */
		require_once ("PageMonitorConfiguration.php");
		require_once ("lang" . DIRECTORY_SEPARATOR . "lang" . "_" . _LANGUAGE . ".php" );
		
		require_once ("includes" . DIRECTORY_SEPARATOR . "params.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "timer.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "folder_list.php" );		
		require_once ("includes" . DIRECTORY_SEPARATOR . "xmlparser.php" );	
		require_once ("includes" . DIRECTORY_SEPARATOR . "module.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "timer_module.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "product_list_module.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "preview_browser.php" );
		require_once ("includes" . DIRECTORY_SEPARATOR . "modules_loader.php" );
	
		if( !$pm_config["template"] )
			die ("Main template is not set.");
			
		/* Include template */
		include( "templates" . DIRECTORY_SEPARATOR . $pm_config["template"] . 
			DIRECTORY_SEPARATOR . "index.php" );
	}else{
		if( NULL == $_POST["lang"] )
			require_once ("lang" . DIRECTORY_SEPARATOR . "lang" . "_" . "pl" . ".php" );
		include( "install/install.php" );
	}
?>
