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

Revision 21767, 3.0 KB checked in by shutta, 9 years ago (diff)

#1296 SC_* のコンストラクタの拡張が無視される
コンストラクタ名を、PHP4の記法(クラス名と同名の関数名)から、PHP5以降で標準的なconstructに変更。

  • 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-2011 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    function __construct() {
28        // 前ページでの登録成功判定を引き継ぐ
29        $_SESSION['site']['pre_regist_success'] =
30                isset($_SESSION['site']['regist_success'])
31                    ? $_SESSION['site']['regist_success'] : '';
32
33        $_SESSION['site']['regist_success'] = false;
34        $_SESSION['site']['pre_page'] =
35                isset($_SESSION['site']['now_page'])
36                    ? $_SESSION['site']['now_page'] : '';
37
38        $_SESSION['site']['now_page'] = $_SERVER['SCRIPT_NAME'];
39    }
40
41    /* 前ページが正当であるかの判定 */
42    function isPrePage() {
43        if ($_SESSION['site']['pre_page'] != '' && $_SESSION['site']['now_page'] != '') {
44            if ($_SESSION['site']['pre_regist_success'] || $_SESSION['site']['pre_page'] == $_SESSION['site']['now_page']) {
45                return true;
46            }
47        }
48        return false;
49    }
50
51    function setNowPage($path) {
52        $_SESSION['site']['now_page'] = $path;
53    }
54
55    /* 値の取得 */
56    function getValue($keyname) {
57        return $_SESSION['site'][$keyname];
58    }
59
60    /* ユニークIDの取得 */
61    function getUniqId() {
62        // ユニークIDがセットされていない場合はセットする。
63        if (!isset($_SESSION['site']['uniqid']) || $_SESSION['site']['uniqid'] == '') {
64            $this->setUniqId();
65        }
66        return $_SESSION['site']['uniqid'];
67    }
68
69    /* ユニークIDのセット */
70    function setUniqId() {
71        // 予測されないようにランダム文字列を付与する。
72        $_SESSION['site']['uniqid'] = SC_Utils_Ex::sfGetUniqRandomId();
73    }
74
75    /* ユニークIDのチェック */
76    function checkUniqId() {
77        if (!empty($_POST['uniqid'])) {
78            if ($_POST['uniqid'] != $_SESSION['site']['uniqid']) {
79                return false;
80            }
81        }
82        return true;
83    }
84
85    /* ユニークIDの解除 */
86    function unsetUniqId() {
87        $_SESSION['site']['uniqid'] = '';
88    }
89
90    /* 登録成功を記録 */
91    function setRegistFlag() {
92        $_SESSION['site']['regist_success'] = true;
93    }
94}
Note: See TracBrowser for help on using the repository browser.