<?php

$start = getmicrotime();

define('ADMIN', 1);
define('FULL_PATH', realpath(dirname(__FILE__).'/..') );
define('APPLICATION_CLASS', 'MyApplication');
include_once(FULL_PATH.'/kernel/kernel4/startup.php');

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

$end = getmicrotime();

if ($application->isDebugMode() && !dbg_ConstOn('DBG_SKIP_REPORTING')) {
	echo '	<br><br>
			<style> .dbg_flat_table TD { font-family: arial,verdana; font-size: 9pt; } </style>
			<table class="dbg_flat_table">
				<tr>
					<td>Memory used:</td>
					<td>'.round(memory_get_usage()/1024/1024, 1).' MB ('.memory_get_usage().')</td>
				</tr>
				<tr>
					<td>Time used:</td>
					<td>'.round(($end - $start), 5).' sec</td>
				</tr>
			</table>';
}

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>";
}

?>