Esempio n. 1
0
 public function onRequestStart()
 {
     // TODO become more clueful:
     //   geo-ip
     //   user agent
     //   other?
     $reqval = Params::request($this->requestKey);
     if (isset($reqval)) {
         $lang = $reqval;
         setcookie($this->cookieKey, $lang, time() + EXPIRY_TIME);
     } else {
         $lang = Params::cookie($this->cookieKey);
     }
     if (!isset($lang)) {
         $lang = $this->defaultLang;
     }
     $this->set($lang);
 }
Esempio n. 2
0
 /**
  * contructor; generic initializations
  * do your initializations onInitialize()
  */
 public final function __construct($actionId = null)
 {
     $this->title = get_class($this);
     $this->onInitialize();
     $this->onRegisterActions();
     if (!isset($actionId)) {
         $actionId = Params::request(self::$ActionKey, null);
     }
     if (!isset($actionId)) {
         throw new RuntimeException("need an action");
     }
     $this->action = $this->getAction($actionId);
     if (!$this->action) {
         throw new RuntimeException("Unknown action {$actionId}");
     }
     $this->stage = Params::request(self::$StageKey, Stage::VIEW);
     if (Params::server('HTTPS') != 'on' && $this->action->requiresSSL) {
         // TODO implement secure checking
     }
 }