<?php
/*
* ClientStartup.php is copyright � 2010. EarthWalk Software.
* Licensed under the Academic Free License version 3.0.
* Refer to the file named License provided with the source.
*/
/**
* ClientStartup
*
* @author Jay Wheeler.
* @version 1.0
* @copyright � 2010. EarthWalk Software.
* @license refer to License file provided with the source.
* @package IGSGateway.
* @subpackage ClientStartup.
*/
class ClientStartup
{
/**
* production configuration section
*/
const CONFIG_PRODUCTION = 1;
/**
* development configuration section
*/
const CONFIG_DEVELOPMENT = 0;
// ************************************************************************
/**
* Setup.
*
* Set up the client environment.
* @param string $xmlName The name of the XML configuration file
* @param integer $section 1 = production, 0 = development
* @param string $zendPath The path to the ZendFramework library.
* @return boolean true = successful startup, false = not successful
*/
public static function Setup($xmlName, $section=self::CONFIG_PRODUCTION, $zendPath=null)
{
require_once('Autoload.php');
Autoload::AutosetRoot();
if ($zendPath)
{
Autoload::ZendRoot($zendPath);
}
// **********************************************************************************
require_once ('IGSConfig.php');
if (! IGSConfig::load(sprintf('%s', $xmlName), ($section == self::CONFIG_PRODUCTION) ? 'production' : 'development'))
{
print sprintf('Unable to open %s: %s', $xmlName, IGSConfig::error()) . "\n";
return false;
}
date_default_timezone_set(IGSConfig::xml()->timezone);
Autoload::ZendRoot(IGSConfig::xml()->paths->zendroot);
// **********************************************************************************
set_include_path(get_include_path() . PATH_SEPARATOR . IGSConfig::xml()->paths->installroot);
set_include_path(get_include_path() . PATH_SEPARATOR . IGSConfig::xml()->paths->zendroot);
return true;
}
}