2009-03-06 03:20:46 +00:00
|
|
|
<?php
|
2009-03-13 02:41:26 +00:00
|
|
|
//error_reporting(E_ALL|E_STRICT);
|
2009-03-06 03:20:46 +00:00
|
|
|
ini_set('display_errors', 1);
|
|
|
|
date_default_timezone_set('Asia/Shanghai');
|
|
|
|
|
|
|
|
// directory setup and class loading
|
|
|
|
set_include_path('.' . PATH_SEPARATOR . '../include/'
|
|
|
|
. PATH_SEPARATOR . '../application/models'
|
|
|
|
. PATH_SEPARATOR . '../application/default/controllers'
|
|
|
|
. PATH_SEPARATOR . get_include_path());
|
2010-03-10 06:56:28 +00:00
|
|
|
include "Zend/Loader.php";
|
|
|
|
Zend_Loader::registerAutoload();
|
2009-03-06 03:20:46 +00:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
$frontController->throwExceptions(true);
|
|
|
|
//$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());
|
|
|
|
/* add it in the config.ini
|
|
|
|
// setup the route for user tag spaces
|
|
|
|
$route = new Zend_Controller_Router_Route('data/tag/:key',
|
|
|
|
array('controller' => 'data',
|
|
|
|
'action' => 'tag'));
|
|
|
|
$frontController->getRouter()->addRoute('datatag', $route);
|
|
|
|
$route = new Zend_Controller_Router_Route_Static('knowledge/netkites',
|
|
|
|
array('controller' => 'netkites',
|
|
|
|
'action'=>'index'));
|
|
|
|
$frontController->getRouter()->addRoute('netkiteindex', $route);
|
|
|
|
$route = new Zend_Controller_Router_Route('knowledge/netkites/:action/*',
|
|
|
|
array('controller' => 'netkites' ));
|
|
|
|
$frontController->getRouter()->addRoute('netkite', $route);
|
|
|
|
$route=new Zend_Controller_Router_Route('data/:id',array('controller'=>"data","action"=>"view"),array('id'=>'\d+'));
|
|
|
|
$frontController->getRouter()->addRoute('dataid', $route);
|
|
|
|
$route=new Zend_Controller_Router_Route('data/xml/:uuid',array('controller'=>"data","action"=>"xml"),array('uuid'=>'[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}'));
|
|
|
|
$frontController->getRouter()->addRoute('dataxmluuid', $route);
|
|
|
|
$route=new Zend_Controller_Router_Route('data/:uuid',array('controller'=>"data","action"=>"view"),array('uuid'=>'[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}'));
|
|
|
|
$frontController->getRouter()->addRoute('datauuid', $route);
|
|
|
|
$route=new Zend_Controller_Router_Route('data/category/:code',array('controller'=>"data","action"=>"category"),array('code'=>'\d+'));
|
|
|
|
$frontController->getRouter()->addRoute('datacat', $route);
|
|
|
|
$route=new Zend_Controller_Router_Route('data/series/:id',array('controller'=>"data","action"=>"series"),array('id'=>'\d+'));
|
|
|
|
$frontController->getRouter()->addRoute('dataseries', $route);
|
|
|
|
*/
|
|
|
|
// run!
|
|
|
|
$frontController->dispatch();
|