<?php
$gtfw_base_dir = @file_get_contents('config/gtfw_base_dir.def');
// does anyone know the regex for these two string replacements, so it can be executed once?
$gtfw_base_dir = str_replace('\\', '/', trim($gtfw_base_dir));
$gtfw_base_dir = preg_replace('/[\/]+$/', '', $gtfw_base_dir);

if (file_exists($gtfw_base_dir)) {
	define('GTFW_BASE_DIR', $gtfw_base_dir . '/');
	define('GTFW_APP_DIR', str_replace('\\', '/', dirname(__FILE__)) . '/');
	require dirname(__FILE__).'/main/lib/cas/gtCas.class.php';

   //GtCas::init();
	define('GTFW_FUNCT_DIR', GTFW_APP_DIR.'main/function');
	require_once GTFW_FUNCT_DIR.'/additional.php';

	$gtfw_init_dir = GTFW_BASE_DIR . 'main/init/' . basename(__FILE__, '.php') . '/*.php';

	foreach (glob($gtfw_init_dir) as $value) {
		require_once $value;
	}
} else {
	echo 'Fatal: Cannot find GTFW base!';
}
?>
