All pastes #519623 Raw Edit

Untitled

public php v1 · immutable
#519623 ·published 2007-05-29 18:35 UTC
rendered paste body
/** * SpotSec Framework Bootstrap */spl_autoload_register(array('Zend_Loader', 'autoload'));set_error_handler(array(new SpotSec_Error_Handler(), 'globalErrorHandler'));set_exception_handler(array(new SpotSec_Exception_Handler(), 'globalExceptionHandler'));SpotSec_Config_Framework::getInstance()->loadConfig('../application/configs/SpotSec.xml', 'staging');date_default_timezone_set('UTC');/** * Get basic configuration */$basicConfig = new Zend_Config_Xml('../application/configs/config.xml', 'staging');Zend_Registry::set('conf', $basicConfig);/** * Instantiate View object */$view = new Zend_View();$view->setScriptPath(array(	$basicConfig->paths->templates . '/' . $basicConfig->template->name, // todo: validate template exists and is valid	$basicConfig->paths->views));/** * Action helpers */Zend_Controller_Action_HelperBroker::addPrefix('Frontend_Controller_Action_Helper');$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();$viewRenderer->setView($view)			 ->setViewBasePathSpec($basicConfig->paths->views .'/views/:module')			 ->setViewScriptPathSpec(':controller/:action.:suffix')			 ->setViewScriptPathNoControllerSpec(':action.:suffix');Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);/** * Generate list of modules and controllers */try {	/**	 * Get controller paths and file suffixes	 */	$controllers = array();	$controllersPath = $basicConfig->paths->controllers;	$controllersSuffix = $basicConfig->controllers->fileSuffix;	$controllersFolder = new SpotSec_Folder($controllersPath);	/**	 * Default controller dir	 */	$controllers['default'] = $controllersPath;	/**	 * Push controllers into array	 */	foreach ($controllersFolder->getListing() as $controllerFolderItem) {		/**		 * Make sure folder item is a folder and does not start with a '.'		 */		if (substr($controllerFolderItem, -14) != $controllersSuffix && $controllerFolderItem{0} != '.') {			$controllers[str_replace($controllersSuffix, '', $controllerFolderItem)] = $controllersPath . '/' . $controllerFolderItem;		}	}} catch (Exception $e) {	/**	 * Note: Exception is thrown later at the front controller, don't throw it here	 */}/** * Set up front controller */$frontController = Zend_Controller_Front::getInstance();$frontController->setControllerDirectory($controllers)				->addModuleDirectory($controllersPath)				->registerPlugin(new SpotSec_Controller_Plugin_Acl($acl, $aclPlugin))				->registerPlugin(new SpotSec_Controller_Plugin_NoRoute('', 'httperror', 'code404'))				->throwExceptions(true);/** * Pass on parameters */$frontController->setParam('useDefaultControllerAlways', false)				->setParam('config', $basicConfig);/** * Dispatch front controller */$frontController->dispatch();