source: branches/version-2_13-dev/data/class/pages/regist/LC_Page_Regist.php @ 23605

Revision 23605, 5.8 KB checked in by kimoto, 10 years ago (diff)

#2448 typo修正・ソース整形・ソースコメントの改善 for 2.13.3

Scrutinizer Auto-Fixes

This patch was automatically generated as part of the following inspection:
 https://scrutinizer-ci.com/g/nobuhiko/EC-CUBE/inspections/d8722894-69a6-4b1b-898d-43618035c60d

Enabled analysis tools:

  • PHP Analyzer
  • PHP PDepend
  • PHP Similarity Analyzer
  • PHP Change Tracking Analyzer
  • 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-2014 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
24require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
25
26/**
27 * 会員登録のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Regist extends LC_Page_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    public function init()
41    {
42        $this->skip_load_page_layout = true;
43        parent::init();
44    }
45
46    /**
47     * Page のプロセス.
48     *
49     * @return void
50     */
51    public function process()
52    {
53        parent::process();
54        $this->action();
55        $this->sendResponse();
56    }
57
58    /**
59     * Page のAction.
60     *
61     * @return void
62     */
63    public function action()
64    {
65        switch ($this->getMode()) {
66            case 'regist':
67            //-- 本登録完了のためにメールから接続した場合
68                //-- 入力チェック
69                $this->arrErr       = $this->lfCheckError($_GET);
70                if ($this->arrErr) SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, $this->arrErr['id']);
71
72                $registSecretKey    = $this->lfRegistData($_GET);   //本会員登録(フラグ変更)
73                $this->lfSendRegistMail($registSecretKey);          //本会員登録完了メール送信
74
75                SC_Response_Ex::sendRedirect('complete.php', array('ci' => SC_Helper_Customer_Ex::sfGetCustomerId($registSecretKey)));
76                break;
77            //-- それ以外のアクセスは無効とする
78            default:
79                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, '無効なアクセスです。');
80                break;
81        }
82
83    }
84
85    /**
86     * 仮会員を本会員にUpdateする
87     *
88     * @param mixed $array
89     * @access private
90     * @return string $arrRegist['secret_key'] 本登録ID
91     */
92    public function lfRegistData($array)
93    {
94        $objQuery                   = SC_Query_Ex::getSingletonInstance();
95        $arrRegist['secret_key']    = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); //本登録ID発行
96        $arrRegist['status']        = 2;
97        $arrRegist['update_date']   = 'CURRENT_TIMESTAMP';
98
99        $objQuery->begin();
100        $objQuery->update('dtb_customer', $arrRegist, 'secret_key = ? AND status = 1', array($array['id']));
101        $objQuery->commit();
102
103        return $arrRegist['secret_key'];
104    }
105
106    /**
107     * 入力エラーチェック
108     *
109     * @param mixed $array
110     * @access private
111     * @return array エラーの配列
112     */
113    public function lfCheckError($array)
114    {
115        $objErr     = new SC_CheckError_Ex($array);
116
117        if (preg_match("/^[[:alnum:]]+$/", $array['id'])) {
118            if (!is_numeric(SC_Helper_Customer_Ex::sfGetCustomerId($array['id'], true))) {
119                $objErr->arrErr['id'] = '※ 既に会員登録が完了しているか、無効なURLです。<br>';
120            }
121
122        } else {
123            $objErr->arrErr['id'] = '無効なURLです。メールに記載されている本会員登録用URLを再度ご確認ください。';
124        }
125
126        return $objErr->arrErr;
127    }
128
129    /**
130     * 正会員登録完了メール送信
131     *
132     * @param string $registSecretKey
133     * @access private
134     * @return void
135     */
136    public function lfSendRegistMail($registSecretKey)
137    {
138        $objQuery       = SC_Query_Ex::getSingletonInstance();
139        $objCustomer    = new SC_Customer_Ex();
140        $objHelperMail  = new SC_Helper_Mail_Ex();
141        $objHelperMail->setPage($this);
142        $CONF           = SC_Helper_DB_Ex::sfGetBasisData();
143
144        //-- 会員データを取得
145        $arrCustomer    = $objQuery->select('*', 'dtb_customer', 'secret_key = ?', array($registSecretKey));
146        $data           = $arrCustomer[0];
147        $objCustomer->setLogin($data['email']);
148
149        //-- メール送信
150        $objMailText    = new SC_SiteView_Ex();
151        $objMailText->setPage($this);
152        $objMailText->assign('CONF', $CONF);
153        $objMailText->assign('name01', $data['name01']);
154        $objMailText->assign('name02', $data['name02']);
155        $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl');
156        $subject = $objHelperMail->sfMakesubject('会員登録が完了しました。');
157        $objMail = new SC_SendMail_Ex();
158
159        $objMail->setItem(
160                            '',                         // 宛先
161                            $subject,                   // サブジェクト
162                            $toCustomerMail,            // 本文
163                            $CONF['email03'],           // 配送元アドレス
164                            $CONF['shop_name'],         // 配送元 名前
165                            $CONF['email03'],           // reply_to
166                            $CONF['email04'],           // return_path
167                            $CONF['email04']            // Errors_to
168        );
169        // 宛先の設定
170        $name = $data['name01'] . $data['name02'] .' 様';
171        $objMail->setTo($data['email'], $name);
172        $objMail->sendMail();
173    }
174}
Note: See TracBrowser for help on using the repository browser.