Example #1
0
 public static function setFrontController()
 {
     self::$front = Zend_Controller_Front::getInstance();
     self::$front->registerPlugin(new Monkeys_Controller_Plugin_Auth(self::$acl));
     self::$front->addModuleDirectory(APP_DIR . '/modules');
     $router = self::$front->getRouter();
     if (self::$config->subdomain->enabled) {
         if (self::$config->subdomain->use_www) {
             $reqs = array('username' => '([^w]|w[^w][^w]|ww[^w]|www.+).*');
         } else {
             $reqs = array();
         }
         $hostNameRoute = new Zend_Controller_Router_Route_Hostname(':username.' . self::$config->subdomain->hostname, array('module' => 'default', 'controller' => 'identity', 'action' => 'id'), $reqs);
         $router->addRoute('hostNameRoute', $hostNameRoute);
     }
     $route = new Zend_Controller_Router_Route('identity/:userid', array('module' => 'default', 'controller' => 'identity', 'action' => 'id'), array('userid' => '[\\w-]*'));
     $router->addRoute('identityRoute', $route);
     $route = new Zend_Controller_Router_Route('news/:id', array('module' => 'news', 'controller' => 'view', 'action' => 'index'), array('id' => '\\d+'));
     $router->addRoute('articleView', $route);
 }