source: branches/version-2_12-dev/data/class/SC_SiteSession.php @ 22567

Revision 22567, 3.1 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24/* カートセッション管理クラス */
25class SC_SiteSession
26{
27    /* コンストラクタ */
28    function __construct()
29    {
30        // 前ページでの登録成功判定を引き継ぐ
31        $_SESSION['site']['pre_regist_success'] =
32                isset($_SESSION['site']['regist_success'])
33                    ? $_SESSION['site']['regist_success'] : '';
34
35        $_SESSION['site']['regist_success'] = false;
36        $_SESSION['site']['pre_page'] =
37                isset($_SESSION['site']['now_page'])
38                    ? $_SESSION['site']['now_page'] : '';
39
40        $_SESSION['site']['now_page'] = $_SERVER['SCRIPT_NAME'];
41    }
42
43    /* 前ページが正当であるかの判定 */
44    function isPrePage()
45    {
46        if ($_SESSION['site']['pre_page'] != '' && $_SESSION['site']['now_page'] != '') {
47            if ($_SESSION['site']['pre_regist_success'] || $_SESSION['site']['pre_page'] == $_SESSION['site']['now_page']) {
48                return true;
49            }
50        }
51        return false;
52    }
53
54    function setNowPage($path)
55    {
56        $_SESSION['site']['now_page'] = $path;
57    }
58
59    /* 値の取得 */
60    function getValue($keyname)
61    {
62        return $_SESSION['site'][$keyname];
63    }
64
65    /* ユニークIDの取得 */
66    function getUniqId()
67    {
68        // ユニークIDがセットされていない場合はセットする。
69        if (!isset($_SESSION['site']['uniqid']) || $_SESSION['site']['uniqid'] == '') {
70            $this->setUniqId();
71        }
72        return $_SESSION['site']['uniqid'];
73    }
74
75    /* ユニークIDのセット */
76    function setUniqId()
77    {
78        // 予測されないようにランダム文字列を付与する。
79        $_SESSION['site']['uniqid'] = SC_Utils_Ex::sfGetUniqRandomId();
80    }
81
82    /* ユニークIDのチェック */
83    function checkUniqId()
84    {
85        if (!empty($_POST['uniqid'])) {
86            if ($_POST['uniqid'] != $_SESSION['site']['uniqid']) {
87                return false;
88            }
89        }
90        return true;
91    }
92
93    /* ユニークIDの解除 */
94    function unsetUniqId()
95    {
96        $_SESSION['site']['uniqid'] = '';
97    }
98
99    /* 登録成功を記録 */
100    function setRegistFlag()
101    {
102        $_SESSION['site']['regist_success'] = true;
103    }
104}
Note: See TracBrowser for help on using the repository browser.