Skip to content
Snippets Groups Projects
index.php 2.18 KiB
<?php
require_once('../application/config.php');

/* ERROR HANDLING : START */
error_reporting(0);
if (STATUS_DEBUG) {
	error_reporting(STATUS_DEBUG_MODE);
}
/* ERROR HANDLING : END */

if (!STATUS_ACTIVE) {
	require_once(APP_BASE_DIR.'/pages/maintenance.php'); //show the system maintenance page if the website is down and you're not using specific IP
} else { //if website is up
	
	// INCLUDES 1
	require_once(APP_BASE_DIR.'/classes/mysql.php');
	require_once(APP_BASE_DIR.'/classes/security.php');

	/* LANGUAGE AND PAGE HANDLING : START */
	$curr_full_uri = WEB_BASE_PRO.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	$curr_uri_string = str_replace(WEB_BASE_URL, '', $curr_full_uri);
	$uri_string_arr_1 = explode('?', $curr_uri_string);
	if (security::check_request_data($uri_string_arr_1[0])) {
		$uri_string_arr_2 = explode('/', $uri_string_arr_1[0]);
		//1st string part is always language, no matter if it is default or not
		$uri_language = str_replace('/', '', $uri_string_arr_2[1]);
		$temp_languages_arr = unserialize(SYSTEM_LANGUAGES);
		foreach ($temp_languages_arr as $k=>$v) {
			if ($uri_language==$k) {
				$language = $k;
			}
		}
		if (!$language)
			die(header('Location:'.WEB_BASE_URL.'/'.SYSTEM_DEFAULT_LANGUAGE.'/'));
		if (isset($uri_string_arr_2[4]) && security::check_request_data($uri_string_arr_2[4])) {
			die(header('Location:'.WEB_BASE_URL.'/'.SYSTEM_DEFAULT_LANGUAGE.'/'));
		} elseif (isset($uri_string_arr_2[3]) && security::check_request_data($uri_string_arr_2[3])) {
			// MODULES PAGES (3rd LEVEL)
			$page_type = 'modules';
			$page = str_replace('/', '', $uri_string_arr_2[2]);
			$subpage = str_replace('/', '', $uri_string_arr_2[3]);
		} elseif (isset($uri_string_arr_2[2]) && security::check_request_data($uri_string_arr_2[2])) {
			// SIMPLE PAGES (2nd LEVEL)
			$page_type = 'simple';
			$page = str_replace('/', '', $uri_string_arr_2[2]);
		} else {
			// SIMPLE PAGE (Home page)
			$page_type = 'simple';
			$page = 'home';
		}
	}
	
	// INCLUDES 2
	require_once(APP_BASE_DIR.'/classes/user.php');
	if ($page=='home') {
	}
	
	// Load template
	require_once(WEB_BASE_DIR.'/templates/'.CURRENT_TEMPLATE.'/index.php');

}