<?php
@session_start ();
@ob_start ();
@ob_implicit_flush ( 0 );

if( !defined( 'E_DEPRECATED' ) ) {
	error_reporting ( E_ALL ^ E_NOTICE );
	@ini_set ( 'error_reporting', E_ALL ^ E_NOTICE );
} else {
	error_reporting ( E_ALL ^ E_DEPRECATED ^ E_NOTICE );
	@ini_set ( 'error_reporting', E_ALL ^ E_DEPRECATED ^ E_NOTICE );
}

@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );

define ( 'DATALIFEENGINE', true );
define ( 'ROOT_DIR', dirname ( __FILE__ ) );
define ( 'SYSTEM_DIR', ROOT_DIR . '/system' );

$check_referer = true;
require_once (SYSTEM_DIR . '/inc/include/init.php');

if ($is_loged_in == FALSE) {
	echoheader ( "home", "Login" );

	if( ! $handle = opendir( "./language" ) ) {die( "Невозможно открыть директорию ./data/language/" );}

	while ( false !== ($file = readdir( $handle )) ) {
		if( is_dir( ROOT_DIR . "/language/$file" ) and ($file != "." and $file != "..") ) {
			$sys_con_langs_arr[$file] = $file;
		}
	}closedir( $handle );

	$select_language = makeDropDown( $sys_con_langs_arr, "selected_language", $selected_language );
	
    echo $skin_login;
	
	echofooter ();
	exit ();
} elseif ($is_loged_in == TRUE) {

	if ( !$mod ) {
		include (SYSTEM_DIR . '/inc/main.php');
	} elseif ( @file_exists( SYSTEM_DIR . '/inc/' . $mod . '.php' ) ) {
		include (SYSTEM_DIR . '/inc/' . $mod . '.php');
	} else {
		$db->close ();
		msg ( "error", $lang['index_denied'], $lang['mod_not_found'] );
	}
}

$db->close ();

GzipOut ();
?>