Ignore:
Timestamp:
2007/08/24 21:58:12 (17 years ago)
Author:
nanasess
Message:

リファクタリングと未定義変数の修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/pages/products/LC_Page_Products_Detail.php

    r15178 r15353  
    1818class LC_Page_Products_Detail extends LC_Page { 
    1919 
    20     // TODO 
    2120    /** ステータス */ 
    2221    var $arrSTATUS; 
     
    6362        $objCustomer = new SC_Customer(); 
    6463        $objQuery = new SC_Query(); 
     64        $objDb = new SC_Helper_DB_Ex(); 
    6565 
    6666        // レイアウトデザインを取得 
     
    8181 
    8282        // 管理ページからの確認の場合は、非公開の商品も表示する。 
    83         if($_GET['admin'] == 'on') { 
     83        if(isset($_GET['admin']) && $_GET['admin'] == 'on') { 
    8484            $where = "del_flg = 0"; 
    8585        } else { 
     
    8787        } 
    8888 
    89         if($_POST['mode'] != "") { 
     89        if(isset($_POST['mode']) && $_POST['mode'] != "") { 
    9090            $tmp_id = $_POST['product_id']; 
    9191        } else { 
     
    9494 
    9595        // 値の正当性チェック 
    96         if(!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !SC_Utils_Ex::sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { 
     96        if(!SC_Utils_Ex::sfIsInt($_GET['product_id']) 
     97                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { 
    9798            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 
    9899        } 
     
    135136        $this->tpl_product_id = $tmp_id; 
    136137 
     138        if (!isset($_['mode'])) $_POST['mode'] = ""; 
     139 
    137140        switch($_POST['mode']) { 
    138141        case 'cart': 
     
    253256    function lfMakeSelect($this, $product_id) { 
    254257 
     258        $objDb = new SC_Helper_DB_Ex(); 
    255259        $classcat_find1 = false; 
    256260        $classcat_find2 = false; 
     
    259263 
    260264        // 規格名一覧 
    261         $arrClassName = SC_Utils_Ex::sfGetIDValueList("dtb_class", "class_id", "name"); 
     265        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name"); 
    262266        // 規格分類名一覧 
    263         $arrClassCatName = SC_Utils_Ex::sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
     267        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    264268        // 商品規格情報の取得 
    265269        $arrProductsClass = $this->lfGetProductsClass($product_id); 
    266270 
    267271        // 規格1クラス名の取得 
    268         $this->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']]; 
     272        $this->tpl_class_name1 = isset($arrClassName[$arrProductsClass[0]['class_id1']]) 
     273                                        ? $arrClassName[$arrProductsClass[0]['class_id1']] : ""; 
    269274        // 規格2クラス名の取得 
    270         $this->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']]; 
     275        $this->tpl_class_name2 = isset($arrClassName[$arrProductsClass[0]['class_id2']]) 
     276                                        ? $arrClassName[$arrProductsClass[0]['class_id2']] : ""; 
    271277 
    272278        // すべての組み合わせ数 
     
    303309 
    304310            // セレクトボックス表示値 
     311            if (!isset($arrList[$list_id])) $arrList[$list_id] = ""; 
    305312            if($arrList[$list_id] == "") { 
    306313                $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'"; 
     
    310317 
    311318            // セレクトボックスPOST値 
     319            if (!isset($arrVal[$list_id])) $arrVal[$list_id] = ""; 
    312320            if($arrVal[$list_id] == "") { 
    313321                $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'"; 
     
    352360 
    353361        // 選択されている規格2ID 
    354         $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');"; 
     362        if (!isset($_POST['classcategory_id2'])) $_POST['classcategory_id2'] = ""; 
     363        $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . htmlspecialchars($_POST['classcategory_id2'], ENT_QUOTES) . "');"; 
    355364 
    356365        // 規格1が設定されている 
     
    395404    /* 登録済みオススメ商品の読み込み */ 
    396405    function lfPreGetRecommendProducts($product_id) { 
     406        $arrRecommend = array(); 
    397407        $objQuery = new SC_Query(); 
    398408        $objQuery->setorder("rank DESC"); 
     
    506516 
    507517    function lfConvertParam() { 
     518        if (!isset($this->arrForm['quantity']['value'])) $this->arrForm['quantity']['value'] = ""; 
    508519        $value = $this->arrForm['quantity']['value']; 
    509520        $this->arrForm['quantity']['value'] = htmlspecialchars($value, ENT_QUOTES, CHAR_CODE); 
Note: See TracChangeset for help on using the changeset viewer.