init() public method

After load the session, the application parse the current URI and starts the context from the request parameters.
public init ( ) : void
return void
Exemplo n.º 1
0
 public function indexAction()
 {
     global $controller;
     $controller = $this;
     require_once $GLOBALS['g_campsiteDir'] . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'campsite_constants.php';
     require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php';
     $local_path = dirname(__FILE__) . '/include';
     set_include_path($local_path . PATH_SEPARATOR . get_include_path());
     require_once CS_PATH_INCLUDES . DIR_SEP . 'campsite_init.php';
     // initializes the campsite object
     $campsite = new CampSite();
     // loads site configuration settings
     $campsite->loadConfiguration(CS_PATH_CONFIG . DIR_SEP . 'configuration.php');
     // starts the session
     $campsite->initSession();
     // initiates the context
     $campsite->init();
     // dispatches campsite
     $campsite->dispatch();
     if (APPLICATION_ENV !== 'development' || APPLICATION_ENV !== 'dev') {
         set_error_handler(create_function('', 'return true;'));
     }
     // renders the site
     $campsite->render();
     // triggers an event after displaying
     $campsite->event('afterRender');
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     global $controller;
     $controller = $this;
     require_once $GLOBALS['g_campsiteDir'] . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'campsite_constants.php';
     require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php';
     $local_path = dirname(__FILE__) . '/include';
     set_include_path($local_path . PATH_SEPARATOR . get_include_path());
     require_once CS_PATH_INCLUDES . DIR_SEP . 'campsite_init.php';
     if (file_exists(CS_PATH_SITE . DIR_SEP . 'reset_cache')) {
         CampCache::singleton()->clear('user');
         @unlink(CS_PATH_SITE . DIR_SEP . 'reset_cache');
     }
     // initializes the campsite object
     $campsite = new CampSite();
     // loads site configuration settings
     $campsite->loadConfiguration(CS_PATH_CONFIG . DIR_SEP . 'configuration.php');
     // starts the session
     $campsite->initSession();
     if (file_exists(CS_PATH_SITE . DIR_SEP . 'conf' . DIR_SEP . 'upgrading.php')) {
         $this->upgrade();
         exit(0);
     }
     // initiates the context
     $campsite->init();
     // dispatches campsite
     $campsite->dispatch();
     // triggers an event before render the page.
     // looks for preview language if any.
     $previewLang = $campsite->event('beforeRender');
     if (!is_null($previewLang)) {
         require_once $GLOBALS['g_campsiteDir'] . '/template_engine/classes/SyntaxError.php';
         set_error_handler('templateErrorHandler');
         // loads translations strings in the proper language for the error messages display
         camp_load_translation_strings('preview', $previewLang);
     } else {
         set_error_handler(create_function('', 'return true;'));
     }
     if ($this->_request->getParam('logout') == 'true') {
         $this->_redirect('/auth/logout/?url=' . urlencode($this->getRequest()->getPathInfo()));
     }
     // renders the site
     $campsite->render();
     // triggers an event after displaying
     $campsite->event('afterRender');
 }
Exemplo n.º 3
0
$start2 = microtime(true);
// loads site configuration settings
$campsite->loadConfiguration(CS_PATH_CONFIG.DIR_SEP.'configuration.php');

$start3 = microtime(true);
// starts the session
$campsite->initSession();

if (file_exists(CS_PATH_SITE.DIR_SEP.'upgrade.php')) {
    camp_upgrade();
    exit(0);
}

$start4 = microtime(true);
// initiates the context
$campsite->init();

$start5 = microtime(true);
// dispatches campsite
$campsite->dispatch();

$start6 = microtime(true);
// triggers an event before render the page.
// looks for preview language if any.
$previewLang = $campsite->event('beforeRender');
if (!is_null($previewLang)) {
    require_once($GLOBALS['g_campsiteDir'].'/template_engine/classes/SyntaxError.php');
    set_error_handler('templateErrorHandler');

    // loads translations strings in the proper language for the error messages display
    camp_load_translation_strings('preview', $previewLang);