Просмотр файла index.php

Размер файла: 1.78Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.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/db.php');
require_once(SYS .'/inc/functions.php');
require_once(SYS .'/inc/core.php');
require_once(SYS.'/classes/lang.php');
$lang = new Lang();
require_once(SYS .'/inc/const.php');
require_once(SYS.'/classes/template.php');
$tpl = new Template();
require_once(SYS.'/classes/stat.php');
$stat = new Stat();
require_once(SYS.'/classes/paginator.php');
require_once(SYS.'/classes/comments.php');

$module = htmlspecialchars(trim($_GET['route']));

if (preg_match('/\.php$/i', $module)) $module_file = true;
else $module_file = false;

if (!empty($module))
{
    if (file_exists(ROOT .'/modules/'. $module) && $module_file == true)
    {
        require_once(ROOT .'/modules/'. $module);
    }
    else if (file_exists(ROOT .'/modules/'. $module) && $module_file == false)
    {
        if (file_exists(ROOT .'/modules/'. $module .'/index.php'))
        {
            require_once(ROOT .'/modules/'. $module .'/index.php');
        }
        else
        {
            $index = 1;
            require_once(ROOT .'/modules/index.php');
        }
    }
    else
    {
        $index = 1;
        require_once(ROOT .'/modules/index.php');
    }
}
else
{
    $index = 1;

    require_once(ROOT .'/modules/index.php');
}
?>