/**
  * Initialises the session.
  */
 public function init()
 {
     parent::init();
     // handle style id
     if ($this->user->userID) {
         $this->styleID = $this->user->styleID;
     }
     if (($styleID = $this->getVar('styleID')) !== null) {
         $this->styleID = $styleID;
     }
 }
示例#2
0
 protected function process($argRestSampleRequest)
 {
     ApiLogger::trace("RestSample#process start : ");
     /*
      * 複数台のサーバがある場合は,セッション情報は DB に格納
      * かつセッションidはワンタイムにする
      */
     if (isset($_SESSION[Constant::$SESSION_ID])) {
         unset($_SESSION[Constant::$SESSION_ID]);
     }
     $cookieSession = new CookieSession();
     $cookieSession->setUserId("hoge");
     $cookieSession->setLang("ja");
     $cookieSession->setSessionToken("");
     $_SESSION[Constant::$SESSION_ID] = $cookieSession;
     ApiLogger::debug("Session installed.");
     $restSampleResponse = new RestSampleResponse();
     ApiLogger::debug("RestSample#process end");
     return $restSampleResponse;
 }
 /**
  * @see CookieSession::update()
  */
 public function update()
 {
     $this->updateSQL .= ", boardID = " . $this->boardID . ", threadID = " . $this->threadID;
     parent::update();
 }
<?php

/**
 * @author        Jimmy CHARLEBOIS
 * @date          11-04-2007
 * @brief         Exemple d'utilisation des cookies
 */
require_once 'c.system.php';
System::import('System.Context.HttpContext');
System::import('System.Session.CookieSession');
$context =& new HttpContext();
if ($context->hasParam('delete')) {
    System::export('-- Delete cookie --');
    System::export(CookieSession::delete('ValeurDeTest'));
}
//  Même s'il implémente l'interface ISession, on ne démarre pas CookieSession -> UnsupportedOperationException
//CookieSession::start();
System::export('-- Retrieve cookie value --');
$test_value = CookieSession::get('ValeurDeTest');
System::export($test_value);
System::export('-- Storing cookie value --');
System::export(CookieSession::set('ValeurDeTest', 'ma valeur qui va bien'));
echo '<a href="?delete=1">delete cookie</a>';