source: branches/rel/html/contact/index.php @ 16137

Revision 16137, 7.7 KB checked in by adachi, 15 years ago (diff)

#105 問い合わせメールの店名、メールアドレスが表示されないが表示されない不具合を修正

Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9sfDomainSessionStart();
10error_reporting(E_ALL);
11class LC_Page {
12    function LC_Page() {
13        $this->tpl_css      = URL_DIR . 'css/layout/contact/index.css'; // ¥á¥¤¥óCSS¥Ñ¥¹
14        $this->tpl_mainpage = 'contact/index.tpl';
15        $this->tpl_title    = '¤ªÌ䤤¹ç¤ï¤»(ÆþÎÏ¥Ú¡¼¥¸)';
16        $this->tpl_page_category = 'contact';
17        global $arrPref;
18        $this->arrPref = $arrPref;
19    }
20}
21
22$objPage = new LC_Page();
23$objCustomer = new SC_Customer();
24
25if ($objCustomer->isloginSuccess()){
26    $objPage->arrData = $_SESSION['customer'];
27}
28
29// XXX SSLURLȽÄê
30if (SSLURL_CHECK == 1){
31    $ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
32    if (!ereg("^https://", $non_ssl_url)){
33        sfDispSiteError(URL_ERROR);
34    }
35}
36
37// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
38$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
39
40//¥Õ¥©¡¼¥àÃÍÊÑ´¹ÍÑ¥«¥é¥à
41$arrConvertColumn = array(
42    array("column" => "name01",   "convert" => "aKV"),
43    array("column" => "name02",   "convert" => "aKV"),
44    array("column" => "kana01",   "convert" => "CKV"),
45    array("column" => "kana02",   "convert" => "CKV"),
46    array("column" => "zip01",    "convert" => "n"),
47    array("column" => "zip02",    "convert" => "n"),
48    array("column" => "pref",     "convert" => "n"),
49    array("column" => "addr01",   "convert" => "aKV"),
50    array("column" => "addr02",   "convert" => "aKV"),
51    array("column" => "email",    "convert" => "a"),
52    array("column" => "tel01",    "convert" => "n"),
53    array("column" => "tel02",    "convert" => "n"),
54    array("column" => "tel03",    "convert" => "n"),
55    array("column" => "contents", "convert" => "aKV")
56);
57
58$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
59switch ($mode){
60case 'confirm':
61    // ¥¨¥é¡¼¥Á¥§¥Ã¥¯
62    $objPage->arrForm = $_POST;
63    $objPage->arrForm['email'] = strtolower($_POST['email']);
64    $objPage->arrForm = lfConvertParam($objPage->arrForm,$arrConvertColumn);
65    $objPage->arrErr = lfErrorCheck($objPage->arrForm);
66    if ( ! $objPage->arrErr ){
67        // ¥¨¥é¡¼Ìµ¤·¤Ç´°Î»²èÌÌ
68        $objPage->tpl_mainpage = 'contact/confirm.tpl';
69        $objPage->tpl_title = '¤ªÌ䤤¹ç¤ï¤»(³Îǧ¥Ú¡¼¥¸)';
70    } else {
71        foreach ($objPage->arrForm as $key => $val){
72        $objPage->$key = $val;
73        }
74    }
75    break;
76
77    case 'return':
78    foreach ($_POST as $key => $val){
79        $objPage->$key = $val;
80        }
81    break;
82
83case 'complete':
84    $objPage->arrForm = $_POST;
85    $objPage->arrForm['email'] = strtolower($_POST['email']);
86    $objPage->arrForm = lfConvertParam($objPage->arrForm, $arrConvertColumn);
87    $arrErr = lfErrorCheck($objPage->arrForm);
88
89    if(empty($arrErr)) {
90        lfSendMail($objPage);
91        //´°Î»¥Ú¡¼¥¸¤Ø°ÜÆ°¤¹¤ë
92        header("location: ./complete.php");
93        exit;
94    } else {
95        sfDispSiteError(CUSTOMER_ERROR);
96    }
97    break;
98
99default:
100    break;
101}
102
103// ¥Ú¡¼¥¸½ÐÎÏ
104$objView = new SC_SiteView();
105$objView->assignobj($objPage);
106
107$objCampaignSess = new SC_CampaignSession();
108$objCampaignSess->pageView($objView);
109//------------------------------------------------------------------------------------------------------------------------------------------
110
111//¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô
112function lfErrorCheck($array) {
113    $objErr = new SC_CheckError($array);
114    $objErr->doFunc(array("¤ªÌ¾Á°(À«)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
115    $objErr->doFunc(array("¤ªÌ¾Á°(̾)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
116    $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥»¥¤)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
117    $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥á¥¤)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
118    $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
119    $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
120    $objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
121    $objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
122    $objErr->doFunc(array("¤ªÌ䤤¹ç¤ï¤»ÆâÍÆ", "contents", MLTEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
123    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
124    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³Îǧ)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
125    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³Îǧ)', "email", "email02") ,array("EQUAL_CHECK"));
126    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
127    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
128    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
129
130    if (REVIEW_ALLOW_URL == false) {
131        // URL¤ÎÆþÎϤò¶Ø»ß
132        global $arrReviewDenyURL;
133        $objErr->doFunc(array("URL", "contents", $arrReviewDenyURL), array("PROHIBITED_STR_CHECK"));
134    }
135
136    return $objErr->arrErr;
137}
138
139//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
140function lfConvertParam($array, $arrConvertColumn) {
141    /*
142     *  ʸ»úÎó¤ÎÊÑ´¹
143     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
144     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
145     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹
146     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)¡×¤ËÊÑ´¹
147     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
148     */
149    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
150    foreach ($arrConvertColumn as $data) {
151        $arrConvList[ $data["column"] ] = $data["convert"];
152    }
153
154    // ʸ»úÊÑ´¹
155    foreach ($arrConvList as $key => $val) {
156        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
157        if(strlen(($array[$key])) > 0) {
158            $array[$key] = mb_convert_kana($array[$key] ,$val);
159        }
160    }
161    return $array;
162}
163
164/**
165 * Ì䤤¹ç¤ï¤»¼õÉե᡼¥ë¤ÎÁ÷¿®¤ò¹Ô¤¦
166 *
167 * @param object $objPage
168 * @return void
169 */
170function lfSendMail($objPage){
171    $arrSiteInfo = sf_getBasisData();
172    $objMailView = new SC_UserView(TEMPLATE_DIR);
173
174    $objPage->tpl_shopname  = $arrSiteInfo['shop_name'];
175    $objPage->tpl_infoemail = $arrSiteInfo['email02'];
176
177    $objMailView->assignobj($objPage);
178    $body = $objMailView->fetch("mail_templates/contact_mail.tpl");
179
180    $objMail = new GC_SendMail();
181
182    if ( $objPage->arrForm['email'] ) {
183        $fromMail_name    = $objPage->arrForm['name01'] . " ÍÍ";
184        $fromMail_address = $objPage->arrForm['email'];
185    } else {
186        $fromMail_name    = $arrSiteInfo["shop_name"];
187        $fromMail_address = $arrSiteInfo["email02"];
188    }
189
190    /**
191     * GC_SendMail::setItem(
192     *   °¸Àè,
193     *   ·ï̾,
194     *   ËÜʸ,
195     *   ÇÛÁ÷¸µ ¥¢¥É¥ì¥¹,
196     *   ÇÛÁ÷¸µ ̾Á°,
197     *   reply_to,
198     *   return_path,
199     *   errors_to
200     * )
201     */
202    $subject = sfMakeSubject("¤ªÌ䤤¹ç¤ï¤»¤¬¤¢¤ê¤Þ¤·¤¿¡£");
203    $objMail->setItem(
204        $arrSiteInfo["email02"],
205        $subject,
206        $body,
207        $fromMail_address,
208        $fromMail_name,
209        $fromMail_address,
210        $arrSiteInfo["email04"],
211        $arrSiteInfo["email04"]
212    );
213    $objMail->sendMail();
214
215    $subject = sfMakeSubject("¤ªÌ䤤¹ç¤ï¤»¤ò¼õ¤±ÉÕ¤±¤Þ¤·¤¿¡£");
216    $objMail->setItem(
217        '',
218        $subject,
219        $body,
220        $arrSiteInfo["email03"],
221        $arrSiteInfo["shop_name"],
222        $arrSiteInfo["email02"],
223        $arrSiteInfo["email04"],
224        $arrSiteInfo["email04"]
225    );
226    $objMail->setTo($objPage->arrForm['email'], $objPage->arrForm['name01'] . " ÍÍ");
227    $objMail->sendMail();
228}
229?>
Note: See TracBrowser for help on using the repository browser.