<?php
/**
 *  Logout.php
 *
 *  @author     {$author}
 *  @package    Secioss
 *  @version    $Id: skel.action.php,v 1.10 2006/11/06 14:31:24 cocoitiban Exp $
 */

/**
 *  logoutフォームの実装
 *
 *  @author     {$author}
 *  @access     public
 *  @package    Secioss
 */
class Secioss_Form_Logout extends Secioss_ActionForm
{
    /** @var    bool    バリデータにプラグインを使うフラグ */
    var $use_validator_plugin = true;

    /**
     *  @access private
     *  @var    array   フォーム値定義
     */
    var $form = array(
    );
}

/**
 *  logoutアクションの実装
 *
 *  @author     {$author}
 *  @access     public
 *  @package    Secioss
 */
class Secioss_Action_Logout extends Secioss_ActionClass
{
    function authenticate()
    {
    }

    /**
     *  logoutアクションの前処理
     *
     *  @access public
     *  @return string      遷移名(正常終了ならnull, 処理終了ならfalse)
     */
    function prepare()
    {
        return null;
    }

    /**
     *  logoutアクションの実装
     *
     *  @access public
     *  @return string  遷移名
     */
    function perform()
    {
        $conf = $this->config->get('secioss');

        $authtype = $this->session->get('authtype');

        $this->session->destroy();

        if ($authtype == 'sso') {
            $url = '/sso/logout.cgi';
            if (isset($conf['singlelogout']) && $conf['singlelogout']) {
                $url = $conf['singlelogout'];
            }
        } else {
            $url = 'index.php';
        }

        $this->redirect($url);
    }
}
?>
