Esempio n. 1
0
 */
//try {
//    date_default_timezone_set('America/Toronto');
date_default_timezone_set('Asia/Ho_Chi_Minh');
set_include_path('.' . PATH_SEPARATOR . 'libs' . PATH_SEPARATOR . get_include_path());
require_once 'Vi/Constant.php';
require_once 'Zend/Loader.php';
require_once 'Vi/Registry.php';
require_once 'Vi/Db.php';
require_once 'Vi/Layout.php';
require_once 'Vi/Initializer.php';
// Set up autoload.
//Zend_Loader::registerAutoload();
/**  
 * TODO TEST LINUX FILE
 */
umask(0);
//ini_set('magic_quotes_gpc', 'Off');
// Change 'currentMode' in config.php to Vi_Constant::PRODUCT_MODE under production environment
$initializer = new Vi_Initializer();
$initializer->run();
// Prepare the front controller.
$frontController = Vi_Controller_Front::getInstance();
// Dispatch the request using the front controller.
$frontController->dispatch();
//} catch (Exception $e) {
//    /**
//     * TODO Redirect to error page
//     */
//    include_once 'error.php';
//}
Esempio n. 2
0
 /**
  * Initialize routes
  * 
  * @return void
  */
 public function initRoutes()
 {
     /**
      * @TODO Auto load setup routes from module directorys
      */
     /**
      * Setup routes for content module.
      * Skip for admin application.
      */
     if (Vi_Registry::get('APP_NAME') == 'admin') {
         return;
     }
     $router = Vi_Controller_Front::getInstance()->getRouter();
     if (true == Vi_Initializer::$_config['usingOneLanguage']) {
         $route = new Zend_Controller_Router_Route_Regex('page/(.*)', array('module' => 'scontent', 'controller' => 'index', 'action' => 'index'), array(1 => 'url'));
         $route2 = new Zend_Controller_Router_Route_Regex('contact-us.html', array('module' => 'contact', 'controller' => 'index', 'action' => 'index'), array());
         $route3 = new Zend_Controller_Router_Route_Regex('register.html', array('module' => 'user', 'controller' => 'index', 'action' => 'register'), array());
         $route4 = new Zend_Controller_Router_Route_Regex('restaurant-owner-register.html', array('module' => 'user', 'controller' => 'index', 'action' => 'restaurant-register'), array());
         $route5 = new Zend_Controller_Router_Route_Regex('restaurant/([0-9]*)/(.*)', array('module' => 'restaurant', 'controller' => 'meal', 'action' => 'index'), array(1 => 'id', 2 => 'friendlyPart'));
         $route6 = new Zend_Controller_Router_Route_Regex('other-restaurant/([0-9]*)/(.*)', array('module' => 'restaurant', 'controller' => 'meal', 'action' => 'other-restaurant'), array(1 => 'id', 2 => 'friendlyPart'));
         $route7 = new Zend_Controller_Router_Route_Regex('cart/([0-9]*)/([0-9]*)', array('module' => 'restaurant', 'controller' => 'cart', 'action' => 'index'), array(1 => 'res_id', 2 => 'meal_id'));
         $route8 = new Zend_Controller_Router_Route_Regex('cancel_res/([0-9]*)/([0-9]*)', array('module' => 'restaurant', 'controller' => 'meal', 'action' => 'index'), array(1 => 'id', 2 => 'res_id_ses'));
         $route9 = new Zend_Controller_Router_Route_Regex('mark_restaurant/(.*)', array('module' => 'restaurant', 'controller' => 'index', 'action' => 'index'), array(1 => 'mark'));
         $route10 = new Zend_Controller_Router_Route_Regex('find_restaurant/(.*)', array('module' => 'restaurant', 'controller' => 'index', 'action' => 'index'), array(1 => 'find'));
     } else {
         //            $route  = new Zend_Controller_Router_Route_Regex(
         //                                                     'content/([\w_-]*)(.*)',
         //                                                     array(
         //                                                        'module'     => 'content',
         //                                                        'controller' => 'index',
         //                                                        'action'     => 'index'
         //                                                     ),
         //                                                     array(1=>'langCode', 2 =>'friendlyUrl')
         //                                                );
     }
     $router->addRoute('content', $route);
     $router->addRoute('contact', $route2);
     $router->addRoute('register', $route3);
     $router->addRoute('restaurant-register', $route4);
     $router->addRoute('restaurant', $route5);
     $router->addRoute('other-restaurant', $route6);
     $router->addRoute('cart', $route7);
     $router->addRoute('cancel_res', $route8);
     $router->addRoute('mark_restaurant', $route9);
     $router->addRoute('find_restaurant', $route10);
 }
Esempio n. 3
0
 /**
  * get router object
  * @return Zend_Controller_Router_Abstract
  */
 public static function getRouter()
 {
     return Vi_Controller_Front::getInstance()->getRouter();
 }