<?
define('ROOT','../..');
define('ROOT_PATH', realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))).'#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', dirname(__FILE__))));
require_once(ROOT.'/.config.php');
///////////////////////////


$js=array(
	JS.'/jquery.easing.js',
	JS.'/jquery.xform.js',
	JS.'/jquery.tip.js',
	'login.js',
);


///////////////////////////
$CACHE_ENABLED	= ($CONF->DEV_MODE==0 || ($CONF->DEV_MODE==1 && $CONF->DEV_CACHED==1) ? 1:0);
$CACHE_FILE		= CACHE.'/backend_JS_login.cache';


if($CACHE_ENABLED==false || !file_exists($CACHE_FILE)) {
	foreach($js as $file) $data.=@file_get_contents($file);
	require_once(LIBS_PATH.'/system/jsmin.php');
	$data=str_replace("\n"," ", JSMin::minify($data));

	$data=file_get_contents(JS.'/jquery.js').$data;
	file_put_contents($CACHE_FILE, $data);
} else {
	$data=file_get_contents($CACHE_FILE);
}


ob_start("ob_gzhandler");
header("Content-Type: text/javascript");
header("Cache-Control: Public");
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("1 year"))." GMT");
header("ETag: '".md5($data).'"');
echo $data;
?>