Пример #1
0
 /**
  * Open a PHP session
  */
 protected function open()
 {
     session_name($this->sessionName);
     if ($this->hasBeenTouched) {
         $cacheLimiter = ini_get('session.cache_limiter');
         ini_set('session.use_cookies', false);
         ini_set('session.use_only_cookies', false);
         ini_set('session.cache_limiter', null);
     }
     $cookie = new Cookie('bogus');
     session_set_cookie_params(0, $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), true);
     session_start();
     if ($this->hasBeenTouched) {
         ini_set('session.use_cookies', true);
         ini_set('session.use_only_cookies', true);
         /** @noinspection PhpUndefinedVariableInspection */
         ini_set('session.cache_limiter', $cacheLimiter);
     }
 }
Пример #2
0
 /**
  * AnnouncementCookie constructor
  */
 public function __construct()
 {
     parent::__construct('icingaweb2-announcements');
     $this->setExpire(2147483648.0);
     if (isset($_COOKIE['icingaweb2-announcements'])) {
         $cookie = json_decode($_COOKIE['icingaweb2-announcements'], true);
         if ($cookie !== null) {
             if (isset($cookie['acknowledged'])) {
                 $this->setAcknowledged($cookie['acknowledged']);
             }
             if (isset($cookie['etag'])) {
                 $this->setEtag($cookie['etag']);
             }
             if (isset($cookie['next'])) {
                 $this->setNextActive($cookie['next']);
             }
         }
     }
 }
Пример #3
0
 /**
  * Add a cookie to the set
  *
  * If a cookie with the same name already exists, the cookie will be overridden.
  *
  * @param   Cookie  $cookie The cookie to add
  *
  * @return  $this
  */
 public function add(Cookie $cookie)
 {
     $this->cookies[$cookie->getName()] = $cookie;
     return $this;
 }
Пример #4
0
 /**
  * Detect whether cookies are enabled
  *
  * @return bool
  */
 public function hasCookieSupport()
 {
     $cookie = new Cookie($this);
     return $cookie->isSupported();
 }