Example #1
0
 /**
  * Initializes the application with system settings. This method is declared 
  * final and cannot be overriden.
  * 
  * @method  init
  * @return  void
  */
 public final function init()
 {
     $this->routes = new RouteCollection();
     Environment::setRootPath($this->rootPath);
     Environment::setControllerPath($this->rootPath);
     Environment::setExecutionTime($this->config->get('environment.executionTime', 30));
     Environment::setCulture(new CultureInfo($this->config->get('environment.locale', 'en')));
     Environment::setDateTimeFormat($this->config->get('environment.dateTimeFormat', 'yyyy-MM-dd HH:mm:ss'));
     Environment::setTimezone($this->config->get('environment.timezone'));
     Environment::setNamespaces($this->config->get('namespaces', array()));
     Environment::setDefaultConnectionString($this->config->get('connectionStrings.default'));
     $request = new HttpRequest();
     $response = new HttpResponse();
     $session = Object::getInstance($this->config->get('session.handler', 'System.Web.Session.FileSystem'), array($request, $response));
     $session->setName($this->config->get('session.name', 'PHPSESSID'));
     $session->setExpires($this->config->get('session.expires', 0));
     $session->setPath($this->config->get('session.path', '/'));
     $session->setDomain($this->config->get('session.domain', ''));
     $session->isSecure($this->config->get('session.secure', false));
     $session->isHttpOnly($this->config->get('session.httpOnly', true));
     $this->httpContext = new HttpContext($request, $response, $session);
     Authentication::setCookieName($this->config->get('formsAuthentication.cookieName', 'PHPXAUTH'));
     Authentication::setHashAlgorithm($this->config->get('formsAuthentication.hashAlgorithm'));
     Authentication::setCipher($this->config->get('formsAuthentication.cipher'));
     Authentication::setEncryptionKey($this->config->get('formsAuthentication.encryptionKey'));
     Authentication::setValidationKey($this->config->get('formsAuthentication.validationKey'));
     $this->httpContext->getSession()->open();
 }