Source for file LC_Page_Mypage_Change.php

Documentation is available at LC_Page_Mypage_Change.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2007 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. // {{{ requires
  25. require_once(CLASS_PATH "pages/LC_Page.php");
  26.  
  27. if (file_exists(MODULE_PATH "mdl_gmopg/inc/function.php")) {
  28.     require_once(MODULE_PATH "mdl_gmopg/inc/function.php");
  29. }
  30.  
  31. /**
  32.  * 登録内容変更 のページクラス.
  33.  *
  34.  * @package Page
  35.  * @author LOCKON CO.,LTD.
  36.  * @version $Id: LC_Page_Mypage_Change.php 17927 2009-03-25 07:18:11Z Seasoft $
  37.  */
  38. class LC_Page_Mypage_Change extends LC_Page {
  39.  
  40.  
  41.     // }}}
  42.     // {{{ functions
  43.  
  44.     /**
  45.      * Page を初期化する.
  46.      *
  47.      * @return void 
  48.      */
  49.     function init({
  50.         parent::init();
  51.         $this->tpl_mainpage = TEMPLATE_DIR 'mypage/change.tpl';
  52.         $this->tpl_title = 'MYページ';
  53.         $this->tpl_subtitle '会員登録内容変更(入力ページ)';
  54.         $this->tpl_navi TEMPLATE_DIR 'mypage/navi.tpl';
  55.         $this->tpl_mainno = 'mypage';
  56.         $this->tpl_mypageno 'change';
  57.         $this->tpl_column_num = 1;
  58.  
  59.         $masterData new SC_DB_MasterData_Ex();
  60.         $this->arrReminder $masterData->getMasterData("mtb_reminder");
  61.         $this->arrPref $masterData->getMasterData("mtb_pref",
  62.                                  array("pref_id""pref_name""rank"));
  63.         $this->arrJob $masterData->getMasterData("mtb_job");
  64.         $this->arrMAILMAGATYPE $masterData->getMasterData("mtb_mail_magazine_type");
  65.         $this->arrSex $masterData->getMasterData("mtb_sex");
  66.         $this->allowClientCache();
  67.  
  68.     }
  69.  
  70.     /**
  71.      * Page のプロセス.
  72.      *
  73.      * @return void 
  74.      */
  75.     function process({
  76.         $objView new SC_SiteView();
  77.         $this->objQuery new SC_Query();
  78.         $this->objCustomer new SC_Customer();
  79.         $this->objFormParam new SC_FormParam();
  80.  
  81.         // レイアウトデザインを取得
  82.         $objLayout new SC_Helper_PageLayout_Ex();
  83.         $objLayout->sfGetPageLayout($thisfalse"mypage/index.php");
  84.  
  85.         // 生年月日選択肢の取得
  86.         $objDate new SC_Date(START_BIRTH_YEARdate("Y",strtotime("now")));
  87.         $this->arrYear $objDate->getYear(''1950'');
  88.         $this->arrMonth $objDate->getMonth(true);
  89.         $this->arrDay $objDate->getDay(true);
  90.  
  91.         // ログインチェック
  92.         if (!$this->objCustomer->isLoginSuccess()){
  93.             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  94.         }else {
  95.             //マイページトップ顧客情報表示用
  96.             $this->CustomerName1 $this->objCustomer->getvalue('name01');
  97.             $this->CustomerName2 $this->objCustomer->getvalue('name02');
  98.             $this->CustomerPoint $this->objCustomer->getvalue('point');
  99.         }
  100.  
  101.         //---- 登録用カラム配列
  102.         $arrRegistColumn array(
  103.                                  array(  "column" => "name01",      "convert" => "aKV" ),
  104.                                  array(  "column" => "name02",      "convert" => "aKV" ),
  105.                                  array(  "column" => "kana01",      "convert" => "CKV" ),
  106.                                  array(  "column" => "kana02",      "convert" => "CKV" ),
  107.                                  array(  "column" => "zip01",       "convert" => "n" ),
  108.                                  array(  "column" => "zip02",       "convert" => "n" ),
  109.                                  array(  "column" => "pref",        "convert" => "n" ),
  110.                                  array(  "column" => "addr01",      "convert" => "aKV" ),
  111.                                  array(  "column" => "addr02",      "convert" => "aKV" ),
  112.                                  array(  "column" => "email",       "convert" => "a" ),
  113.                                  array(  "column" => "email_mobile""convert" => "a" ),
  114.                                  array(  "column" => "tel01",       "convert" => "n" ),
  115.                                  array(  "column" => "tel02",       "convert" => "n" ),
  116.                                  array(  "column" => "tel03",       "convert" => "n" ),
  117.                                  array(  "column" => "fax01",       "convert" => "n" ),
  118.                                  array(  "column" => "fax02",       "convert" => "n" ),
  119.                                  array(  "column" => "fax03",       "convert" => "n" ),
  120.                                  array(  "column" => "sex",         "convert" => "n" ),
  121.                                  array(  "column" => "job",         "convert" => "n" ),
  122.                                  array(  "column" => "birth",       "convert" => "n" ),
  123.                                  array(  "column" => "password",    "convert" => "an" ),
  124.                                  array(  "column" => "reminder",    "convert" => "n" ),
  125.                                  array(  "column" => "reminder_answer""convert" => "aKV" ),
  126.                                  array(  "column" => "mailmaga_flg""convert" => "n" )
  127.                                  );
  128.  
  129.         //メールアドレス種別
  130.         $arrMailType array("email" => true"email_mobile" => true);
  131.  
  132.         if (!isset($_POST['mode'])) $_POST['mode'"";
  133.  
  134.         switch ($_POST['mode']){
  135.  
  136.         case 'confirm':
  137.  
  138.             //エラーなしでかつメールアドレスが重複していない場合
  139.             if ($this->checkErrorTotal($arrRegistColumn$arrMailType)) {
  140.  
  141.                 //確認ページへ
  142.                 $this->tpl_mainpage = TEMPLATE_DIR 'mypage/change_confirm.tpl';
  143.                 $this->tpl_subtitle '会員登録内容変更(確認ページ)';
  144.                 $passlen strlen($this->arrForm['password']);
  145.                 $this->passlen $this->lfPassLen($passlen);
  146.             else {
  147.                 $this->lfFormReturn($this->arrForm,$this);
  148.             }
  149.  
  150.             break;
  151.  
  152.         case 'return':
  153.             $this->arrForm $_POST;
  154.             $this->lfFormReturn($this->arrForm,$this);
  155.             break;
  156.  
  157.         case 'gmo_oneclick':
  158.             sfGMOMypageEdit();
  159.             $this->arrForm $this->lfGetCustomerData();
  160.             $this->arrForm['password'DEFAULT_PASSWORD;
  161.             $this->arrForm['password02'DEFAULT_PASSWORD;
  162.             break;
  163.         case 'complete':
  164.             //エラーなしでかつメールアドレスが重複していない場合
  165.             if ($this->checkErrorTotal($arrRegistColumn$arrMailType)) {
  166.                 $this->arrForm['customer_id'$this->objCustomer->getValue('customer_id');
  167.                 //-- 編集登録
  168.                 $objDb new SC_Helper_DB_Ex();
  169.                 $objDb->sfEditCustomerData($this->arrForm$arrRegistColumn);
  170.                 //セッション情報を最新の状態に更新する
  171.                 $this->objCustomer->updateSession();
  172.  
  173.                 // Do楽SNS連携モジュールユーザ情報更新処理
  174.                 if (function_exists('sfUpdateSourakuSNSUserInfo')) {
  175.                     sfUpdateSourakuSNSUserInfo();
  176.                 }
  177.  
  178.                 //完了ページへ
  179.                 $this->sendRedirect($this->getLocation("./change_complete.php"));
  180.                 exit;
  181.             else {
  182.                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  183.             }
  184.             break;
  185.  
  186.         default:
  187.             //顧客情報取得
  188.             $this->arrForm $this->lfGetCustomerData();
  189.             $this->arrForm['password'DEFAULT_PASSWORD;
  190.             $this->arrForm['password02'DEFAULT_PASSWORD;
  191.             break;
  192.         }
  193.  
  194.         //誕生日データ登録の有無
  195.         $arrCustomer $this->lfGetCustomerData();
  196.         if ($arrCustomer['birth'!= ""){
  197.             $this->birth_check true;
  198.         }
  199.  
  200.         $objView->assignobj($this);             //$objpage内の全てのテンプレート変数をsmartyに格納
  201.         $objView->display(SITE_FRAME);              //パスとテンプレート変数の呼び出し、実行
  202.  
  203.  
  204.     }
  205.  
  206.     /**
  207.      * モバイルページを初期化する.
  208.      *
  209.      * @return void 
  210.      */
  211.     function mobileInit({
  212.         $this->tpl_mainpage = 'mypage/change.tpl';        // メインテンプレート
  213.         $this->tpl_title .= '登録変更(1/3)';            // ページタイトル
  214.  
  215.         $masterData new SC_DB_MasterData_Ex();
  216.         $this->arrReminder $masterData->getMasterData("mtb_reminder");
  217.         $this->arrPref $masterData->getMasterData("mtb_pref",
  218.                                  array("pref_id""pref_name""rank"));
  219.         $this->arrJob $masterData->getMasterData("mtb_job");
  220.         $this->arrMAILMAGATYPE $masterData->getMasterData("mtb_mail_magazine_type");
  221.         $this->arrSex $masterData->getMasterData("mtb_sex");
  222.     }
  223.  
  224.     /**
  225.      * Page のプロセス(モバイル).
  226.      *
  227.      * @return void 
  228.      */
  229.     function mobileProcess({
  230.         $objDb new SC_Helper_DB_Ex();
  231.         $CONF $objDb->sf_getBasisData();                    // 店舗基本情報
  232.         $objConn new SC_DbConn();
  233.         $objView new SC_MobileView();
  234.         
  235.         // 生年月日選択肢の取得
  236.         $objDate new SC_Date();
  237.         $this->arrMonth $objDate->getMonth(true);
  238.         $this->arrDay $objDate->getDay(true);
  239.  
  240.         $this->objQuery new SC_Query();
  241.         $this->objCustomer new SC_Customer();
  242.  
  243.         //メールアドレス種別
  244.         $arrMailType array("email" => true"email_mobile" => true);
  245.  
  246.         //---- 登録用カラム配列
  247.         $arrRegistColumn array(
  248.                                  array(  "column" => "name01""convert" => "aKV" ),
  249.                                  array(  "column" => "name02""convert" => "aKV" ),
  250.                                  array(  "column" => "kana01""convert" => "CKV" ),
  251.                                  array(  "column" => "kana02""convert" => "CKV" ),
  252.                                  array(  "column" => "zip01""convert" => "n" ),
  253.                                  array(  "column" => "zip02""convert" => "n" ),
  254.                                  array(  "column" => "pref""convert" => "n" ),
  255.                                  array(  "column" => "addr01""convert" => "aKV" ),
  256.                                  array(  "column" => "addr02""convert" => "aKV" ),
  257.                                  array(  "column" => "email""convert" => "a" ),
  258.                                  array(  "column" => "email_mobile""convert" => "a" ),
  259.                                  array(  "column" => "tel01""convert" => "n" ),
  260.                                  array(  "column" => "tel02""convert" => "n" ),
  261.                                  array(  "column" => "tel03""convert" => "n" ),
  262.                                  array(  "column" => "fax01""convert" => "n" ),
  263.                                  array(  "column" => "fax02""convert" => "n" ),
  264.                                  array(  "column" => "fax03""convert" => "n" ),
  265.                                  array(  "column" => "sex""convert" => "n" ),
  266.                                  array(  "column" => "job""convert" => "n" ),
  267.                                  array(  "column" => "birth""convert" => "n" ),
  268.                                  array(  "column" => "reminder""convert" => "n" ),
  269.                                  array(  "column" => "reminder_answer""convert" => "aKV"),
  270.                                  array(  "column" => "password""convert" => "a" ),
  271.                                  array(  "column" => "mailmaga_flg""convert" => "n" )
  272.                                  );
  273.  
  274.         //---- 登録除外用カラム配列
  275.         $arrRejectRegistColumn array("year""month""day""email02""email_mobile02""password02");
  276.  
  277.         $this->arrForm $this->lfGetCustomerData();
  278.         $this->arrForm['password'DEFAULT_PASSWORD;
  279.  
  280.         if ($_SERVER["REQUEST_METHOD"== "POST"{
  281.  
  282.             //-- POSTデータの引き継ぎ
  283.             $this->arrForm array_merge($this->arrForm$_POST);
  284.  
  285.             if (!isset($this->arrForm['year'])) $this->arrForm['year'"";
  286.             if($this->arrForm['year'== '----'{
  287.                 $this->arrForm['year''';
  288.             }
  289.  
  290.             // emailはすべて小文字で処理
  291.             $this->paramToLower($_POST );
  292.  
  293.             //-- 入力データの変換
  294.             $this->arrForm $this->lfConvertParam($this->arrForm$arrRegistColumn);
  295.  
  296.             // 戻るボタン用処理
  297.             if (!empty($_POST["return"])) {
  298.                 switch ($_POST["mode"]{
  299.                 case "complete":
  300.                     $_POST["mode""set3";
  301.                     break;
  302.                 case "confirm":
  303.                     $_POST["mode""set2";
  304.                     break;
  305.                 default:
  306.                     $_POST["mode""set1";
  307.                     break;
  308.                 }
  309.             }
  310.  
  311.             //-- 入力エラーチェック
  312.             if ($_POST["mode"== "set1"{
  313.                 $this->arrErr $this->lfErrorCheck1($this->arrForm);
  314.                 $this->tpl_mainpage = 'mypage/change.tpl';
  315.                 $this->tpl_title = '登録変更(1/3)';
  316.             elseif ($_POST["mode"== "set2"{
  317.                 $this->arrErr $this->lfErrorCheck2($this->arrForm);
  318.                 $this->tpl_mainpage = 'mypage/set1.tpl';
  319.                 $this->tpl_title = '登録変更(2/3)';
  320.             else {
  321.                 $this->arrErr $this->lfErrorCheck3($this->arrForm);
  322.                 $this->tpl_mainpage = 'mypage/set2.tpl';
  323.                 $this->tpl_title = '登録変更(3/3)';
  324.             }
  325.  
  326.             if ($this->arrErr || !empty($_POST["return"])) {        // 入力エラーのチェック
  327.                 //-- データの設定
  328.                 if ($_POST["mode"== "set1"{
  329.                     $checkVal array("email""email_mobile""password""reminder""reminder_answer""name01""name02""kana01""kana02");
  330.                 elseif ($_POST["mode"== "set2"{
  331.                     $checkVal array("sex""year""month""day""zip01""zip02");
  332.                 else {
  333.                     $checkVal array("pref""addr01""addr02""tel01""tel02""tel03""mailmaga_flg");
  334.                 }
  335.  
  336.                 foreach($this->arrForm as $key => $val{
  337.                     if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name(&& !in_array($key$checkVal)) {
  338.                         $this->list_data$key $val;
  339.                     }
  340.                 }
  341.  
  342.             else {
  343.  
  344.                 //-- テンプレート設定
  345.                 if ($_POST["mode"== "set1"{
  346.                     $this->tpl_mainpage = 'mypage/set1.tpl';
  347.                     $this->tpl_title = '登録変更(2/3)';
  348.                 elseif ($_POST["mode"== "set2"{
  349.                     $this->tpl_mainpage = 'mypage/set2.tpl';
  350.                     $this->tpl_title = '登録変更(3/3)';
  351.                 elseif ($_POST["mode"== "confirm"{
  352.                     //パスワード表示
  353.                     $passlen strlen($this->arrForm['password']);
  354.                     $this->passlen $this->lfPassLen($passlen);
  355.  
  356.                     $this->tpl_mainpage = 'mypage/change_confirm.tpl';
  357.                     $this->tpl_title = '登録変更(確認ページ)';
  358.  
  359.                 }
  360.  
  361.                 //-- データ設定
  362.                 unset($this->list_data);
  363.                 if ($_POST["mode"== "set1"{
  364.                     $checkVal array("sex""year""month""day""zip01""zip02");
  365.                 elseif ($_POST["mode"== "set2"{
  366.                     $checkVal array("pref""addr01""addr02""tel01""tel02""tel03""mailmaga_flg");
  367.                 else {
  368.                     $checkVal array();
  369.                 }
  370.  
  371.                 foreach($this->arrForm as $key => $val{
  372.                     if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name(&& !in_array($key$checkVal)) {
  373.                         $this->list_data$key $val;
  374.                     }
  375.                 }
  376.  
  377.  
  378.                 //-- 仮登録と完了画面
  379.                 if ($_POST["mode"== "complete"{
  380.                     //エラーなしでかつメールアドレスが重複していない場合
  381.                     if($this->checkErrorTotal($arrRegistColumn$arrMailTypetrue)) {
  382.                         $this->arrForm['customer_id'$this->objCustomer->getValue('customer_id');
  383.                         //-- 編集登録
  384.                         $objDb->sfEditCustomerData($this->arrForm$arrRegistColumn);
  385.                         //セッション情報を最新の状態に更新する
  386.                         $this->objCustomer->updateSession();
  387.                         //完了ページへ
  388.                         $this->sendRedirect($this->getLocation("./change_complete.php")true);
  389.                         exit;
  390.                     else {
  391.                         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR""false""true);
  392.                     }
  393.                 }
  394.             }
  395.         }
  396.  
  397.         $arrPrivateVariables array('secret_key''first_buy_date''last_buy_date''buy_times''buy_total''point''note''status''create_date''update_date''del_flg''cell01''cell02''cell03''mobile_phone_id');
  398.         foreach ($arrPrivateVariables as $key{
  399.             unset($this->list_data[$key]);
  400.         }
  401.  
  402.         //---- ページ表示
  403.         $objView->assignobj($this);
  404.         $objView->display(SITE_FRAME);
  405.     }
  406.  
  407.     /**
  408.      * デストラクタ.
  409.      *
  410.      * @return void 
  411.      */
  412.     function destroy({
  413.         parent::destroy();
  414.     }
  415.  
  416.     /**
  417.      * すべてのエラーチェックを行う.
  418.      *
  419.      * @param array $arrRegistColumn 登録カラムの配列
  420.      * @param array $arrMailType メール種別とフラグを格納した配列
  421.      * @param bool $isMobile モバイル版登録チェックの場合 true
  422.      * @return bool エラーの無い場合 true
  423.      */
  424.     function checkErrorTotal(&$arrRegistColumn&$arrMailType$isMobile false{
  425.         //-- 入力データの変換
  426.         $this->arrForm $_POST;
  427.         $this->arrForm $this->lfConvertParam($this->arrForm$arrRegistColumn);
  428.  
  429.         // emailはすべて小文字で処理
  430.         $this->paramToLower($arrRegistColumn);
  431.  
  432.         //エラーチェック
  433.         $this->arrErr $isMobile
  434.             ? $this->lfErrorCheckMobile($this->arrForm)
  435.             : $this->lfErrorCheck($this->arrForm);
  436.  
  437.         //メールアドレスを変更している場合、メールアドレスの重複チェック
  438.         $arrMailType2 $arrMailType;
  439.         foreach ($arrMailType as $mailType => $mailTypeValue{
  440.  
  441.             if ($this->arrForm[$mailType]
  442.                 != $this->objCustomer->getValue($mailType)){
  443.  
  444.                 $email_cnt $this->objQuery->count("dtb_customer",
  445.                                  "del_flg=0 AND " $mailType "= ?",
  446.                                   array($this->arrForm[$mailType]));
  447.                 if ($email_cnt 0){
  448.                     $arrMailType2[$mailTypeValuefalse;
  449.                     $this->arrErr[$mailType.= "既に使用されているメールアドレスです。";
  450.                 }
  451.             }
  452.         }
  453.  
  454.         // エラーが存在せず, メールアドレスの重複が無い場合は true
  455.         if (empty($this->arrErr)
  456.             && $arrMailType2['email'== true
  457.             && $arrMailType2['email_mobile'== true{
  458.             return true;
  459.         else {
  460.             return false;
  461.         }
  462.     }
  463.  
  464.     /* パラメータ情報の初期化 */
  465.     function lfInitParam({
  466.         $this->objFormParam->addParam("お名前(姓)""name01"STEXT_LEN"KVa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  467.         $this->objFormParam->addParam("お名前(名)""name02"STEXT_LEN"KVa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  468.         $this->objFormParam->addParam("フリガナ(セイ)""kana01"STEXT_LEN"KVCa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  469.         $this->objFormParam->addParam("フリガナ(メイ)""kana02"STEXT_LEN"KVCa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  470.         $this->objFormParam->addParam("郵便番号1""zip01"ZIP01_LEN"n"array("EXIST_CHECK""NUM_CHECK""NUM_COUNT_CHECK"));
  471.         $this->objFormParam->addParam("郵便番号2""zip02"ZIP02_LEN"n"array("EXIST_CHECK""NUM_CHECK""NUM_COUNT_CHECK"));
  472.         $this->objFormParam->addParam("都道府県""pref"INT_LEN"n"array("EXIST_CHECK""MAX_LENGTH_CHECK""NUM_CHECK"));
  473.         $this->objFormParam->addParam("ご住所1""addr01"STEXT_LEN"KVa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  474.         $this->objFormParam->addParam("ご住所2""addr02"STEXT_LEN"KVa"array("EXIST_CHECK""SPTAB_CHECK""MAX_LENGTH_CHECK"));
  475.         $this->objFormParam->addParam("お電話番号1""tel01"TEL_ITEM_LEN"n"array("EXIST_CHECK""MAX_LENGTH_CHECK" ,"NUM_CHECK"));
  476.         $this->objFormParam->addParam("お電話番号2""tel02"TEL_ITEM_LEN"n"array("EXIST_CHECK""MAX_LENGTH_CHECK" ,"NUM_CHECK"));
  477.         $this->objFormParam->addParam("お電話番号3""tel03"TEL_ITEM_LEN"n"array("EXIST_CHECK""MAX_LENGTH_CHECK" ,"NUM_CHECK"));
  478.     }
  479.  
  480.     //エラーチェック
  481.  
  482.     function lfErrorCheck($array{
  483.         $objErr new SC_CheckError($array);
  484.  
  485.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  486.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  487.         $objErr->doFunc(array("フリガナ(セイ)"'kana01'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  488.         $objErr->doFunc(array("フリガナ(メイ)"'kana02'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  489.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  490.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  491.         $objErr->doFunc(array("郵便番号""zip01""zip02")array("ALL_EXIST_CHECK"));
  492.         $objErr->doFunc(array("都道府県"'pref')array("SELECT_CHECK","NUM_CHECK"));
  493.         $objErr->doFunc(array("ご住所1""addr01"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  494.         $objErr->doFunc(array("ご住所2""addr02"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  495.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("EXIST_CHECK""EMAIL_CHECK""NO_SPTAB" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  496.         $objErr->doFunc(array('メールアドレス(確認)'"email02"MTEXT_LEN,array("EXIST_CHECK""EMAIL_CHECK","NO_SPTAB" "EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  497.         $objErr->doFunc(array('メールアドレス''メールアドレス(確認)'"email""email02",array("EQUAL_CHECK"));
  498.         $objErr->doFunc(array('携帯メールアドレス'"email_mobile"MTEXT_LEN,array("EMAIL_CHECK""NO_SPTAB" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK""MOBILE_EMAIL_CHECK"));
  499.         $objErr->doFunc(array('携帯メールアドレス(確認)'"email_mobile02"MTEXT_LEN)array("EMAIL_CHECK","NO_SPTAB" "EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK""MOBILE_EMAIL_CHECK"));
  500.         $objErr->doFunc(array('携帯メールアドレス''携帯メールアドレス(確認)'"email_mobile""email_mobile02",array("EQUAL_CHECK"));
  501.         $objErr->doFunc(array("お電話番号1"'tel01')array("EXIST_CHECK","SPTAB_CHECK"));
  502.         $objErr->doFunc(array("お電話番号2"'tel02')array("EXIST_CHECK","SPTAB_CHECK"));
  503.         $objErr->doFunc(array("お電話番号3"'tel03')array("EXIST_CHECK","SPTAB_CHECK"));
  504.         $objErr->doFunc(array("お電話番号""tel01""tel02""tel03"TEL_LEN,array("TEL_CHECK"));
  505.         $objErr->doFunc(array("FAX番号""fax01""fax02""fax03"TEL_LEN,array("TEL_CHECK"));
  506.         $objErr->doFunc(array("ご性別""sex",array("SELECT_CHECK""NUM_CHECK"));
  507.         $objErr->doFunc(array("ご職業""job",array("NUM_CHECK"));
  508.         $objErr->doFunc(array("生年月日""year""month""day")array("CHECK_BIRTHDAY"));
  509.         $objErr->doFunc(array("パスワード"'password'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""ALNUM_CHECK""NUM_RANGE_CHECK"));
  510.         $objErr->doFunc(array("パスワード(確認)"'password02'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""ALNUM_CHECK""NUM_RANGE_CHECK"));
  511.         $objErr->doFunc(array("パスワード"'パスワード(確認)''password''password02')array("EQUAL_CHECK"));
  512.         $objErr->doFunc(array("パスワードを忘れたときの質問""reminder",array("SELECT_CHECK""NUM_CHECK"));
  513.         $objErr->doFunc(array("パスワードを忘れたときの答え""reminder_answer"STEXT_LEN,array("EXIST_CHECK""MAX_LENGTH_CHECK"));
  514.         $objErr->doFunc(array("メールマガジン""mailmaga_flg",array("SELECT_CHECK""NUM_CHECK"));
  515.         return $objErr->arrErr;
  516.  
  517.     }
  518.  
  519.     //---- 取得文字列の変換
  520.     function lfConvertParam($array$arrRegistColumn{
  521.         /*
  522.          *  文字列の変換
  523.          *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
  524.          *  C :  「全角ひら仮名」を「全角かた仮名」に変換
  525.          *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
  526.          *  n :  「全角」数字を「半角(ハンカク)」に変換
  527.          *  a :  全角英数字を半角英数字に変換する
  528.          */
  529.  
  530.         foreach ($arrRegistColumn as $registColumn{
  531.             $key $registColumn["column"];
  532.             $mb_convert_kana_option $registColumn["convert"];
  533.             $val =$array[$key];
  534.             
  535.             // 文字変換
  536.             // XXX 文字列のみを変換するようにした方が良い気もする。
  537.             if (strlen($val0{
  538.                 $val mb_convert_kana($val ,$mb_convert_kana_option);
  539.             }
  540.             
  541.             // メールマガジン
  542.             if ($key == 'mailmaga_flg'{
  543.                 if (strtolower($val== "on"{
  544.                     $val "2";
  545.                 else if ($val != "2"{
  546.                     $val "3";
  547.                 }
  548.             }
  549.         }
  550.         return $array;
  551.     }
  552.  
  553.     //顧客情報の取得
  554.     function lfGetCustomerData(){
  555.         //顧客情報取得
  556.         $ret $this->objQuery->select("*","dtb_customer","customer_id=?"array($this->objCustomer->getValue('customer_id')));
  557.         $arrForm $ret[0];
  558.  
  559.         //誕生日の年月日取得
  560.         if (isset($arrForm['birth'])){
  561.             $birth split(" "$arrForm["birth"]);
  562.             list($year$month$daysplit("-",$birth[0]);
  563.  
  564.             $arrForm['year'$year;
  565.             $arrForm['month'$month;
  566.             $arrForm['day'$day;
  567.  
  568.         }
  569.         return $arrForm;
  570.     }
  571.  
  572.     /**
  573.      * 編集登録
  574.      * TODO
  575.      * @deprecated 未使用?
  576.      */
  577.     function lfRegistData($array$arrRegistColumn{
  578.  
  579.         foreach ($arrRegistColumn as $data{
  580.             if ($data["column"!= "password"{
  581.                 if($array$data['column'] ] == ""{
  582.                     $arrRegist$data['column'] ] NULL;
  583.                 else {
  584.                     $arrRegist$data["column"] ] $array$data["column"] ];
  585.                 }
  586.             }
  587.         }
  588.         if (strlen($array["year"]&& strlen($array["month"]&& strlen($array["day"]0{
  589.             $arrRegist["birth"$array["year"."/"$array["month"."/"$array["day"." 00:00:00";
  590.         else {
  591.             $arrRegist["birth"NULL;
  592.         }
  593.  
  594.         //-- パスワードの更新がある場合は暗号化。(更新がない場合はUPDATE文を構成しない)
  595.         if ($array["password"!= DEFAULT_PASSWORD$arrRegist["password"sha1($array["password"":" AUTH_MAGIC);
  596.         $arrRegist["update_date""NOW()";
  597.  
  598.         //-- 編集登録実行
  599.         $this->objQuery->begin();
  600.         $this->objQuery->update("dtb_customer"$arrRegist"customer_id = ? "array($this->objCustomer->getValue('customer_id')));
  601.         $this->objQuery->commit();
  602.     }
  603.  
  604.     //確認ページ用パスワード表示用
  605.  
  606.     function lfPassLen($passlen){
  607.         $ret "";
  608.         for ($i=0;$i<$passlen;true){
  609.             $ret.="*";
  610.             $i++;
  611.         }
  612.         return $ret;
  613.     }
  614.  
  615.     //エラー、戻る時にフォームに入力情報を返す
  616.     function lfFormReturn($array&$objPage){
  617.         foreach($array as $key => $val){
  618.             switch ($key){
  619.             case 'password':
  620.             case 'password02':
  621.                 $objPage->$key $val;
  622.                 break;
  623.             default:
  624.                 $array$key $val;
  625.                 break;
  626.             }
  627.         }
  628.     }
  629.  
  630.  
  631.     // }}}
  632.     // {{{ mobile functions
  633.  
  634.     /**
  635.      * TODO
  636.      * @deprecated 未使用?
  637.      */
  638.     function lfRegistDataMobile ($array$arrRegistColumn,
  639.                                  $arrRejectRegistColumn{
  640.  
  641.         // 仮登録
  642.         foreach ($arrRegistColumn as $data{
  643.             if (strlen($array$data["column"] ]&& in_array($data["column"]$arrRejectRegistColumn)) {
  644.                 $arrRegist$data["column"] ] $array$data["column"] ];
  645.             }
  646.         }
  647.  
  648.         // 誕生日が入力されている場合
  649.         if (strlen($array["year"]{
  650.             $arrRegist["birth"$array["year"."/"$array["month"."/"$array["day"." 00:00:00";
  651.         }
  652.  
  653.         // パスワードの暗号化
  654.         $arrRegist["password"sha1($arrRegist["password"":" AUTH_MAGIC);
  655.  
  656.         $count 1;
  657.         while ($count != 0{
  658.             $uniqid SC_Utils_Ex::sfGetUniqRandomId("t");
  659.             $count $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?"array($uniqid));
  660.         }
  661.  
  662.         $arrRegist["secret_key"$uniqid;        // 仮登録ID発行
  663.         $arrRegist["create_date""now()";     // 作成日
  664.         $arrRegist["update_date""now()";     // 更新日
  665.         $arrRegist["first_buy_date""";         // 最初の購入日
  666.  
  667.  
  668.         //-- 仮登録実行
  669.         $this->objQuery->insert("dtb_customer"$arrRegist);
  670.  
  671.         return $uniqid;
  672.     }
  673.  
  674.  
  675.     //エラーチェック
  676.  
  677.     function lfErrorCheckMobile($array{
  678.         $objErr new SC_CheckError($array);
  679.  
  680.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  681.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  682.         $objErr->doFunc(array("お名前(カナ/姓)"'kana01'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  683.         $objErr->doFunc(array("お名前(カナ/名)"'kana02'STEXT_LEN)array("EXIST_CHECK""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  684.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  685.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  686.         $objErr->doFunc(array("郵便番号""zip01""zip02")array("ALL_EXIST_CHECK"));
  687.         $objErr->doFunc(array("都道府県"'pref')array("SELECT_CHECK","NUM_CHECK"));
  688.         $objErr->doFunc(array("市区町村""addr01"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  689.         $objErr->doFunc(array("番地""addr02"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  690.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("EXIST_CHECK""EMAIL_CHECK""NO_SPTAB" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  691.         $objErr->doFunc(array('携帯メールアドレス'"email_mobile"MTEXT_LEN,array("EMAIL_CHECK""NO_SPTAB" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK""MOBILE_EMAIL_CHECK"));
  692.         $objErr->doFunc(array("電話番号1"'tel01')array("EXIST_CHECK","SPTAB_CHECK"));
  693.         $objErr->doFunc(array("電話番号2"'tel02')array("EXIST_CHECK","SPTAB_CHECK"));
  694.         $objErr->doFunc(array("電話番号3"'tel03')array("EXIST_CHECK","SPTAB_CHECK"));
  695.         $objErr->doFunc(array("電話番号""tel01""tel02""tel03"TEL_LEN,array("TEL_CHECK"));
  696.         $objErr->doFunc(array("FAX番号""fax01""fax02""fax03"TEL_LEN,array("TEL_CHECK"));
  697.         $objErr->doFunc(array("性別""sex",array("SELECT_CHECK""NUM_CHECK"));
  698.         $objErr->doFunc(array("ご職業""job",array("NUM_CHECK"));
  699.         $objErr->doFunc(array("生年月日""year""month""day")array("CHECK_BIRTHDAY"));
  700.         $objErr->doFunc(array("パスワード"'password'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""ALNUM_CHECK""NUM_RANGE_CHECK"));
  701.         $objErr->doFunc(array("パスワード確認用の質問""reminder",array("SELECT_CHECK""NUM_CHECK"));
  702.         $objErr->doFunc(array("パスワード確認用の質問の答え""reminder_answer"STEXT_LEN,array("EXIST_CHECK""MAX_LENGTH_CHECK"));
  703.         return $objErr->arrErr;
  704.  
  705.     }
  706.  
  707.  
  708.     //---- 入力エラーチェック
  709.     function lfErrorCheck1($array{
  710.  
  711.         $objErr new SC_CheckError($array);
  712.  
  713.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  714.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  715.         $objErr->doFunc(array("お名前(カナ/姓)"'kana01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  716.         $objErr->doFunc(array("お名前(カナ/名)"'kana02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  717.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("NO_SPTAB""EXIST_CHECK""EMAIL_CHECK""SPTAB_CHECK" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  718.         $objErr->doFunc(array('携帯メールアドレス'"email_mobile"MTEXT_LEN,array("NO_SPTAB""EMAIL_CHECK""SPTAB_CHECK" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK""MOBILE_EMAIL_CHECK"));
  719.  
  720.         //現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
  721.         $array["customer_id"$this->objCustomer->getValue('customer_id');
  722.         if (strlen($array["email"]0{
  723.             $arrRet $this->objQuery->select("email, update_date, del_flg""dtb_customer","customer_id <> ? and (email = ? OR email_mobile = ?) ORDER BY del_flg"array($array["customer_id"]$array["email"]$array["email"]));
  724.  
  725.             if(count($arrRet0{
  726.                 if($arrRet[0]['del_flg'!= '1'{
  727.                     // 会員である場合
  728.                     $objErr->arrErr["email".= "※ すでに会員登録で使用されているメールアドレスです。<br />";
  729.                 else {
  730.                     // 退会した会員である場合
  731.                     $leave_time SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']);
  732.                     $now_time time();
  733.                     $pass_time $now_time $leave_time;
  734.                     // 退会から何時間-経過しているか判定する。
  735.                     $limit_time ENTRY_LIMIT_HOUR 3600;
  736.                     if($pass_time $limit_time{
  737.                         $objErr->arrErr["email".= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />";
  738.                     }
  739.                 }
  740.             }
  741.         }
  742.  
  743.         $objErr->doFunc(array("パスワード"'password'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""SPTAB_CHECK" ,"ALNUM_CHECK""NUM_RANGE_CHECK"));
  744.         $objErr->doFunc(array("パスワード確認用の質問""reminder",array("SELECT_CHECK""NUM_CHECK"));
  745.         $objErr->doFunc(array("パスワード確認用の質問の答え""reminder_answer"STEXT_LEN,array("EXIST_CHECK","SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  746.  
  747.         return $objErr->arrErr;
  748.     }
  749.  
  750.     //---- 入力エラーチェック
  751.     function lfErrorCheck2($array{
  752.  
  753.         $objErr new SC_CheckError($array);
  754.  
  755.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  756.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  757.         $objErr->doFunc(array("郵便番号""zip01""zip02")array("ALL_EXIST_CHECK"));
  758.  
  759.         $objErr->doFunc(array("性別""sex",array("SELECT_CHECK""NUM_CHECK"));
  760.         $objErr->doFunc(array("生年月日""year""month""day")array("CHECK_BIRTHDAY"));
  761.  
  762.         return $objErr->arrErr;
  763.     }
  764.  
  765.     //---- 入力エラーチェック
  766.     function lfErrorCheck3($array{
  767.  
  768.         $objErr new SC_CheckError($array);
  769.  
  770.         $objErr->doFunc(array("都道府県"'pref')array("SELECT_CHECK","NUM_CHECK"));
  771.         $objErr->doFunc(array("市区町村""addr01"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  772.         $objErr->doFunc(array("番地""addr02"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  773.         $objErr->doFunc(array("電話番号1"'tel01')array("EXIST_CHECK","SPTAB_CHECK" ));
  774.         $objErr->doFunc(array("電話番号2"'tel02')array("EXIST_CHECK","SPTAB_CHECK" ));
  775.         $objErr->doFunc(array("電話番号3"'tel03')array("EXIST_CHECK","SPTAB_CHECK" ));
  776.         $objErr->doFunc(array("電話番号""tel01""tel02""tel03",TEL_ITEM_LEN,array("TEL_CHECK"));
  777.  
  778.         return $objErr->arrErr;
  779.     }
  780.  
  781.     // 郵便番号から住所の取得
  782.     function lfGetAddress($zipcode{
  783.         global $arrPref;
  784.  
  785.         $conn new SC_DBconn(ZIP_DSN);
  786.  
  787.         // 郵便番号検索文作成
  788.         $zipcode mb_convert_kana($zipcode ,"n");
  789.         $sqlse "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
  790.  
  791.         $data_list $conn->getAll($sqlsearray($zipcode));
  792.  
  793.         // インデックスと値を反転させる。
  794.         $arrREV_PREF array_flip($arrPref);
  795.  
  796.         /*
  797.           総務省からダウンロードしたデータをそのままインポートすると
  798.           以下のような文字列が入っているので    対策する。
  799.           ・(1・19丁目)
  800.           ・以下に掲載がない場合
  801.         */
  802.         $town =  $data_list[0]['town'];
  803.         $town ereg_replace("(.*)$","",$town);
  804.         $town ereg_replace("以下に掲載がない場合","",$town);
  805.         $data_list[0]['town'$town;
  806.         $data_list[0]['state'$arrREV_PREF[$data_list[0]['state']];
  807.  
  808.         return $data_list;
  809.     }
  810.  
  811.     //顧客情報の取得
  812.     function lfGetCustomerDataMobile(){
  813.  
  814.         //顧客情報取得
  815.         $ret $this->objQuery->select("*","dtb_customer","customer_id=?"array($this->objCustomer->getValue('customer_id')));
  816.         $arrForm $ret[0];
  817.         //$arrForm['email'] = $arrForm['email_mobile'];
  818.  
  819.         //メルマガフラグ取得
  820.         // TODO たぶん未使用
  821.         $arrForm['mailmaga_flg'$this->objQuery->get("dtb_customer","mailmaga_flg","email_mobile=?"array($this->objCustomer->getValue('email_mobile')));
  822.  
  823.         //誕生日の年月日取得
  824.         if (isset($arrForm['birth'])){
  825.             $birth split(" "$arrForm["birth"]);
  826.             list($year$month$daysplit("-",$birth[0]);
  827.  
  828.             $arrForm['year'$year;
  829.             $arrForm['month'$month;
  830.             $arrForm['day'$day;
  831.  
  832.         }
  833.         return $arrForm;
  834.     }
  835.  
  836.     /**
  837.      * フォームパラメータの内容を小文字に変換する.
  838.      *
  839.      * @param array $arrParam パラメータ名の配列
  840.      * @return void 
  841.      */
  842.     function paramToLower(&$arrParam{
  843.         foreach ($arrParam as $key => $val{
  844.             if (!isset($val)) {
  845.                 $this->arrForm[$key"";
  846.             }elseif($key == 'email' || $key == 'email_mobile'){
  847.                 $this->arrForm[$keystrtolower($val);
  848.             }
  849.         }
  850.     }
  851. }
  852. ?>

Documentation generated on Tue, 28 Apr 2009 18:12:28 +0900 by phpDocumentor 1.4.2