Ignore:
Timestamp:
2012/02/17 00:50:05 (12 years ago)
Author:
Seasoft
Message:

#1613 (ソース整形・ソースコメントの改善)

  • Zend Framework PHP 標準コーディング規約への準拠を高めた。(主に「Switch」の項)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping.php

    r21515 r21526  
    110110 
    111111        switch ($this->getMode()) { 
    112         // ログイン実行 
    113         case 'login': 
    114             $this->lfInitLoginFormParam($objFormParam); 
    115             $objFormParam->setParam($_POST); 
    116             $objFormParam->trimParam(); 
    117             $objFormParam->convParam(); 
    118             $objFormParam->toLower('login_email'); 
    119             $this->arrErr = $objFormParam->checkError(); 
    120  
    121             // ログイン判定 
    122             if (SC_Utils_Ex::isBlank($this->arrErr) 
    123                 && $this->doLogin($objCustomer, 
    124                                   $objFormParam->getValue('login_email'), 
    125                                   $objFormParam->getValue('login_pass'))) { 
    126  
    127                 // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移 
    128                 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { 
    129                     if ($this->hasEmailMobile($objCustomer) == false) { 
    130                         SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); 
     112            // ログイン実行 
     113            case 'login': 
     114                $this->lfInitLoginFormParam($objFormParam); 
     115                $objFormParam->setParam($_POST); 
     116                $objFormParam->trimParam(); 
     117                $objFormParam->convParam(); 
     118                $objFormParam->toLower('login_email'); 
     119                $this->arrErr = $objFormParam->checkError(); 
     120 
     121                // ログイン判定 
     122                if (SC_Utils_Ex::isBlank($this->arrErr) 
     123                    && $this->doLogin($objCustomer, 
     124                                      $objFormParam->getValue('login_email'), 
     125                                      $objFormParam->getValue('login_pass'))) { 
     126 
     127                    // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移 
     128                    if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { 
     129                        if ($this->hasEmailMobile($objCustomer) == false) { 
     130                            SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); 
     131                            exit; 
     132                        } 
     133                    } 
     134                    // スマートフォンの場合はログイン成功を返す 
     135                    elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     136                        echo SC_Utils_Ex::jsonEncode(array('success' =>  
     137                                                    $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
     138                                                                           $objCustomer, $objPurchase, 
     139                                                                           $objSiteSess))); 
    131140                        exit; 
    132141                    } 
    133                 } 
    134                 // スマートフォンの場合はログイン成功を返す 
    135                 elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
    136                     echo SC_Utils_Ex::jsonEncode(array('success' =>  
    137                                                 $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
    138                                                                        $objCustomer, $objPurchase, 
    139                                                                        $objSiteSess))); 
     142 
     143                    SC_Response_Ex::sendRedirect( 
     144                            $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
     145                                                   $objCustomer, $objPurchase, 
     146                                                   $objSiteSess)); 
    140147                    exit; 
    141148                } 
    142  
    143                 SC_Response_Ex::sendRedirect( 
    144                         $this->getNextLocation($this->cartKey, $this->tpl_uniqid, 
    145                                                $objCustomer, $objPurchase, 
    146                                                $objSiteSess)); 
    147                 exit; 
    148             } 
    149             // ログインに失敗した場合 
    150             else { 
    151                 // 仮登録の場合 
    152                 if ($this->checkTempCustomer($objFormParam->getValue('login_email'))) { 
    153                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
    154                         echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); 
    155                         exit; 
     149                // ログインに失敗した場合 
     150                else { 
     151                    // 仮登録の場合 
     152                    if ($this->checkTempCustomer($objFormParam->getValue('login_email'))) { 
     153                        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     154                            echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); 
     155                            exit; 
     156                        } else { 
     157                            SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); 
     158                            exit; 
     159                        } 
    156160                    } else { 
    157                         SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); 
    158                         exit; 
     161                        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
     162                            echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); 
     163                            exit; 
     164                        } else { 
     165                            SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); 
     166                            exit; 
     167                        } 
    159168                    } 
    160                 } else { 
    161                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { 
    162                         echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); 
    163                         exit; 
    164                     } else { 
    165                         SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); 
    166                         exit; 
    167                     } 
    168                 } 
    169             } 
    170             break; 
    171  
    172         // お客様情報登録 
    173         case 'nonmember_confirm': 
    174             $this->tpl_mainpage = $nonmember_mainpage; 
    175             $this->tpl_title = $nonmember_title; 
    176             $this->lfInitParam($objFormParam); 
    177             $objFormParam->setParam($_POST); 
    178             $this->arrErr = $this->lfCheckError($objFormParam); 
    179  
    180             if (SC_Utils_Ex::isBlank($this->arrErr)) { 
    181                 $objPurchase->unsetShippingTemp(); 
    182                 $this->lfRegistData($this->tpl_uniqid, $objPurchase, 
    183                                     $objCustomer, $objFormParam); 
    184  
    185                 $objSiteSess->setRegistFlag(); 
    186                 SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); 
    187                 exit; 
    188             } 
    189             break; 
    190  
    191         // 前のページに戻る 
    192         case 'return': 
    193             SC_Response_Ex::sendRedirect(CART_URLPATH); 
    194             exit; 
    195             break; 
    196  
    197         // 複数配送ページへ遷移 
    198         case 'multiple': 
    199             // 複数配送先指定が無効な場合はエラー 
    200             if (USE_MULTIPLE_SHIPPING === false) { 
    201                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); 
    202                 exit; 
    203             } 
    204  
    205             $this->lfInitParam($objFormParam); 
    206             $objFormParam->setParam($_POST); 
    207             $this->arrErr = $this->lfCheckError($objFormParam); 
    208  
    209             if (SC_Utils_Ex::isBlank($this->arrErr)) { 
    210                 $objPurchase->unsetShippingTemp(); 
    211                 $this->lfRegistData($this->tpl_uniqid, $objPurchase, 
    212                                     $objCustomer, $objFormParam, true); 
    213  
    214                 $objSiteSess->setRegistFlag(); 
    215                 SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH); 
    216                 exit; 
    217             } 
    218             $this->tpl_mainpage = $nonmember_mainpage; 
    219             $this->tpl_title = $nonmember_title; 
    220             break; 
    221  
    222         // お客様情報入力ページの表示 
    223         case 'nonmember': 
    224             $this->tpl_mainpage = $nonmember_mainpage; 
    225             $this->tpl_title = $nonmember_title; 
    226             $this->lfInitParam($objFormParam); 
    227             // ※breakなし 
    228  
    229         default: 
    230             // 前のページから戻ってきた場合は, お客様情報入力ページ 
    231             if (isset($_GET['from']) && $_GET['from'] == 'nonmember') { 
     169                } 
     170                break; 
     171 
     172            // お客様情報登録 
     173            case 'nonmember_confirm': 
    232174                $this->tpl_mainpage = $nonmember_mainpage; 
    233175                $this->tpl_title = $nonmember_title; 
    234176                $this->lfInitParam($objFormParam); 
    235             } 
    236             // 通常はログインページ 
    237             else { 
    238                 $this->lfInitLoginFormParam($objFormParam); 
    239             } 
    240  
    241             $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid); 
     177                $objFormParam->setParam($_POST); 
     178                $this->arrErr = $this->lfCheckError($objFormParam); 
     179 
     180                if (SC_Utils_Ex::isBlank($this->arrErr)) { 
     181                    $objPurchase->unsetShippingTemp(); 
     182                    $this->lfRegistData($this->tpl_uniqid, $objPurchase, 
     183                                        $objCustomer, $objFormParam); 
     184 
     185                    $objSiteSess->setRegistFlag(); 
     186                    SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); 
     187                    exit; 
     188                } 
     189                break; 
     190 
     191            // 前のページに戻る 
     192            case 'return': 
     193                SC_Response_Ex::sendRedirect(CART_URLPATH); 
     194                exit; 
     195                break; 
     196 
     197            // 複数配送ページへ遷移 
     198            case 'multiple': 
     199                // 複数配送先指定が無効な場合はエラー 
     200                if (USE_MULTIPLE_SHIPPING === false) { 
     201                    SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); 
     202                    exit; 
     203                } 
     204 
     205                $this->lfInitParam($objFormParam); 
     206                $objFormParam->setParam($_POST); 
     207                $this->arrErr = $this->lfCheckError($objFormParam); 
     208 
     209                if (SC_Utils_Ex::isBlank($this->arrErr)) { 
     210                    $objPurchase->unsetShippingTemp(); 
     211                    $this->lfRegistData($this->tpl_uniqid, $objPurchase, 
     212                                        $objCustomer, $objFormParam, true); 
     213 
     214                    $objSiteSess->setRegistFlag(); 
     215                    SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH); 
     216                    exit; 
     217                } 
     218                $this->tpl_mainpage = $nonmember_mainpage; 
     219                $this->tpl_title = $nonmember_title; 
     220                break; 
     221 
     222            // お客様情報入力ページの表示 
     223            case 'nonmember': 
     224                $this->tpl_mainpage = $nonmember_mainpage; 
     225                $this->tpl_title = $nonmember_title; 
     226                $this->lfInitParam($objFormParam); 
     227                // ※breakなし 
     228 
     229            default: 
     230                // 前のページから戻ってきた場合は, お客様情報入力ページ 
     231                if (isset($_GET['from']) && $_GET['from'] == 'nonmember') { 
     232                    $this->tpl_mainpage = $nonmember_mainpage; 
     233                    $this->tpl_title = $nonmember_title; 
     234                    $this->lfInitParam($objFormParam); 
     235                } 
     236                // 通常はログインページ 
     237                else { 
     238                    $this->lfInitLoginFormParam($objFormParam); 
     239                } 
     240 
     241                $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid); 
     242                break; 
    242243        } 
    243244 
     
    340341    function getNextLocation($product_type_id, $uniqid, &$objCustomer, &$objPurchase, &$objSiteSess) { 
    341342        switch ($product_type_id) { 
    342         case PRODUCT_TYPE_DOWNLOAD: 
    343             $objPurchase->saveOrderTemp($uniqid, array(), $objCustomer); 
    344             $objSiteSess->setRegistFlag(); 
    345             return 'payment.php'; 
    346             break; 
    347  
    348         case PRODUCT_TYPE_NORMAL: 
    349         default: 
    350             return 'deliv.php'; 
     343            case PRODUCT_TYPE_DOWNLOAD: 
     344                $objPurchase->saveOrderTemp($uniqid, array(), $objCustomer); 
     345                $objSiteSess->setRegistFlag(); 
     346                return 'payment.php'; 
     347 
     348            case PRODUCT_TYPE_NORMAL: 
     349            default: 
     350                return 'deliv.php'; 
    351351        } 
    352352    } 
     
    497497    function doLogin(&$objCustomer, $login_email, $login_pass) { 
    498498        switch (SC_Display_Ex::detectDevice()) { 
    499         case DEVICE_TYPE_MOBILE: 
    500             if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($login_pass) && 
    501                !$objCustomer->getCustomerDataFromEmailPass($login_pass, $login_email, true)) { 
    502                 return false; 
    503             } else { 
    504                 $objCustomer->updateMobilePhoneId(); 
    505                 return true; 
    506             } 
    507             break; 
    508  
    509         case DEVICE_TYPE_SMARTPHONE: 
    510         case DEVICE_TYPE_PC: 
    511         default: 
    512             if (!$objCustomer->getCustomerDataFromEmailPass($login_pass, $login_email)) { 
    513                 return false; 
    514             } else { 
    515                 return true; 
    516             } 
     499            case DEVICE_TYPE_MOBILE: 
     500                if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($login_pass) && 
     501                   !$objCustomer->getCustomerDataFromEmailPass($login_pass, $login_email, true)) { 
     502                    return false; 
     503                } else { 
     504                    $objCustomer->updateMobilePhoneId(); 
     505                    return true; 
     506                } 
     507                break; 
     508 
     509            case DEVICE_TYPE_SMARTPHONE: 
     510            case DEVICE_TYPE_PC: 
     511            default: 
     512                if (!$objCustomer->getCustomerDataFromEmailPass($login_pass, $login_email)) { 
     513                    return false; 
     514                } else { 
     515                    return true; 
     516                } 
     517                break; 
    517518        } 
    518519    } 
Note: See TracChangeset for help on using the changeset viewer.