<?php
/**
* @version	$Id: index.php 11992 2009-07-24 23:41:22Z dmitrya $
* @package	In-Portal
* @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license      GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.net/license/ for copyright notices and details.
*/
	$start = getmicrotime();

	define('ADMIN', 1);
	define('FULL_PATH', realpath(dirname(__FILE__).'/..') );
	if (!file_exists(FULL_PATH.'/core/kernel/application.php')) {
		die('Please re-checkout _inportal_kernel4 cvs module into the root directory ('.FULL_PATH.') and remove kernel/kernel4 folder. Make sure to checkout correct branch (RC or HEAD).');
	}

	include_once(FULL_PATH.'/core/kernel/startup.php');

	if (DIRECTORY_SEPARATOR != '\\') {
		// force user to remove write permissions for important files (Linux only)
		if (check_write_permissions(FULL_PATH.'/config.php') || check_write_permissions(FULL_PATH)) {
			die('<br/><br/><center><font color="red">It\'s not safe to run with write permissions (777) on "/config.php" file and root folder of In-Portal installation!<br/><br/>Please change permissions from 777 to 775 (or 755) and try again!</font></center>');
		}
	}

	$application =& kApplication::Instance();
	$application->Init();
	$application->Run();
	$application->Done();

	$end = getmicrotime();

	function getmicrotime()
	{
	    list($usec, $sec) = explode(" ", microtime());
	    return ((float)$usec + (float)$sec);
	}

	//update_memory_check_script();

	function update_memory_check_script() {
		$files = get_included_files();
		$script = '$files = Array('."\n";
		foreach ($files as $file_name) {
			$script .= "\t\t'".str_replace(FULL_PATH, '', $file_name)."',\n";
		}
		$script .= ");\n";
		echo "<pre>";
		echo $script;
		echo "</pre>";
	}
?>