2011-09-20 07:07:19 +00:00
|
|
|
<?php
|
|
|
|
//error_reporting(E_ALL|E_STRICT);
|
|
|
|
ini_set('display_errors', 1);
|
|
|
|
date_default_timezone_set('Asia/Shanghai');
|
|
|
|
|
|
|
|
// directory setup and class loading
|
2013-12-22 02:05:23 +00:00
|
|
|
set_include_path('.' . PATH_SEPARATOR . '/var/www/westdc.westgis.ac.cn/include/'
|
2011-09-20 07:07:19 +00:00
|
|
|
. PATH_SEPARATOR . '../application/models'
|
2013-09-26 10:28:55 +00:00
|
|
|
. PATH_SEPARATOR . '../application/module'
|
2011-09-20 07:07:19 +00:00
|
|
|
. PATH_SEPARATOR . '../application/default/controllers'
|
2014-09-13 02:18:32 +00:00
|
|
|
. PATH_SEPARATOR . '/usr/share/php/libzend-framework-php'
|
2011-09-20 07:07:19 +00:00
|
|
|
. PATH_SEPARATOR . get_include_path());
|
|
|
|
//include "Zend/Loader.php";
|
|
|
|
//Zend_Loader::registerAutoload();
|
|
|
|
require_once 'Zend/Loader/Autoloader.php';
|
|
|
|
$loader = Zend_Loader_Autoloader::getInstance();
|
|
|
|
$loader->setFallbackAutoloader(true);
|
|
|
|
|
|
|
|
//$loader->registerNamespace('App_');
|
|
|
|
|
|
|
|
// load configuration
|
|
|
|
$config = new Zend_Config_Ini('../application/config.ini', 'general');
|
|
|
|
$registry = Zend_Registry::getInstance();
|
|
|
|
$registry->set('config', $config);
|
|
|
|
|
|
|
|
// setup application authentication
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$auth->setStorage(new Zend_Auth_Storage_Session('westdc'));
|
|
|
|
|
|
|
|
// setup database
|
|
|
|
$db = Zend_Db::factory($config->db);
|
|
|
|
Zend_Db_Table::setDefaultAdapter($db);
|
|
|
|
$registry->set('db',$db);
|
|
|
|
|
|
|
|
// setup controller
|
|
|
|
$frontController = Zend_Controller_Front::getInstance();
|
2013-05-07 01:41:39 +00:00
|
|
|
$frontController->throwExceptions(true);
|
2011-09-20 07:07:19 +00:00
|
|
|
//$frontController->setControllerDirectory('../application/controllers');
|
|
|
|
$frontController->setControllerDirectory(array(
|
|
|
|
'default' => '../application/default/controllers',
|
|
|
|
'admin' => '../application/admin/controllers'));
|
|
|
|
|
|
|
|
$frontController->registerPlugin(new CustomControllerAclManager($auth));
|
|
|
|
Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts'));
|
|
|
|
$router = new Zend_Controller_Router_Rewrite();
|
|
|
|
$router->addConfig($config, 'routes');
|
|
|
|
$frontController->getRouter()->addRoutes($router->getRoutes());
|
|
|
|
|
|
|
|
$plugin = new Zend_Controller_Plugin_ErrorHandler();
|
|
|
|
$plugin->setErrorHandlerModule('default')
|
|
|
|
->setErrorHandlerController('error')
|
|
|
|
->setErrorHandlerAction('error');
|
|
|
|
|
|
|
|
$frontController->registerPlugin($plugin);
|
|
|
|
|
2013-09-26 10:23:33 +00:00
|
|
|
$frontController->dispatch();
|