function &createSession($create = TRUE) { if (ServletContext::validClass($this->context)) { $response =& $this->context->getServletResponse(); $session =& $this->context->getServletSession(); if (IHttpResponse::validClass($response) && IHttpSession::validClass($session)) { $sessionid = ''; $cookie = $this->getCookie('_JPHPSESSIONID'); if (!isset($cookie)) { $sessionid = $this->getParameter('_JPHPSESSIONID'); } else { $sessionid = $cookie->getValue(); } if (strlen(trim($sessionid)) < 8) { if ($create == FALSE) { return NULL; } else { $sessionid = md5(StringBuffer::generateKey(16)); } } $session->setSessionID($sessionid); $session->initialize(); $cookie = new Cookie('_JPHPSESSIONID', $sessionid); if ($session->getMaxInactiveInterval() > 0) { $cookie->setMaxAge(time() + $session->getMaxInactiveInterval()); } else { $cookie->setMaxAge(0); } $response->addCookie($cookie); return $session; } } return NULL; }
function BasicAuthenticator($name, $pattern, &$request, &$response) { $this->realm_name = $name; $this->pattern = $pattern; if (IHttpRequest::validClass($request) && IHttpResponse::validClass($response)) { $this->request =& $request; $this->response =& $response; } }
function initResponse() { $class = trim($this->config->getResponseManager()); if ($class === '') { $class = $this->default_response_manager; } $this->response = JPHP::loadClass($class, array(&$this)); if (IHttpResponse::validClass($this->response)) { $names = $this->config->getResponseManagerPropertyNames(); while ($names->hasMoreElements()) { $name = $names->nextElement(); $value = $this->config->getResponseManagerProperty($name); eval('$this->response->set' . ucfirst($name) . '("' . $value . '");'); } } }