<?php

/**
 * Stub file to load clearFusionCMS.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS
 * @copyright Copyright (c) 2007 - 2012 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

// Load the core library
require_once 'system/libs/fusionLib.php';

try {
	// Initialise and run the application
	clearFusionCMS::getInstance()
		->init(new flConfigFile(FLAPPPATH . 'config/appConfig.php'))
		->getEventManager()->notify(new flEvent('system.preroute'));
	clearFusionCMS::getRouter()->loadRouteFiles(FLAPPPATH . 'routes/*Routes.php');
	clearFusionCMS::run();

} catch(flException $e) {
	if(file_exists(FLAPPPATH . 'config/appConfig.php'))
		flExceptionReporter::showException($e);
	else {
		$c = new cfInstallController(null, null);
		$c->dispatch('install');
	}
}
