Beispiel #1
0
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     //---- ページ初期設定
     $objDb = new SC_Helper_DB_Ex();
     $objMobile = new SC_Helper_Mobile_Ex();
     $CONF = $objDb->sf_getBasisData();
     // 店舗基本情報
     $objConn = new SC_DbConn();
     $objView = new SC_MobileView();
     $objCustomer = new SC_Customer();
     $objDate = new SC_Date(START_BIRTH_YEAR, date("Y", strtotime("now")));
     // 空メール
     if (isset($_SESSION['mobile']['kara_mail_from'])) {
         $_POST['email'] = $_SESSION['mobile']['kara_mail_from'];
         $this->tpl_kara_mail_from = $_POST['email'];
     } elseif (MOBILE_USE_KARA_MAIL) {
         $token = $objMobile->gfPrepareKaraMail('entry/index.php');
         if ($token !== false) {
             $this->tpl_mainpage = 'entry/mail.tpl';
             $this->tpl_title = '会員登録(空メール)';
             $this->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'entry_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
             $this->tpl_from_address = $CONF['email03'];
         }
     }
     // レイアウトデザインを取得
     $objLayout = new SC_Helper_PageLayout_Ex();
     $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
     //---- 登録用カラム配列
     $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "email", "convert" => "a"), array("column" => "email2", "convert" => "a"), array("column" => "email_mobile", "convert" => "a"), array("column" => "email_mobile2", "convert" => "a"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n"), array("column" => "fax01", "convert" => "n"), array("column" => "fax02", "convert" => "n"), array("column" => "fax03", "convert" => "n"), array("column" => "sex", "convert" => "n"), array("column" => "job", "convert" => "n"), array("column" => "birth", "convert" => "n"), array("column" => "reminder", "convert" => "n"), array("column" => "reminder_answer", "convert" => "aKV"), array("column" => "password", "convert" => "a"), array("column" => "password02", "convert" => "a"), array("column" => "mailmaga_flg", "convert" => "n"));
     //---- 登録除外用カラム配列
     $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //-- POSTデータの引き継ぎ
         $this->arrForm = $_POST;
         if (isset($this->arrForm['year']) && $this->arrForm['year'] == '----') {
             $this->arrForm['year'] = '';
         }
         $this->arrForm['email'] = strtolower($this->arrForm['email']);
         // emailはすべて小文字で処理
         //-- 入力データの変換
         $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
         // 戻るボタン用処理
         if (!empty($_POST["return"])) {
             switch ($_POST["mode"]) {
                 case "complete":
                     $_POST["mode"] = "set3";
                     break;
                 case "confirm":
                     $_POST["mode"] = "set2";
                     break;
                 default:
                     $_POST["mode"] = "set1";
                     break;
             }
         }
         //-- 入力エラーチェック
         if ($_POST["mode"] == "set1") {
             $this->arrErr = $this->lfErrorCheck1($this->arrForm);
             $this->tpl_mainpage = 'entry/index.tpl';
             $this->tpl_title = '会員登録(1/3)';
         } elseif ($_POST["mode"] == "set2") {
             $this->arrErr = $this->lfErrorCheck2($this->arrForm);
             $this->tpl_mainpage = 'entry/set1.tpl';
             $this->tpl_title = '会員登録(2/3)';
         } else {
             $this->arrErr = $this->lfErrorCheck3($this->arrForm);
             $this->tpl_mainpage = 'entry/set2.tpl';
             $this->tpl_title = '会員登録(3/3)';
         }
         foreach ($this->arrForm as $key => $val) {
             $this->{$key} = $val;
         }
         if ($this->arrErr || !empty($_POST["return"])) {
             // 入力エラーのチェック
             //-- データの設定
             if ($_POST["mode"] == "set1") {
                 $checkVal = array("email", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
             } elseif ($_POST["mode"] == "set2") {
                 $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
             } else {
                 $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
             }
             foreach ($this->arrForm as $key => $val) {
                 if ($key != "mode" && $key != "submit" && $key != "return" && $key != session_name() && !in_array($key, $checkVal)) {
                     $this->list_data[$key] = $val;
                 }
             }
         } else {
             //-- テンプレート設定
             if ($_POST["mode"] == "set1") {
                 $this->tpl_mainpage = 'entry/set1.tpl';
                 $this->tpl_title = '会員登録(2/3)';
             } elseif ($_POST["mode"] == "set2") {
                 $this->tpl_mainpage = 'entry/set2.tpl';
                 $this->tpl_title = '会員登録(3/3)';
                 if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") {
                     $address = $this->lfGetAddress($_REQUEST['zip01'] . $_REQUEST['zip02']);
                     $this->pref = @$address[0]['state'];
                     $this->addr01 = @$address[0]['city'] . @$address[0]['town'];
                 }
             } elseif ($_POST["mode"] == "confirm") {
                 //パスワード表示
                 $passlen = strlen($this->arrForm['password']);
                 $this->passlen = $this->lfPassLen($passlen);
                 //メール受け取り
                 if (!isset($this->arrForm['mailmaga_flg'])) {
                     $this->arrForm['mailmaga_flg'] = "";
                 }
                 if (strtolower($this->arrForm['mailmaga_flg']) == "on") {
                     $this->arrForm['mailmaga_flg'] = "2";
                 } else {
                     $this->arrForm['mailmaga_flg'] = "3";
                 }
                 $this->tpl_mainpage = 'entry/confirm.tpl';
                 $this->tpl_title = '会員登録(確認ページ)';
             }
             //-- データ設定
             unset($this->list_data);
             if ($_POST["mode"] == "set1") {
                 $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
             } elseif ($_POST["mode"] == "set2") {
                 $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
             } else {
                 $checkVal = array();
             }
             foreach ($this->arrForm as $key => $val) {
                 if ($key != "mode" && $key != "submit" && $key != "confirm" && $key != "return" && $key != session_name() && !in_array($key, $checkVal)) {
                     $this->list_data[$key] = $val;
                 }
             }
             //-- 仮登録と完了画面
             if ($_POST["mode"] == "complete") {
                 // 確認画面で再度エラーチェックを行う。(画面1)
                 $arrErr = $this->lfErrorCheck1($this->arrForm);
                 if (count($arrErr) > 0) {
                     $this->tpl_mainpage = 'entry/index.tpl';
                     $this->tpl_title = '会員登録(1/3)';
                     $this->arrErr = $arrErr;
                     //---- ページ表示
                     $objView->assignobj($this);
                     $objView->display(SITE_FRAME);
                     exit;
                 }
                 // 確認画面で再度エラーチェックを行う。(画面2)
                 $arrErr = $this->lfErrorCheck2($this->arrForm);
                 if (count($arrErr) > 0) {
                     $this->tpl_mainpage = 'entry/set1.tpl';
                     $this->tpl_title = '会員登録(2/3)';
                     $this->arrErr = $arrErr;
                     //---- ページ表示
                     $objView->assignobj($this);
                     $objView->display(SITE_FRAME);
                     exit;
                 }
                 // 確認画面で再度エラーチェックを行う。(画面3)
                 $arrErr = $this->lfErrorCheck3($this->arrForm);
                 if (count($arrErr) > 0) {
                     $this->tpl_mainpage = 'entry/set2.tpl';
                     $this->tpl_title = '会員登録(3/3)';
                     $this->arrErr = $arrErr;
                     //---- ページ表示
                     $objView->assignobj($this);
                     $objView->display(SITE_FRAME);
                     exit;
                 }
                 $this->CONF = $CONF;
                 $this->uniqid = $this->lfRegistData($this->arrForm, $arrRegistColumn, $arrRejectRegistColumn, CUSTOMER_CONFIRM_MAIL, true, $this->arrForm["email"]);
                 // 空メールを受信済みの場合はすぐに本登録完了にする。
                 if (isset($_SESSION['mobile']['kara_mail_from'])) {
                     $param = array("mode" => "regist", "id" => $this->uniqid, session_name() => session_id());
                     $this->sendRedirect($this->getLocation(MOBILE_URL_DIR . "regist/index.php", $param));
                     exit;
                 }
                 $this->tpl_mainpage = 'entry/complete.tpl';
                 $this->tpl_title = '会員登録(完了ページ)';
                 $objMobile->sfMobileSetExtSessionId('id', $this->uniqid, 'regist/index.php');
                 // 仮登録完了メール送信
                 $this->to_name01 = $_POST['name01'];
                 $this->to_name02 = $_POST['name02'];
                 $objMailText = new SC_MobileView();
                 $objMailText->assignobj($this);
                 $objHelperMail = new SC_Helper_Mail_Ex();
                 $objQuery = new SC_Query();
                 // 仮会員が有効の場合
                 if (CUSTOMER_CONFIRM_MAIL == true) {
                     // Moba8パラメーターを保持する場合はカラム追加
                     if (isset($_SESSION['a8'])) {
                         $this->etc_value = "&a8=" . $_SESSION['a8'];
                     }
                     $subject = $objHelperMail->sfMakeSubject($objQuery, $objMailText, $this, '会員登録のご確認');
                     $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
                 } else {
                     $subject = $objHelperMail->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご完了');
                     $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
                     // ログイン状態にする
                     $objCustomer->setLogin($_POST["email"]);
                 }
                 $objMail = new SC_SendMail();
                 $objMail->setItem('', $subject, $toCustomerMail, $CONF["email03"], $CONF["shop_name"], $CONF["email03"], $CONF["email04"], $CONF["email04"], $CONF["email01"]);
                 // 宛先の設定
                 $name = $_POST["name01"] . $_POST["name02"] . " 様";
                 $objMail->setTo($_POST["email"], $name);
                 $objMail->sendMail();
                 // 完了ページに移動させる。
                 $this->sendRedirect($this->getLocation("./complete.php"), true);
                 exit;
             }
         }
     }
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }