Source for file Token.php

Documentation is available at Token.php

  1. <?php
  2. /**
  3.  * Teeple2 - PHP5 Web Application Framework inspired by Seasar2
  4.  *
  5.  * PHP versions 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @package     teeple
  14.  * @author      Mitsutaka Sato <miztaka@gmail.com>
  15.  * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
  16.  */
  17.  
  18. /**
  19.  * Token処理を行うFilter
  20.  * TODO 未検証
  21.  *
  22.  * @package     teeple.filter
  23.  */
  24. {
  25.     
  26.     /**
  27.      * @var Teeple_Token 
  28.      */
  29.     private $token;
  30.     public function setComponent_Teeple_Token($c{
  31.         $this->token $c;
  32.     }
  33.  
  34.     /**
  35.      * @var Teeple_ActionChain 
  36.      */
  37.     private $actionChain;
  38.     public function setComponent_Teeple_ActionChain($c{
  39.         $this->actionChain = $c;
  40.     }
  41.     
  42.     /**
  43.      * @var Logger 
  44.      */
  45.     private $log;
  46.     
  47.     /**
  48.      * コンストラクタ
  49.      *
  50.      */
  51.     public function __construct({
  52.         parent::__construct();
  53.         $this->log = LoggerManager::getLogger(get_class($this));
  54.     }
  55.  
  56.     /**
  57.      * トークンの処理を行う
  58.      *
  59.      */
  60.     public function prefilter({
  61.  
  62.         $this->token->setSession($this->session);
  63.  
  64.         $attributes $this->getAttributes();
  65.         if (isset($attributes["name"])) {
  66.             $this->token->setName($attributes["name"]);
  67.         }
  68.  
  69.         $modeArray array();
  70.         if (isset($attributes["mode"])) {
  71.             $modeArray explode(","$attributes["mode"]);
  72.             foreach ($modeArray as $key => $value{
  73.                 $modeArray[$keytrim($value);
  74.             }
  75.         else {
  76.             $modeArray["build";
  77.         }
  78.  
  79.         foreach ($modeArray as $value{
  80.             switch ($value{
  81.             case 'check':
  82.                 if (!$this->token->check($this->request)) {
  83.                     $this->request->setFilterError('Token');
  84.                     $this->request->addErrorMessage('不正なアクセスです。');
  85.                     $this->log->warn('Tokenが不正です。');
  86.                 }
  87.                 break;
  88.             case 'remove':
  89.                 $this->token->remove();
  90.                 break;
  91.             case 'build':
  92.             default:
  93.                 $this->token->build();
  94.                 break;
  95.             }
  96.         }
  97.         return;
  98.     }
  99.     
  100.     public function postfilter({}
  101. }
  102. ?>

Documentation generated on Mon, 26 Apr 2010 09:00:00 +0900 by phpDocumentor 1.4.3