View file index.php

File size: 1.21Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.org.ua  *
**********************************/
define('ROOT', realpath(dirname(__FILE__))); 
define('SYS', ROOT .'/system'); 
define('TPL', ROOT .'/template');
define('URL', 'http://'. $_SERVER['HTTP_HOST']);
error_reporting(0);
if (!file_exists(SYS .'/ini/db.ini')) { header('Location: /setup/'); exit;}

session_name('PSID');
session_start();
mb_internal_encoding('UTF-8');

require_once(SYS .'/inc/system.php');


$route = route_filter($_GET['route']);
if(!empty($route))
	{
		$route_notice = 0;
		if(!preg_match('/[a-z0-9\-\/\_\?\!&;]/i', $module)) $route_notice == 1;
		if(file_exists(ROOT.'/modules/'.$route.'/index.php'))
			{
				require_once(ROOT.'/modules/'.$route.'/index.php');
			}
		elseif(file_exists(ROOT.'/modules/'.$route))
			{
				require_once(ROOT.'/modules/'.$route);
			}
		elseif($route_notice == 1)
			{
				require_once(ROOT.'/modules/pages/not_found.php');
			}
		else
			{
				require_once(ROOT.'/modules/pages/not_found.php');
			}
	}
elseif(!isset($route) || empty($route))
	{
		require_once(ROOT.'/modules/index.php');
	}
?>