public final function start($sessionId = null)
 {
     if (!$this->started) {
         $this->register();
         if (isset($sessionId)) {
             session_id($sessionId);
             ini_set("session.use_cookies", 0);
             ini_set("session.use_only_cookies", 0);
             ini_set("session.use_trans_sid", 0);
             # Forgot this one!
             Logger::getInstance()->log("Starting session with provided id " . $sessionId, false, 'cyan');
         } elseif ($defaultSession = Tools::getInput($_COOKIE, 'PHPSESSID', 'varchar')) {
             Logger::getInstance()->log("Starting session with default cookie " . $defaultSession, false, 'cyan');
             session_id($defaultSession);
         } elseif (session_status() == PHP_SESSION_ACTIVE) {
             session_regenerate_id();
             Logger::getInstance()->log("Starting brand new session with id " . session_id(), false, 'cyan');
         }
         session_start();
         $this->started = true;
     }
 }
Exemple #2
0
 /**
  * Similar to fetching a value from $_REQUEST
  * @param $field
  * @param string $type
  * @param mixed $default
  * @param string $separator
  * @return mixed|null
  */
 public function input($field, $type = 'string', $default = null, $separator = ',')
 {
     // Check for array type
     $array = false;
     if (substr($type, -2) === '[]') {
         $arrtype = substr($type, 0, -2);
         $type = 'string';
         $array = true;
     }
     // Check post
     $value = Tools::getInput($this->getPost(), $field, $type);
     if ($value === null) {
         // Check get
         $value = Tools::getInput($this->getParameters(), $field, $type);
     }
     if ($value === null) {
         return $default;
     }
     // Check if array?
     if ($array) {
         $values = explode($separator, $value);
         $value = array();
         foreach ($values as $v) {
             if (Tools::checkInput($v, $arrtype)) {
                 $value[] = $v;
             }
         }
     }
     return $value;
 }
 public function getInlineForm()
 {
     $template = new Template('CatLab/Accounts/authenticators/password/inlineform.phpt');
     $template->set('action', URLBuilder::getURL($this->module->getRoutePath() . '/login/password', array('return' => $this->request->getUrl())));
     $template->set('email', Tools::getInput($_POST, 'email', 'varchar'));
     return $template;
 }