Index: tmp/version-2_5-test/data/class/helper/SC_Helper_Mail.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_Mail.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_Mail.php	(revision 18609)
@@ -45,5 +45,5 @@
 
     /* DBに登録されたテンプレートメールの送信 */
-    function sfSendTemplateMail($to, $to_name, $template_id, &$objPage) {
+    function sfSendTemplateMail($to, $to_name, $template_id, &$objPage, $from_address = "", $from_name = "", $reply_to = "") {
 
         $objQuery = new SC_Query();
@@ -65,8 +65,11 @@
         // メール送信処理
         $objSendMail = new SC_SendMail_Ex();
-        $from = $arrInfo['email03'];
-        $error = $arrInfo['email04'];
-        $tosubject = $tmp_subject;
-        $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error);
+        if ($from_address == "") $from_address = $arrInfo['email03'];
+        if ($from_name == "") $from_name = $arrInfo['shop_name'];
+        if ($reply_to == "") $reply_to = $arrInfo['email03'];
+        $error = $arrInfo['email04'];
+        $tosubject = $this->sfMakeSubject($tmp_subject);
+        
+        $objSendMail->setItem('', $tosubject, $body, $from_address, $from_name, $reply_to, $error, $error);
         $objSendMail->setTo($to, $to_name);
         $objSendMail->sendMail();    // メール送信
@@ -143,7 +146,5 @@
         $from = $arrInfo['email03'];
         $error = $arrInfo['email04'];
-
-        $tosubject = $this->sfMakeSubject($objQuery, $objMailView,
-                                             $objPage, $tmp_subject);
+        $tosubject = $this->sfMakeSubject($tmp_subject);
 
         $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
@@ -162,5 +163,5 @@
 
     // テンプレートを使用したメールの送信
-    function sfSendTplMail($to, $subject, $tplpath, &$objPage) {
+    function sfSendTplMail($to, $tmp_subject, $tplpath, &$objPage) {
         $objMailView = new SC_SiteView();
         $objSiteInfo = new SC_SiteInfo();
@@ -173,14 +174,15 @@
         // メール送信処理
         $objSendMail = new SC_SendMail_Ex();
-        $to = mb_encode_mimeheader($to);
         $bcc = $arrInfo['email01'];
         $from = $arrInfo['email03'];
         $error = $arrInfo['email04'];
-        $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+        $tosubject = $this->sfMakeSubject($tmp_subject);
+        
+        $objSendMail->setItem($to, $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
         $objSendMail->sendMail();
     }
 
     // 通常のメール送信
-    function sfSendMail($to, $subject, $body) {
+    function sfSendMail($to, $tmp_subject, $body) {
         $objSiteInfo = new SC_SiteInfo();
         $arrInfo = $objSiteInfo->data;
@@ -190,19 +192,24 @@
         $from = $arrInfo['email03'];
         $error = $arrInfo['email04'];
-        $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+        $tosubject = $this->sfMakeSubject($tmp_subject);
+        
+        $objSendMail->setItem($to, $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
         $objSendMail->sendMail();
     }
 
     //件名にテンプレートを用いる
-    function sfMakeSubject(&$objQuery, &$objMailView, &$objPage, $subject){
-
+    function sfMakeSubject($subject) {
+        $objQuery = new SC_Query();
+        $objMailView = new SC_SiteView();
+        $objTplAssign = new stdClass;
+        
         $arrInfo = $objQuery->select("*","dtb_baseinfo");
         $arrInfo = $arrInfo[0];
-        $objPage->tpl_shopname=$arrInfo['shop_name'];
-        $objPage->tpl_infoemail=$subject;
-        $objMailView->assignobj($objPage);
-        $mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl');
-        $ret = $mailtitle.$subject;
-        return $ret;
+        $objTplAssign->tpl_shopname=$arrInfo['shop_name'];
+        $objTplAssign->tpl_infoemail=$subject; // 従来互換
+        $objTplAssign->tpl_mailtitle=$subject;
+        $objMailView->assignobj($objTplAssign);
+        $subject = $objMailView->fetch('mail_templates/mail_title.tpl');
+        return $subject;
     }
 
Index: tmp/version-2_5-test/data/class/helper/SC_Helper_DB.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_DB.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_DB.php	(revision 18609)
@@ -96,6 +96,6 @@
      * @param bool $add カラムの作成も行う場合 true
      * @return bool カラムが存在する場合とカラムの生成に成功した場合 true,
-     * 			     テーブルが存在しない場合 false,
-     * 				 引数 $add == false でカラムが存在しない場合 false
+     *               テーブルが存在しない場合 false,
+     *               引数 $add == false でカラムが存在しない場合 false
      */
     function sfColumnExists($table_name, $col_name, $col_type = "", $dsn = "", $add = false) {
@@ -142,6 +142,6 @@
      * @param bool $add インデックスの生成もする場合 true
      * @return bool インデックスが存在する場合とインデックスの生成に成功した場合 true,
-     * 			     テーブルが存在しない場合 false,
-     * 				 引数 $add == false でインデックスが存在しない場合 false
+     *               テーブルが存在しない場合 false,
+     *               引数 $add == false でインデックスが存在しない場合 false
      */
     function sfIndexExists($table_name, $col_name, $index_name, $length = "", $dsn = "", $add = false) {
@@ -201,13 +201,22 @@
      * 店舗基本情報を取得する.
      *
+     * @param boolean $force 強制的にDB取得するか
      * @return array 店舗基本情報の配列
      */
-    function sf_getBasisData() {
-        $objQuery = new SC_Query();
-        $arrRet = $objQuery->select('*', 'dtb_baseinfo');
-
-        if (isset($arrRet[0])) return $arrRet[0];
-
-        return array();
+    function sf_getBasisData($force = false) {
+        static $data;
+
+        if ($force || !isset($data)) {
+            $objQuery = new SC_Query();
+            $arrRet = $objQuery->select('*', 'dtb_baseinfo');
+
+            if (isset($arrRet[0])) {
+                $data = $arrRet[0];
+            } else {
+                $data = array();
+            }
+        }
+
+        return $data;
     }
 
@@ -215,5 +224,5 @@
     function sfGetRootId() {
 
-        if(!$this->g_root_on)	{
+        if(!$this->g_root_on)   {
             $this->g_root_on = true;
             $objQuery = new SC_Query();
@@ -241,13 +250,14 @@
      *
      * @param array $arrID 規格ID
+     * @param boolean $includePrivateProducts 非公開商品を含むか
      * @return array 規格情報の配列
      */
-    function sfGetProductsClass($arrID) {
+    function sfGetProductsClass($arrID, $includePrivateProducts = false) {
         list($product_id, $classcategory_id1, $classcategory_id2) = $arrID;
 
-        if($classcategory_id1 == "") {
+        if (strlen($classcategory_id1) == 0) {
             $classcategory_id1 = '0';
         }
-        if($classcategory_id2 == "") {
+        if (strlen($classcategory_id2) == 0) {
             $classcategory_id2 = '0';
         }
@@ -255,8 +265,10 @@
         // 商品規格取得
         $objQuery = new SC_Query();
-        $col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit, sale_unlimited";
-        $table = "vw_product_class AS prdcls";
-        $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ? AND status = 1";
-        $objQuery->setorder("rank1 DESC, rank2 DESC");
+        $col = 'product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit';
+        $table = 'vw_product_class AS prdcls';
+        $where = 'product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?';
+        if (!$includePrivateProducts) {
+             $where .= ' AND status = 1';
+        }
         $arrRet = $objQuery->select($col, $table, $where, array($product_id, $classcategory_id1, $classcategory_id2));
         return $arrRet[0];
@@ -280,10 +292,12 @@
      * カート内商品の集計処理を行う.
      *
+     * 管理機能での利用は想定していないので注意。(非公開商品は除外される。)
+     *
      * @param LC_Page $objPage ページクラスのインスタンス
      * @param SC_CartSession $objCartSess カートセッションのインスタンス
-     * @param array $arrInfo 商品情報の配列
+     * @param null $dummy1 互換性確保用(決済モジュール互換のため)
      * @return LC_Page 集計処理後のページクラスインスタンス
      */
-    function sfTotalCart(&$objPage, $objCartSess, $arrInfo) {
+    function sfTotalCart(&$objPage, $objCartSess, $dummy1 = null) {
 
         // 規格名一覧
@@ -292,56 +306,52 @@
         $arrClassCatName = $this->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
 
-        $objPage->tpl_total_pretax = 0;		// 費用合計(税込み)
-        $objPage->tpl_total_tax = 0;		// 消費税合計
-        if (USE_POINT === true) {
-            $objPage->tpl_total_point = 0;		// ポイント合計
-        }
+        $objPage->tpl_total_pretax = 0;     // 費用合計(税込み)
+        $objPage->tpl_total_tax = 0;        // 消費税合計
+        $objPage->tpl_total_point = 0;      // ポイント合計
 
         // カート内情報の取得
-        $arrCart = $objCartSess->getCartList();
-        $max = count($arrCart);
+        $arrQuantityInfo_by_product = array();
         $cnt = 0;
-
-        for ($i = 0; $i < $max; $i++) {
+        foreach ($objCartSess->getCartList() as $arrCart) {
             // 商品規格情報の取得
-            $arrData = $this->sfGetProductsClass($arrCart[$i]['id']);
-            $limit = "";
+            $arrData = $this->sfGetProductsClass($arrCart['id']);
+            $limit = null;
             // DBに存在する商品
             if (count($arrData) > 0) {
 
                 // 購入制限数を求める。
-                if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {
-                    if($arrData['sale_limit'] < $arrData['stock']) {
-                        $limit = $arrData['sale_limit'];
+                if ($arrData['stock_unlimited'] != '1' && SC_Utils_Ex::sfIsInt($arrData['sale_limit'])) {
+                    $limit = min($arrData['sale_limit'], $arrData['stock']);
+                } elseif (SC_Utils_Ex::sfIsInt($arrData['sale_limit'])) {
+                    $limit = $arrData['sale_limit'];
+                } elseif ($arrData['stock_unlimited'] != '1') {
+                    $limit = $arrData['stock'];
+                }
+
+                if (!is_null($limit) && $arrCart['quantity'] > $limit) {
+                    if ($limit > 0) {
+                        // カート内商品数を制限に合わせる
+                        $objCartSess->setProductValue($arrCart['id'], 'quantity', $limit);
+                        $quantity = $limit;
+                        $objPage->tpl_message .= "※「" . $arrData['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n";
                     } else {
-                        // 購入制限数を在庫数に
-                        #$limit = $arrData['stock'];
-                        // 購入制限数をSALE_LIMIT_MAXに
-                        $limit = SALE_LIMIT_MAX;
+                        // 売り切れ商品をカートから削除する
+                        $objCartSess->delProduct($arrCart['cart_no']);
+                        $objPage->tpl_message .= "※「" . $arrData['name'] . "」は売り切れました。\n";
+                        break;
                     }
                 } else {
-                    if ($arrData['sale_unlimited'] != '1') {
-                        $limit = $arrData['sale_limit'];
-                    }
-                    if ($arrData['stock_unlimited'] != '1') {
-                        // 購入制限数を在庫数に
-                        #$limit = $arrData['stock'];
-                        // 購入制限数をSALE_LIMIT_MAXに
-                        $limit = SALE_LIMIT_MAX;
-                    }
+                    $quantity = $arrCart['quantity'];
                 }
 
-                if($limit != "" && $limit < $arrCart[$i]['quantity']) {
-                    // カート内商品数を制限に合わせる
-                    $objCartSess->setProductValue($arrCart[$i]['id'], 'quantity', $limit);
-                    $quantity = $limit;
-                    $objPage->tpl_message = "※「" . $arrData['name'] . "」は販売制限しております、一度にこれ以上の購入はできません。";
-                } else {
-                    $quantity = $arrCart[$i]['quantity'];
-                }
+                // (商品規格単位でなく)商品単位での評価のための準備
+                $product_id = $arrCart['id'][0];
+                $arrQuantityInfo_by_product[$product_id]['quantity'] += $quantity;
+                $arrQuantityInfo_by_product[$product_id]['sale_limit'] = $arrData['sale_limit'];
+                $arrQuantityInfo_by_product[$product_id]['name'] = $arrData['name'];
 
                 $objPage->arrProductsClass[$cnt] = $arrData;
                 $objPage->arrProductsClass[$cnt]['quantity'] = $quantity;
-                $objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart[$i]['cart_no'];
+                $objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart['cart_no'];
                 $objPage->arrProductsClass[$cnt]['class_name1'] =
                     isset($arrClassName[$arrData['class_id1']])
@@ -358,45 +368,47 @@
                     $arrClassCatName[$arrData['classcategory_id2']];
 
-                // 画像サイズ
-                $main_image_path = IMAGE_SAVE_DIR . basename($objPage->arrProductsClass[$cnt]["main_image"]);
-                if(file_exists($main_image_path)) {
-                    list($image_width, $image_height) = getimagesize($main_image_path);
-                } else {
-                    $image_width = 0;
-                    $image_height = 0;
-                }
-
-                $objPage->arrProductsClass[$cnt]["tpl_image_width"] = $image_width + 60;
-                $objPage->arrProductsClass[$cnt]["tpl_image_height"] = $image_height + 80;
                 // 価格の登録
                 if ($arrData['price02'] != "") {
-                    $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price02']);
+                    $objCartSess->setProductValue($arrCart['id'], 'price', $arrData['price02']);
                     $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price02'];
                 } else {
-                    $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price01']);
+                    $objCartSess->setProductValue($arrCart['id'], 'price', $arrData['price01']);
                     $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price01'];
                 }
                 // ポイント付与率の登録
-                if (USE_POINT === true) {
-                    $objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']);
+                if (USE_POINT !== false) {
+                    $objCartSess->setProductValue($arrCart['id'], 'point_rate', $arrData['point_rate']);
                 }
                 // 商品ごとの合計金額
-                $objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']);
+                $objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrCart['id']);
                 // 送料の合計を計算する
-                $objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart[$i]['quantity']);
+                $objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart['quantity']);
                 $cnt++;
-            } else { // DBに商品が見つからない場合はカート商品の削除
-                $objPage->tpl_message .= "※申し訳ございませんが、ご購入の直前で売り切れた商品があります。該当商品をカートから削除いたしました。\n";
+            } else { // DBに商品が見つからない場合、
+                $objPage->tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n";
                 // カート商品の削除
-                $objCartSess->delProductKey('id', $arrCart[$i]['id']);
+                $objCartSess->delProduct($arrCart['cart_no']);
+            }
+        }
+
+        foreach ($arrQuantityInfo_by_product as $product_id => $quantityInfo) {
+            if (SC_Utils_Ex::sfIsInt($quantityInfo['sale_limit']) && $quantityInfo['quantity'] > $quantityInfo['sale_limit']) {
+                $objPage->tpl_error = "※「{$quantityInfo['name']}」は数量「{$quantityInfo['sale_limit']}」以下に販売制限しております。一度にこれ以上の購入はできません。\n";
+                // 販売制限に引っかかった商品をマークする
+                foreach (array_keys($objPage->arrProductsClass) as $key) {
+                    $ProductsClass =& $objPage->arrProductsClass[$key];
+                    if ($ProductsClass['product_id'] == $product_id) {
+                        $ProductsClass['error'] = true;
+                    }
+                }
             }
         }
 
         // 全商品合計金額(税込み)
-        $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+        $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal();
         // 全商品合計消費税
-        $objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo);
+        $objPage->tpl_total_tax = $objCartSess->getAllProductsTax();
         // 全商品合計ポイント
-        if (USE_POINT === true) {
+        if (USE_POINT !== false) {
             $objPage->tpl_total_point = $objCartSess->getAllProductsPoint();
         }
@@ -427,4 +439,8 @@
                 $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
             }
+
+            // 受注_Tempテーブルの名称列を更新
+            // ・決済モジュールに対応するため、static メソッドとして扱う
+            SC_Helper_DB_Ex::sfUpdateOrderNameCol($uniqid, true);
         }
     }
@@ -504,7 +520,5 @@
 
         //-- 編集登録実行
-        $objQuery->begin();
         $objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id']));
-        $objQuery->commit();
     }
 
@@ -521,16 +535,16 @@
         $arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
         $customer_id = $arrRet[0]['customer_id'];
-        if($customer_id != "" && $customer_id >= 1) {
-            if (USE_POINT === true) {
+        if ($customer_id != "" && $customer_id >= 1) {
+            if (USE_POINT !== false) {
                 $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
                 $point = $arrRet[0]['point'];
                 $total_point = $arrRet[0]['point'] - $use_point + $add_point;
             } else {
-                $total_point = "";
-                $point = "";
+                $total_point = 0;
+                $point = 0;
             }
         } else {
-            $total_point = 0;
-            $point = 0;
+            $total_point = "";
+            $point = "";
         }
         return array($point, $total_point);
@@ -547,8 +561,8 @@
     function sfGetCustomerPointFromCid($customer_id, $use_point, $add_point) {
         $objQuery = new SC_Query();
-        if (USE_POINT === true) {
-                $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
-                $point = $arrRet[0]['point'];
-                $total_point = $arrRet[0]['point'] - $use_point + $add_point;
+        if (USE_POINT !== false) {
+            $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
+            $point = $arrRet[0]['point'];
+            $total_point = $arrRet[0]['point'] - $use_point + $add_point;
         } else {
             $total_point = 0;
@@ -676,4 +690,20 @@
 
     /**
+     * 指定したカテゴリーIDのカテゴリーを取得する.
+     *
+     * @param integer $category_id カテゴリID
+     * @return array 指定したカテゴリーIDのカテゴリー
+     */
+    function sfGetCat($category_id){
+        $objQuery = new SC_Query();
+
+        // カテゴリーを取得する
+        $arrVal = array($category_id);
+        $res = $objQuery->select('category_id AS id, category_name AS name', 'dtb_category', 'category_id = ?', $arrVal);
+
+        return $res[0];
+    }
+
+    /**
      * 指定したカテゴリーIDの大カテゴリーを取得する.
      *
@@ -746,4 +776,18 @@
     function sfGetLevelCatList($parent_zero = true) {
         $objQuery = new SC_Query();
+
+        // カテゴリ名リストを取得
+        $col = "category_id, parent_category_id, category_name";
+        $where = "del_flg = 0";
+        $objQuery->setoption("ORDER BY level");
+        $arrRet = $objQuery->select($col, "dtb_category", $where);
+        $arrCatName = array();
+        foreach ($arrRet as $arrTmp) {
+            $arrCatName[$arrTmp['category_id']] =
+                (($arrTmp['parent_category_id'] > 0)?
+                    $arrCatName[$arrTmp['parent_category_id']] : "")
+                . CATEGORY_HEAD . $arrTmp['category_name'];
+        }
+
         $col = "category_id, parent_category_id, category_name, level";
         $where = "del_flg = 0";
@@ -763,21 +807,5 @@
             }
 
-            $arrOutput[$cnt] = "";
-
-            // 子カテゴリから親カテゴリを検索
-            $parent_category_id = $arrRet[$cnt]['parent_category_id'];
-            for($cat_cnt = $arrRet[$cnt]['level']; $cat_cnt > 1; $cat_cnt--) {
-
-                foreach ($arrRet as $arrCat) {
-                    // 親が見つかったら順番に代入
-                    if ($arrCat['category_id'] == $parent_category_id) {
-
-                        $arrOutput[$cnt] = CATEGORY_HEAD
-                            . $arrCat['category_name'] . $arrOutput[$cnt];
-                        $parent_category_id = $arrCat['parent_category_id'];
-                    }
-                }
-            }
-            $arrOutput[$cnt].= CATEGORY_HEAD . $arrRet[$cnt]['category_name'];
+            $arrOutput[$cnt] = $arrCatName[$arrRet[$cnt]['category_id']];
         }
 
@@ -804,7 +832,7 @@
             $category_id = (int) $category_id;
             $product_id = (int) $product_id;
-            if(SC_Utils_Ex::sfIsInt($category_id) && $this->sfIsRecord("dtb_category","category_id", $category_id)) {
+            if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && $this->sfIsRecord("dtb_category","category_id", $category_id)) {
                 $this->g_category_id = array($category_id);
-            } else if (SC_Utils_Ex::sfIsInt($product_id) && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) {
+            } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) {
                 $objQuery = new SC_Query();
                 $where = "product_id = ?";
@@ -937,5 +965,4 @@
      */
     function sfCategory_Count($objQuery){
-        $sql = "";
 
         //テーブル内容の削除
@@ -943,30 +970,55 @@
         $objQuery->query("DELETE FROM dtb_category_total_count");
 
+        $sql_where .= 'alldtl.del_flg = 0 AND alldtl.status = 1';
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $sql_where .= ' AND (alldtl.stock_max >= 1 OR alldtl.stock_unlimited_max = 1)';
+        }
+
         //各カテゴリ内の商品数を数えて格納
-        $sql = " INSERT INTO dtb_category_count(category_id, product_count, create_date) ";
-        $sql .= " SELECT T1.category_id, count(T2.category_id), now() ";
-        $sql .= " FROM dtb_category AS T1 LEFT JOIN dtb_product_categories AS T2";
-        $sql .= " ON T1.category_id = T2.category_id ";
-        $sql .= " LEFT JOIN dtb_products AS T3";
-        $sql .= " ON T2.product_id = T3.product_id";
-        $sql .= " WHERE T3.del_flg = 0 AND T3.status = 1 ";
-        $sql .= " GROUP BY T1.category_id, T2.category_id ";
+        $sql = <<< __EOS__
+            INSERT INTO dtb_category_count(category_id, product_count, create_date)
+            SELECT T1.category_id, count(T2.category_id), now()
+            FROM dtb_category AS T1
+                LEFT JOIN dtb_product_categories AS T2
+                    ON T1.category_id = T2.category_id
+                LEFT JOIN vw_products_allclass_detail AS alldtl
+                    ON T2.product_id = alldtl.product_id
+            WHERE $sql_where
+            GROUP BY T1.category_id, T2.category_id
+__EOS__;
+
         $objQuery->query($sql);
 
         //子カテゴリ内の商品数を集計する
-        $arrCat = $objQuery->getAll("SELECT * FROM dtb_category");
-
-        $sql = "";
-        foreach($arrCat as $key => $val){
-
-            // 子ID一覧を取得
-            $arrRet = $this->sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']);
-            $line = SC_Utils_Ex::sfGetCommaList($arrRet);
-
-            $sql = " INSERT INTO dtb_category_total_count(category_id, product_count, create_date) ";
-            $sql .= " SELECT ?, SUM(product_count), now() FROM dtb_category_count ";
-            $sql .= " WHERE category_id IN (" . $line . ")";
-
-            $objQuery->query($sql, array($val['category_id']));
+
+        // カテゴリ情報を取得
+        $arrCat = $objQuery->select('category_id', 'dtb_category');
+
+        foreach ($arrCat as $row) {
+            $category_id = $row['category_id'];
+            $arrval = array();
+
+            $arrval[] = $category_id;
+
+            list($tmp_where, $tmp_arrval) = $this->sfGetCatWhere($category_id);
+            if ($tmp_where != "") {
+                $sql_where_product_ids = "alldtl.product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
+                $arrval = array_merge((array)$arrval, (array)$tmp_arrval);
+            } else {
+                $sql_where_product_ids = '0<>0'; // 一致させない
+            }
+
+            $sql = <<< __EOS__
+                INSERT INTO dtb_category_total_count (category_id, product_count, create_date)
+                SELECT
+                    ?
+                    ,count(*)
+                    ,now()
+                FROM vw_products_allclass_detail AS alldtl
+                WHERE ($sql_where) AND ($sql_where_product_ids)
+__EOS__;
+
+            $objQuery->query($sql, $arrval);
         }
     }
@@ -1097,5 +1149,5 @@
         foreach ($arrRet as $val) {
             if($tmp_where == "") {
-                $tmp_where.= " category_id IN ( ?";
+                $tmp_where.= "category_id IN ( ?";
             } else {
                 $tmp_where.= ",? ";
@@ -1245,4 +1297,5 @@
 
         $max = $objQuery->max($tableName, "rank", $where);
+
         // 値の調整（逆順）
         if($pos > $max) {
@@ -1268,11 +1321,14 @@
             $sql.= " AND $where";
         }
-        if( $position > $rank ) $objQuery->exec( $sql, array($rank, $position));
-        if( $position < $rank ) $objQuery->exec( $sql, array($position, $rank));
-           // 指定した順位へrankを書き換える。
+
+        if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position ));
+        if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 ));
+
+        // 指定した順位へrankを書き換える。
         $sql  = "UPDATE $tableName SET rank = ? WHERE $keyIdColumn = ? ";
         if($where != "") {
             $sql.= " AND $where";
         }
+
         $objQuery->exec( $sql, array( $position, $keyId ) );
         $objQuery->commit();
@@ -1413,6 +1469,5 @@
      * 都道府県、支払い方法から配送料金を取得する.
      *
-     * @param integer $pref 都道府県ID
-     * @param integer $payment_id 支払い方法ID
+     * @param array $arrData 各種情報
      * @return string 指定の都道府県, 支払い方法の配送料金
      */
@@ -1460,9 +1515,12 @@
      * @param LC_Page $objPage LC_Page インスタンス
      * @param SC_CartSession $objCartSess SC_CartSession インスタンス
-     * @param array $arrInfo 店舗情報の配列
+     * @param null $dummy1 互換性確保用(決済モジュール互換のため)
      * @param SC_Customer $objCustomer SC_Customer インスタンス
      * @return array 最終計算後の配列
      */
-    function sfTotalConfirm($arrData, &$objPage, &$objCartSess, $arrInfo, $objCustomer = "") {
+    function sfTotalConfirm($arrData, &$objPage, &$objCartSess, $dummy1 = null, $objCustomer = "") {
+        // 店舗基本情報を取得する
+        $arrInfo = SC_Helper_DB_Ex::sf_getBasisData();
+
         // 未定義変数を定義
         if (!isset($arrData['deliv_pref'])) $arrData['deliv_pref'] = "";
@@ -1470,7 +1528,5 @@
         if (!isset($arrData['charge'])) $arrData['charge'] = "";
         if (!isset($arrData['use_point'])) $arrData['use_point'] = "";
-
-        // 商品の合計個数
-        $total_quantity = $objCartSess->getTotalQuantity(true);
+        if (!isset($arrData['add_point'])) $arrData['add_point'] = 0;
 
         // 税金の取得
@@ -1484,15 +1540,19 @@
         // 商品ごとの送料が有効の場合
         if (OPTION_PRODUCT_DELIV_FEE == 1) {
-            $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee();
+            // 全商品の合計送料を加算する
+            $this->lfAddAllProductsDelivFee($arrData, $objPage, $objCartSess);
         }
 
         // 配送業者の送料が有効の場合
         if (OPTION_DELIV_FEE == 1) {
-            // 送料の合計を計算する
-            $arrData['deliv_fee'] += $this->sfGetDelivFee($arrData);
+            // 都道府県、支払い方法から配送料金を加算する
+            $this->lfAddDelivFee($arrData);
         }
 
         // 送料無料の購入数が設定されている場合
-        if(DELIV_FREE_AMOUNT > 0) {
+        if (DELIV_FREE_AMOUNT > 0) {
+            // 商品の合計数量
+            $total_quantity = $objCartSess->getTotalQuantity(true);
+
             if($total_quantity >= DELIV_FREE_AMOUNT) {
                 $arrData['deliv_fee'] = 0;
@@ -1509,14 +1569,12 @@
 
         // 合計の計算
-        $arrData['total'] = $objPage->tpl_total_pretax;	// 商品合計
-        $arrData['total']+= $arrData['deliv_fee'];		// 送料
-        $arrData['total']+= $arrData['charge'];			// 手数料
+        $arrData['total'] = $objPage->tpl_total_pretax; // 商品合計
+        $arrData['total']+= $arrData['deliv_fee'];      // 送料
+        $arrData['total']+= $arrData['charge'];         // 手数料
         // お支払い合計
         $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE);
         // 加算ポイントの計算
-        if (USE_POINT === false) {
-            $arrData['add_point'] = 0;
-        } else {
-            $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo);
+        if (USE_POINT !== false) {
+            $arrData['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point']);
 
             if($objCustomer != "") {
@@ -1571,4 +1629,354 @@
     }
 
+    /**
+     * メーカー商品数数の登録を行う.
+     *
+     * @param SC_Query $objQuery SC_Query インスタンス
+     * @return void
+     */
+    function sfMaker_Count($objQuery){
+        $sql = "";
+
+        //テーブル内容の削除
+        $objQuery->query("DELETE FROM dtb_maker_count");
+
+        //各メーカーの商品数を数えて格納
+        $sql = " INSERT INTO dtb_maker_count(maker_id, product_count, create_date) ";
+        $sql .= " SELECT T1.maker_id, count(T2.maker_id), now() ";
+        $sql .= " FROM dtb_maker AS T1 LEFT JOIN dtb_products AS T2";
+        $sql .= " ON T1.maker_id = T2.maker_id ";
+        $sql .= " WHERE T2.del_flg = 0 AND T2.status = 1 ";
+        $sql .= " GROUP BY T1.maker_id, T2.maker_id ";
+        $objQuery->query($sql);
+    }
+
+    /**
+     * 選択中の商品のメーカーを取得する.
+     *
+     * @param integer $product_id プロダクトID
+     * @param integer $maker_id メーカーID
+     * @return array 選択中の商品のメーカーIDの配列
+     *
+     */
+    function sfGetMakerId($product_id, $maker_id = 0, $closed = false) {
+        if ($closed) {
+            $status = "";
+        } else {
+            $status = "status = 1";
+        }
+
+        if (!$this->g_maker_on) {
+            $this->g_maker_on = true;
+            $maker_id = (int) $maker_id;
+            $product_id = (int) $product_id;
+            if (SC_Utils_Ex::sfIsInt($maker_id) && $maker_id != 0 && $this->sfIsRecord("dtb_maker","maker_id", $maker_id)) {
+                $this->g_maker_id = array($maker_id);
+            } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) {
+                $objQuery = new SC_Query();
+                $where = "product_id = ?";
+                $maker_id = $objQuery->getCol("dtb_products", "maker_id", "product_id = ?", array($product_id));
+                $this->g_maker_id = $maker_id;
+            } else {
+                // 不正な場合は、空の配列を返す。
+                $this->g_maker_id = array();
+            }
+        }
+        return $this->g_maker_id;
+    }
+
+    /**
+     * メーカーの取得を行う.
+     *
+     * $products_check:true商品登録済みのものだけ取得する
+     *
+     * @param string $addwhere 追加する WHERE 句
+     * @param bool $products_check 商品の存在するカテゴリのみ取得する場合 true
+     * @return array カテゴリツリーの配列
+     */
+    function sfGetMakerList($addwhere = "", $products_check = false) {
+        $objQuery = new SC_Query();
+        $where = "del_flg = 0";
+
+        if($addwhere != "") {
+            $where.= " AND $addwhere";
+        }
+
+        $objQuery->setoption("ORDER BY rank DESC");
+
+        if($products_check) {
+            $col = "T1.maker_id, name";
+            $from = "dtb_maker AS T1 LEFT JOIN dtb_maker_count AS T2 ON T1.maker_id = T2.maker_id";
+            $where .= " AND product_count > 0";
+        } else {
+            $col = "maker_id, name";
+            $from = "dtb_maker";
+        }
+
+        $arrRet = $objQuery->select($col, $from, $where);
+
+        $max = count($arrRet);
+        for($cnt = 0; $cnt < $max; $cnt++) {
+            $id = $arrRet[$cnt]['maker_id'];
+            $name = $arrRet[$cnt]['name'];
+            $arrList[$id].= $name;
+        }
+        return $arrList;
+    }
+
+    /**
+     * 全商品の合計送料を加算する
+     */
+    function lfAddAllProductsDelivFee(&$arrData, &$objPage, &$objCartSess) {
+        $arrData['deliv_fee'] += $this->lfCalcAllProductsDelivFee($arrData, $objCartSess);
+    }
+
+    /**
+     * 全商品の合計送料を計算する
+     */
+    function lfCalcAllProductsDelivFee(&$arrData, &$objCartSess) {
+        $objQuery = new SC_Query();
+        $deliv_fee_total = 0;
+        $max = $objCartSess->getMax();
+        for ($i = 0; $i <= $max; $i++) {
+            // 商品送料
+            $deliv_fee = $objQuery->getOne('SELECT deliv_fee FROM dtb_products WHERE product_id = ?', array($_SESSION[$objCartSess->key][$i]['id'][0]));
+            // 数量
+            $quantity = $_SESSION[$objCartSess->key][$i]['quantity'];
+            // 累積
+            $deliv_fee_total += $deliv_fee * $quantity;
+        }
+        return $deliv_fee_total;
+    }
+
+    /**
+     * 都道府県、支払い方法から配送料金を加算する.
+     *
+     * @param array $arrData 各種情報
+     */
+    function lfAddDelivFee(&$arrData) {
+        $arrData['deliv_fee'] += $this->sfGetDelivFee($arrData);
+    }
+
+    /**
+     * 受注の名称列を更新する
+     *
+     * @param integer $order_id 更新対象の注文番号
+     * @param boolean $temp_table 更新対象は「受注_Temp」か
+     * @static
+     */
+    function sfUpdateOrderNameCol($order_id, $temp_table = false) {
+        $objQuery = new SC_Query();
+
+        if ($temp_table) {
+            $tgt_table = 'dtb_order_temp';
+            $sql_where = 'WHERE order_temp_id = ?';
+        } else {
+            $tgt_table = 'dtb_order';
+            $sql_where = 'WHERE order_id = ?';
+        }
+
+        $sql = <<< __EOS__
+            UPDATE
+                {$tgt_table}
+            SET
+                 payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = {$tgt_table}.payment_id)
+                ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = {$tgt_table}.deliv_time_id AND deliv_id = {$tgt_table}.deliv_id)
+            $sql_where
+__EOS__;
+
+        $objQuery->query($sql, array($order_id));
+    }
+
+    /**
+     * 店舗基本情報に基づいて税金額を返す
+     *
+     * @param integer $price 計算対象の金額
+     * @return integer 税金額
+     */
+    function sfTax($price) {
+        // 店舗基本情報を取得
+        $CONF = SC_Helper_DB_Ex::sf_getBasisData();
+
+        return SC_Utils_Ex::sfTax($price, $CONF['tax'], $CONF['tax_rule']);
+    }
+
+    /**
+     * 店舗基本情報に基づいて税金付与した金額を返す
+     * 
+     * @param integer $price 計算対象の金額
+     * @return integer 税金付与した金額
+     */
+    function sfPreTax($price, $tax = null, $tax_rule = null) {
+        // 店舗基本情報を取得
+        $CONF = SC_Helper_DB_Ex::sf_getBasisData();
+
+        return SC_Utils_Ex::sfPreTax($price, $CONF['tax'], $CONF['tax_rule']);
+    }
+
+    /**
+     * 店舗基本情報に基づいて加算ポイントを返す
+     *
+     * @param integer $totalpoint
+     * @param integer $use_point
+     * @return integer 加算ポイント
+     */
+    function sfGetAddPoint($totalpoint, $use_point) {
+        // 店舗基本情報を取得
+        $CONF = SC_Helper_DB_Ex::sf_getBasisData();
+
+        return SC_Utils_Ex::sfGetAddPoint($totalpoint, $use_point, $CONF['point_rate']);
+    }
+
+    /**
+     * 受注.対応状況の更新
+     *
+     * ・必ず呼び出し元でトランザクションブロックを開いておくこと。
+     *
+     * @param integer $orderId 注文番号
+     * @param integer|null $newStatus 対応状況 (null=変更無し)
+     * @param integer|null $newAddPoint 加算ポイント (null=変更無し)
+     * @param integer|null $newUsePoint 使用ポイント (null=変更無し)
+     * @return void
+     */
+    function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddPoint = null, $newUsePoint = null) {
+        $objQuery = new SC_Query();
+
+        $arrOrderOld = $objQuery->getRow('dtb_order', 'status, add_point, use_point, customer_id', 'order_id = ?', array($orderId));
+
+        // 対応状況が変更無しの場合、DB値を引き継ぐ
+        if (is_null($newStatus)) {
+            $newStatus = $arrOrderOld['status'];
+        }
+
+        // 使用ポイント、DB値を引き継ぐ
+        if (is_null($newUsePoint)) {
+            $newUsePoint = $arrOrderOld['use_point'];
+        }
+
+        // 加算ポイント、DB値を引き継ぐ
+        if (is_null($newAddPoint)) {
+            $newAddPoint = $arrOrderOld['add_point'];
+        }
+
+        if (USE_POINT !== false) {
+            // 顧客.ポイントの加減値
+            $addCustomerPoint = 0;
+
+            // ▼使用ポイント
+            // 変更前の対応状況が利用対象の場合、変更前の使用ポイント分を戻す
+            if (SC_Utils_Ex::sfIsUsePoint($arrOrderOld['status'])) {
+                $addCustomerPoint += $arrOrderOld['use_point'];
+            }
+
+            // 変更後の対応状況が利用対象の場合、変更後の使用ポイント分を引く
+            if (SC_Utils_Ex::sfIsUsePoint($newStatus)) {
+                $addCustomerPoint -= $newUsePoint;
+            }
+            // ▲使用ポイント
+
+            // ▼加算ポイント
+            // 変更前の対応状況が加算対象の場合、変更前の加算ポイント分を戻す
+            if (SC_Utils_Ex::sfIsAddPoint($arrOrderOld['status'])) {
+                $addCustomerPoint -= $arrOrderOld['add_point'];
+            }
+
+            // 変更後の対応状況が加算対象の場合、変更後の加算ポイント分を足す
+            if (SC_Utils_Ex::sfIsAddPoint($newStatus)) {
+                $addCustomerPoint += $newAddPoint;
+            }
+            // ▲加算ポイント
+
+            if ($addCustomerPoint != 0) {
+                // ▼顧客テーブルの更新
+                $sqlval = array();
+                $where = '';
+                $arrVal = array();
+                $arrRawSql = array();
+                $arrRawSqlVal = array();
+
+                $sqlval['update_date'] = 'Now()';
+                $arrRawSql['point'] = 'point + ?';
+                $arrRawSqlVal[] = $addCustomerPoint;
+                $where .= 'customer_id = ?';
+                $arrVal[] = $arrOrderOld['customer_id'];
+
+                $objQuery->update('dtb_customer', $sqlval, $where, $arrVal, $arrRawSql, $arrRawSqlVal);
+                // ▲顧客テーブルの更新
+
+                // 顧客.ポイントをマイナスした場合、
+                if ($addCustomerPoint < 0) {
+                    $sql = 'SELECT point FROM dtb_customer WHERE customer_id = ?';
+                    $point = $objQuery->getone($sql, array($arrOrderOld['customer_id']));
+                    // 変更後の顧客.ポイントがマイナスの場合、
+                    if ($point < 0) {
+                        // ロールバック
+                        $objQuery->rollback();
+                        // エラー
+                        SC_Utils_Ex::sfDispSiteError(LACK_POINT);
+                    }
+                }
+            }
+        }
+
+        // ▼受注テーブルの更新
+        $sqlval = array();
+        if (USE_POINT !== false) {
+            $sqlval['add_point'] = $newAddPoint;
+            $sqlval['use_point'] = $newUsePoint;
+        }
+        // ステータスが発送済みに変更の場合、発送日を更新
+        if ($arrOrderOld['status'] != ORDER_DELIV && $newStatus == ORDER_DELIV) {
+            $sqlval['commit_date'] = 'Now()';
+        }
+        $sqlval['status'] = $newStatus;
+        $sqlval['update_date'] = 'Now()';
+
+        $objQuery->update('dtb_order', $sqlval, 'order_id = ?', array($orderId));
+        // ▲受注テーブルの更新
+    }
+
+    /**
+     * 指定ファイルが存在する場合 SQL として実行
+     *
+     * ・MySQL の場合、文字「;」を区切りとして、分割実行。
+     * XXX プラグイン用に追加。将来消すかも。
+     *
+     * @param string $sqlFilePath SQL ファイルのパス
+     * @return void
+     */
+    function sfExecSqlByFile($sqlFilePath) {
+        if (file_exists($sqlFilePath)) {
+            $objQuery = new SC_Query();
+
+            $sqls = file_get_contents($sqlFilePath);
+            if ($sqls === false) SC_Utils_Ex::sfDispException('ファイルは存在するが読み込めない');
+
+            if (DB_TYPE == 'mysql') {
+                foreach (explode(';', $sqls) as $sql) {
+                    $sql = trim($sql);
+                    if (strlen($sql) == 0) continue;
+                    $objQuery->query($sql);
+                }
+            } else {
+                $objQuery->query($sqls);
+            }
+        }
+    }
+
+    /**
+     * 商品規格を設定しているか
+     *
+     * @param integer $product_id 商品ID
+     * @return bool 商品規格が存在する場合:true, それ以外:false
+     */
+    function sfHasProductClass($product_id) {
+        if (!SC_Utils_Ex::sfIsInt($product_id)) return false;
+
+        $objQuery  = new SC_Query();
+        $where = 'product_id = ? AND (classcategory_id1 <> 0 OR classcategory_id2 <> 0)';
+        $count = $objQuery->count('dtb_products_class', $where, array($product_id));
+
+        return $count >= 1;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/helper/SC_Helper_Mobile.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_Mobile.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_Mobile.php	(revision 18609)
@@ -38,5 +38,5 @@
     /**
      * EC-CUBE がサポートする携帯端末かどうかをチェックする。
-     * 非対応端末の場合は unsupported/index.php へリダイレクトする。
+     * 非対応端末の場合は /mobile/unsupported/ へリダイレクトする。
      *
      * @return void
@@ -44,5 +44,5 @@
     function lfMobileCheckCompatibility() {
         if (!SC_MobileUserAgent::isSupported()) {
-            header('Location: ' . URL_DIR . 'mobile/unsupported/index.php');
+            header('Location: ' . URL_DIR . 'mobile/unsupported/' . DIR_INDEX_URL);
             exit;
         }
@@ -390,7 +390,12 @@
         $objQuery = new SC_Query;
 
-        $arrRow = $objQuery->getrow('dtb_mobile_kara_mail', 'session_id, next_url, email',
-                                    'token = ? AND email IS NOT NULL AND receive_date >= ?',
-                                    array($token, date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME)));
+        $arrRow = $objQuery->getRow(
+             'dtb_mobile_kara_mail'
+            ,'session_id, next_url, email'
+            ,'token = ? AND email IS NOT NULL AND receive_date >= ?'
+            ,array($token, date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME))
+            ,DB_FETCHMODE_ORDERED
+        );
+        
         if (!isset($arrRow)) {
             return false;
Index: tmp/version-2_5-test/data/class/helper/SC_Helper_FileManager.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_FileManager.php	(revision 16701)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_FileManager.php	(revision 18609)
@@ -340,4 +340,19 @@
     }
     
+    /**
+     * ファイル書込を行う.
+     *
+     * @param string $filename ファイルパス
+     * @param string $value 書き込み内容
+     */
+    function sfWriteFile($filename, $value) {
+        $fp = @fopen($filename, "w");
+        // ファイルに書き込む
+        if($fp) {
+            fwrite($fp, $value);
+        }
+        @fclose($fp);
+    }
+
 	/**
 	 * ユーザが作成したファイルをアーカイブしダウンロードさせる
Index: tmp/version-2_5-test/data/class/helper/SC_Helper_PageLayout.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_PageLayout.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_PageLayout.php	(revision 18609)
@@ -46,5 +46,5 @@
     function sfGetPageLayout(&$objPage, $preview = false, $url = ""){
         $debug_message = "";
-    	$arrPageLayout = array();
+        $arrPageLayout = array();
 
         // 現在のURLの取得
@@ -53,15 +53,18 @@
                 $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
             }
+            
+            $url2 = preg_replace('|^http://[^/]+' . preg_quote(URL_DIR) . '|', '', $url);
             // URLを元にページデザインを取得
-            $arrPageData = $this->lfgetPageData(" url = ? " , array($url));
-        }else{
-            $arrPageData = $this->lfgetPageData(" page_id = ? " , array("0"));
+            $arrPageData = $this->lfgetPageData("url IN (?, ?) AND page_id <> 0" , array($url2, $url)); // $url は従来互換
+        } else {
+            $arrPageData = $this->lfgetPageData("page_id = 0");
             $objPage->tpl_mainpage = USER_PATH . "templates/preview/"
                 . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl";
         }
-        
-        reset($arrPageData[0]);
-		while( list($key,$val) = each($arrPageData[0]) ){
-        	 $debug_message.= "arrPageData[$key]：" . $val . "\n";
+
+        if (!empty($arrPageData[0])) {
+            foreach($arrPageData[0] as $key => $val) {
+                $debug_message.= "arrPageData[$key]：" . $val . "\n";
+            }
         }
         
@@ -97,11 +100,17 @@
 
         // 全ナビデータを取得する
-        $arrNavi = $this->lfGetNaviData($url, $preview);
-
-        $arrPageLayout['LeftNavi']  = $this->lfGetNavi($arrNavi,1);	// LEFT NAVI
-        $arrPageLayout['MainHead']  = $this->lfGetNavi($arrNavi,2);	// メイン上部
-        $arrPageLayout['RightNavi'] = $this->lfGetNavi($arrNavi,3);	// RIGHT NAVI
-        $arrPageLayout['MainFoot']  = $this->lfGetNavi($arrNavi,4);	// メイン下部
-
+        $arrNavi = $this->lfGetNaviData($arrPageLayout['page_id']);
+
+        $arrPageLayout['LeftNavi']  = $this->lfGetNavi($arrNavi,1);    // LEFT NAVI
+        $arrPageLayout['MainHead']  = $this->lfGetNavi($arrNavi,2);    // メイン上部
+        $arrPageLayout['RightNavi'] = $this->lfGetNavi($arrNavi,3);    // RIGHT NAVI
+        $arrPageLayout['MainFoot']  = $this->lfGetNavi($arrNavi,4);    // メイン下部
+        $arrPageLayout['TopNavi'] = $this->lfGetNavi($arrNavi,5); //上部
+        $arrPageLayout['BottomNavi'] = $this->lfGetNavi($arrNavi,6); //下部
+        $arrPageLayout['HeadNavi'] = $this->lfGetNavi($arrNavi,7); //上部
+        $arrPageLayout['HeaderTopNavi'] = $this->lfGetNavi($arrNavi,8); //上部
+        $arrPageLayout['FooterBottomNavi'] = $this->lfGetNavi($arrNavi,9); //下部
+        
+        
         GC_Utils::gfDebugLog($arrPageLayout);
         
@@ -121,37 +130,34 @@
      * @return array ページ情報を格納した配列
      */
-    function lfgetPageData($addwhere = '', $sqlval = ''){
-        $objQuery = new SC_Query;		// DB操作オブジェクト
-        $arrRet = array();				// データ取得用
-
-        // SQL文生成
+    function lfgetPageData($where = 'page_id <> 0', $where_vals = array()) {
+                
+        $objQuery = new SC_Query;       // DB操作オブジェクト
+        $arrRet = array();              // データ取得用
+
         // 取得するカラム
-        $col  = " page_id";				// ページID
-        $col .= " ,page_name";			// 名称
-        $col .= " ,url";				// URL
-        $col .= " ,php_dir";			// php保存先ディレクトリ
-        $col .= " ,tpl_dir";			// tpl保存先ディレクトリ
-        $col .= " ,filename";			// ファイル名称
-        $col .= " ,header_chk ";		// ヘッダー使用FLG
-        $col .= " ,footer_chk ";		// フッター使用FLG
-        $col .= " ,edit_flg ";			// 編集可能FLG
-        $col .= " ,author";				// authorタグ
-        $col .= " ,description";		// descriptionタグ
-        $col .= " ,keyword";			// keywordタグ
-        $col .= " ,update_url";			// 更新URL
-        $col .= " ,create_date";		// データ作成日
-        $col .= " ,update_date";		// データ更新日
+        $col  = " page_id";             // ページID
+        $col .= " ,page_name";          // 名称
+        $col .= " ,url";                // URL
+        $col .= " ,php_dir";            // php保存先ディレクトリ
+        $col .= " ,tpl_dir";            // tpl保存先ディレクトリ
+        $col .= " ,filename";           // ファイル名称
+        $col .= " ,header_chk ";        // ヘッダー使用FLG
+        $col .= " ,footer_chk ";        // フッター使用FLG
+        $col .= " ,edit_flg ";          // 編集可能FLG
+        $col .= " ,author";             // authorタグ
+        $col .= " ,description";        // descriptionタグ
+        $col .= " ,keyword";            // keywordタグ
+        $col .= " ,update_url";         // 更新URL
+        $col .= " ,create_date";        // データ作成日
+        $col .= " ,update_date";        // データ更新日
         
         // 取得するテーブル
         $table = "dtb_pagelayout";
         
-        // where句の指定があれば追加
-        $where = ($addwhere != '') ? $addwhere : "page_id <> 0";
-        
         // 並び変え
         $objQuery->setOrder('page_id');
         
         // SQL実行
-        $arrRet = $objQuery->select($col, $table, $where, $sqlval);
+        $arrRet = $objQuery->select($col, $table, $where, $where_vals);
         
         // 結果を返す
@@ -163,34 +169,25 @@
      *
      * @param string $url ページのURL
-     * @param boolean $preview プレビュー表示の場合 true
      * @return array ナビ情報の配列
      */
-    function lfGetNaviData($url, $preview=false){
+    function lfGetNaviData($page_id){
         $objQuery = new SC_Query;		// DB操作オブジェクト
-        $sql = "";						// データ取得SQL生成用
-        $arrRet = array();				// データ取得用
-        $arrData = array();
-
-        // SQL文生成
+
         // 取得するカラム
-        $col = "target_id, bloc_name, tpl_path, php_path";
+        $col = "target_id, bloc_name, tpl_path, php_path,anywhere";
         
         // 取得するテーブル
-        $table = "dtb_blocposition AS pos, dtb_bloc AS bloc";
+        $table = "dtb_blocposition AS pos INNER JOIN dtb_bloc AS bloc ON bloc.bloc_id = pos.bloc_id";
         
         // where文生成
-        $where = "bloc.bloc_id = pos.bloc_id";
-        if ($preview == true) {
-            $where .= " AND EXISTS (SELECT page_id FROM dtb_pagelayout AS lay WHERE page_id = '0' AND pos.page_id = lay.page_id)";
-        }else{
-            $where .= " AND EXISTS (SELECT page_id FROM dtb_pagelayout AS lay WHERE url = ? AND page_id <> '0' AND pos.page_id = lay.page_id)";
-            $sqlval = array($url);
-        }
+        $where = "anywhere = 1 OR page_id = ?";
+        $where_vals[] = $page_id;
+
         // 並び変え
         $objQuery->setOrder('target_id, bloc_row');
         
         // SQL実行
-        $arrRet = $objQuery->select($col, $table, $where, $sqlval);
-                                            
+        $arrRet = $objQuery->select($col, $table, $where, $where_vals);
+        
         // 結果を返す
         return $arrRet;
@@ -206,18 +203,17 @@
     function lfGetNavi($arrNavi, $target_id) {
         $arrRet = array();
-        if(is_array($arrNavi) === true) {
-        	reset($arrNavi);
-            while( list($key,$val)= each($arrNavi) ){
-            	// 指定された箇所と同じデータだけを取得する
-                if ($target_id == $val['target_id']){
+        if(is_array($arrNavi)) {
+            foreach($arrNavi as $key => $val){
+                // 指定された箇所と同じデータだけを取得する
+                if ($target_id == $val['target_id'] ){
                     if ($val['php_path'] != '') {
                         $arrNavi[$key]['php_path'] = HTML_PATH . $val['php_path'];
                     }else{
-                    	$user_block_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . $val['tpl_path'];
-                    	if(is_file($user_block_path)) {
-                    	   $arrNavi[$key]['tpl_path'] = $user_block_path;
-                    	} else {
-                           $arrNavi[$key]['tpl_path'] = TEMPLATE_DIR . $val['tpl_path'];
-                    	}
+                        $user_block_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . $val['tpl_path'];
+                        if(is_file($user_block_path)) {
+                            $arrNavi[$key]['tpl_path'] = $user_block_path;
+                        } else {
+                            $arrNavi[$key]['tpl_path'] = TEMPLATE_DIR . $val['tpl_path'];
+                        }
                     }
                     
@@ -258,9 +254,7 @@
      */
     function lfDelPageData($page_id){
-    	// DBへデータを更新する
         $objQuery = new SC_Query;		// DB操作オブジェクト
-        $sql = "";						// データ更新SQL生成用
-        $ret = ""; 						// データ更新結果格納用
-        $arrDelData = array();			// 更新データ生成用
+        $ret = "";                  // 結果格納用
+        $arrDelData = array();      // 抽出データ用
 
         // page_id が空でない場合にはdeleteを実行
Index: tmp/version-2_5-test/data/class/helper/SC_Helper_CSV.php
===================================================================
--- tmp/version-2_5-test/data/class/helper/SC_Helper_CSV.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/helper/SC_Helper_CSV.php	(revision 18609)
@@ -99,4 +99,5 @@
     }
 
+
     // CSVを送信する。(商品)
     function sfDownloadProductsCsv($where, $arrval, $order) {
@@ -116,5 +117,5 @@
             ,$arrval
         );
-
+        
         // 規格分類名一覧
         if (in_array('classcategory_id1', $arrOutputCols) || in_array('classcategory_id2', $arrOutputCols)) {
@@ -124,8 +125,8 @@
 
         $outputArray = array();
-
+        
         // ヘッダ行
         $outputArray[] = $arrOutput['disp_name'];
-
+        
         // データ行
         foreach ($dataRows as $row) {
@@ -145,15 +146,15 @@
                                   "category_id",
                                   "product_id = ?",
-                                   array($row['product_id']));
-         }
-
-           $outputArray[] = $row;
-       }
-
-       // CSVを送信する。
-       $this->lfDownloadCsv($outputArray);
-
-       // 成功終了
-       return true;
+                                  array($row['product_id']));
+            }
+
+            $outputArray[] = $row;
+        }
+        
+        // CSVを送信する。
+        $this->lfDownloadCsv($outputArray);
+        
+        // 成功終了
+        return true;
     }
 
@@ -200,7 +201,7 @@
     function sfDownloadCategoryCsv() {
 
-    // CSV出力タイトル行の作成
-    $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1"));
-    if (count($arrOutput) <= 0) return false; // 失敗終了
+        // CSV出力タイトル行の作成
+        $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1"));
+        if (count($arrOutput) <= 0) return false; // 失敗終了
         $arrOutputCols = $arrOutput['col'];
 
@@ -213,18 +214,18 @@
             ,'del_flg = 0'
         );
-
+        
         $outputArray = array();
-
+        
         // ヘッダ行
         $outputArray[] = $arrOutput['disp_name'];
-
+        
         // データ行
         foreach ($dataRows as $row) {
             $outputArray[] = $row;
         }
-
+        
         // CSVを送信する。
         $this->lfDownloadCsv($outputArray, 'category');
-
+        
         // 成功終了
         return true;
@@ -253,16 +254,15 @@
     function lfMakeCSV($list) {
         $line = "";
-
-        reset($list);
-        while(list($key, $val) = each($list)){
+		
+        foreach($list as $key => $val) {
             $tmp = "";
             switch($key) {
-            case 'order_pref':
-            case 'deliv_pref':
-                $tmp = $this->arrPref[$val];
-                break;
-            default:
-                $tmp = $val;
-                break;
+                case 'order_pref':
+                case 'deliv_pref':
+                    $tmp = $this->arrPref[$val];
+                    break;
+                default:
+                    $tmp = $val;
+                    break;
             }
 
@@ -278,6 +278,6 @@
     function lfMakeReviewCSV($list) {
         $line = "";
-        reset($list);
-        while(list($key, $val) = each($list)){
+
+        foreach($list as $key => $val) {
             $tmp = "";
             switch($key) {
@@ -307,7 +307,8 @@
     // 各項目をCSV出力用に変換する。(トラックバック)
     function lfMakeTrackbackCSV($list) {
+
         $line = "";
-        reset($list);
-        while(list($key, $val) = each($list)){
+
+        foreach($list as $key => $val) {
             $tmp = "";
             switch($key) {
@@ -403,6 +404,5 @@
                                            );
     }
-
-
+    
     /**
      * 1次元配列を1行のCSVとして返す
@@ -410,23 +410,23 @@
      */
     function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') {
-
+        
         if( strlen($delimiter) != 1 ) {
             trigger_error('delimiter must be a single character', E_USER_WARNING);
             return "";
         }
-
+        
         if( strlen($enclosure) < 1 ) {
             trigger_error('enclosure must be a single character', E_USER_WARNING);
             return "";
         }
-
+        
         foreach (array_keys($fields) as $key) {
             $field =& $fields[$key];
-
+            
             // 配列を「|」区切りの文字列に変換する
             if (is_array($field)) {
                 $field = implode($arrayDelimiter, $field);
             }
-
+            
             /* enclose a field that contains a delimiter, an enclosure character, or a newline */
             if (
@@ -437,8 +437,8 @@
             }
         }
-
+        
         return implode($delimiter, $fields);
     }
-
+    
     /**
      * CSVを送信する。
Index: tmp/version-2_5-test/data/class/SC_Query.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Query.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_Query.php	(revision 18609)
@@ -86,12 +86,10 @@
      * @param string $where WHERE句
      * @param array $arrval プレースホルダ
+     * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。
      * @return array|null
      */
-    function select($col, $table, $where = "", $arrval = array()){
+    function select($col, $table, $where = "", $arrval = array(), $fetchmode = DB_FETCHMODE_ASSOC) {
         $sqlse = $this->getsql($col, $table, $where);
-        // DBに依存した SQL へ変換
-        $dbFactory = SC_DB_DBFactory_Ex::getInstance();
-        $sqlse = $dbFactory->sfChangeMySQL($sqlse);
-        $ret = $this->conn->getAll($sqlse, $arrval);
+        $ret = $this->conn->getAll($sqlse, $arrval, $fetchmode);
         return $ret;
     }
@@ -99,4 +97,5 @@
     /**
      * 直前に実行されたSQL文を取得する.
+     * SC_DBconn::getLastQuery() を利用.
      *
      * @param boolean $disp trueの場合、画面出力を行う.
@@ -104,9 +103,5 @@
      */
     function getLastQuery($disp = true) {
-        $sql = $this->conn->conn->last_query;
-        if($disp) {
-            print($sql.";<br />\n");
-        }
-        return $sql;
+        return $this->conn->getLastQuery($disp);
     }
 
@@ -127,46 +122,29 @@
     }
 
-    function autoselect($col, $table, $arrwhere = array(), $arrcon = array()) {
-        $strw = "";
-        $find = false;
-        foreach ($arrwhere as $key => $val) {
-            if(strlen($val) > 0) {
-                if(strlen($strw) <= 0) {
-                    $strw .= $key ." LIKE ?";
-                } else if(strlen($arrcon[$key]) > 0) {
-                    $strw .= " ". $arrcon[$key]. " " . $key ." LIKE ?";
-                } else {
-                    $strw .= " AND " . $key ." LIKE ?";
-                }
-
-                $arrval[] = $val;
-            }
-        }
-
-        if(strlen($strw) > 0) {
-            $sqlse = "SELECT $col FROM $table WHERE $strw ".$this->option;
-        } else {
-            $sqlse = "SELECT $col FROM $table ".$this->option;
-        }
-        $ret = $this->conn->getAll($sqlse, $arrval);
-        return $ret;
-    }
-
-    function getall($sql, $arrval = array()) {
-        $ret = $this->conn->getAll($sql, $arrval);
-        return $ret;
-    }
-
-    function getsql($col, $table, $where) {
-        if($where != "") {
-            // 引数の$whereを優先して実行する。
-            $sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option;
-        } else {
-            if($this->where != "") {
-                    $sqlse = "SELECT $col FROM $table WHERE $this->where " . $this->groupby . " " . $this->order . " " . $this->option;
-                } else {
-                    $sqlse = "SELECT $col FROM $table " . $this->groupby . " " . $this->order . " " . $this->option;
-            }
-        }
+    /**
+     * クエリを実行し、全ての行を返す
+     *
+     * @param string $sql SQL クエリ
+     * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 
+     * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。
+     * @return array データを含む2次元配列。失敗した場合に 0 または DB_Error オブジェクトを返します。
+     */
+    function getall($sql, $arrval = array(), $fetchmode = DB_FETCHMODE_ASSOC) {
+        $ret = $this->conn->getAll($sql, $arrval, $fetchmode);
+        return $ret;
+    }
+
+    function getsql($col, $table, $where = '') {
+        $sqlse = "SELECT $col FROM $table";
+
+        // 引数の$whereを優先する。
+        if (strlen($where) >= 1) {
+            $sqlse .= " WHERE $where";
+        } elseif (strlen($this->where) >= 1) {
+            $where = $this->where;
+        }
+
+        $sqlse .= ' ' . $this->groupby . ' ' . $this->order . ' ' . $this->option;
+
         return $sqlse;
     }
@@ -191,5 +169,9 @@
 
     function setgroupby($str) {
-        $this->groupby = "GROUP BY " . $str;
+        if (strlen($str) == 0) {
+            $this->groupby = '';
+        } else {
+            $this->groupby = "GROUP BY " . $str;
+        }
     }
 
@@ -215,5 +197,9 @@
 
     function setorder($str) {
-        $this->order = "ORDER BY " . $str;
+        if (strlen($str) == 0) {
+            $this->order = '';
+        } else {
+            $this->order = "ORDER BY " . $str;
+        }
     }
 
@@ -249,12 +235,7 @@
             if(eregi("^Now\(\)$", $val)) {
                 $strval .= 'Now(),';
-            // 先頭に~があるとプレースホルダーしない。
             } else {
                 $strval .= '?,';
-                if($val != ""){
-                    $arrval[] = $val;
-                } else {
-                    $arrval[] = NULL;
-                }
+                $arrval[] = $val;
             }
             $find = true;
@@ -274,37 +255,4 @@
     }
 
-    // INSERT文の生成・実行
-    // $table   :テーブル名
-    // $sqlval  :列名 => 値の格納されたハッシュ配列
-    function fast_insert($table, $sqlval) {
-        $strcol = '';
-        $strval = '';
-        $find = false;
-
-        foreach ($sqlval as $key => $val) {
-                $strcol .= $key . ',';
-                if($val != ""){
-                    $eval = pg_escape_string($val);
-                    $strval .= "'$eval',";
-                } else {
-                    $strval .= "NULL,";
-                }
-                $find = true;
-        }
-        if(!$find) {
-            return false;
-        }
-        // 文末の","を削除
-        $strcol = ereg_replace(",$","",$strcol);
-        // 文末の","を削除
-        $strval = ereg_replace(",$","",$strval);
-        $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
-
-        // INSERT文の実行
-        $ret = $this->conn->query($sqlin);
-
-        return $ret;
-    }
-
     /**
      * UPDATE文を実行する.
@@ -313,68 +261,55 @@
      * @param array $sqlval array('カラム名' => '値',...)の連想配列
      * @param string $where WHERE句
-     * @param array $arradd $addcol用のプレースホルダ配列
-     * @param string $addcol 追加カラム
+     * @param array $arrValIn WHERE句用のプレースホルダ配列 (従来は追加カラム用も兼ねていた)
+     * @param array $arrRawSql 追加カラム
+     * @param array $arrRawSqlVal 追加カラム用のプレースホルダ配列
      * @return
      */
-    function update($table, $sqlval, $where = "", $arradd = "", $addcol = "") {
-        $strcol = '';
-        $strval = '';
+    function update($table, $sqlval, $where = "", $arrValIn = array(), $arrRawSql = array(), $arrRawSqlVal = array()) {
+        $arrCol = array();
+        $arrVal = array();
         $find = false;
         foreach ($sqlval as $key => $val) {
-            if(eregi("^Now\(\)$", $val)) {
-                $strcol .= $key . '= Now(),';
-            // 先頭に~があるとプレースホルダーしない。
+            if (eregi("^Now\(\)$", $val)) {
+                $arrCol[] = $key . '= Now()';
             } else {
-                $strcol .= $key . '= ?,';
-                if($val != ""){
-                    $arrval[] = $val;
-                } else {
-                    $arrval[] = NULL;
-                }
+                $arrCol[] = $key . '= ?';
+                $arrVal[] = $val;
             }
             $find = true;
         }
-        if(!$find) {
+
+        if ($arrRawSql != "") {
+            foreach($arrRawSql as $key => $val) {
+                $arrCol[] = "$key = $val";
+            }
+        }
+        
+        $arrVal = array_merge($arrVal, $arrRawSqlVal);
+        
+        if (empty($arrCol)) {
             return false;
         }
 
-        if($addcol != "") {
-            foreach($addcol as $key => $val) {
-                $strcol .= "$key = $val,";
-            }
-        }
-
         // 文末の","を削除
-        $strcol = ereg_replace(",$","",$strcol);
-        // 文末の","を削除
-        $strval = ereg_replace(",$","",$strval);
-
-        if($where != "") {
-            $sqlup = "UPDATE $table SET $strcol WHERE $where";
-        } else {
-            $sqlup = "UPDATE $table SET $strcol";
-        }
-
-        if(is_array($arradd)) {
+        $strcol = implode(', ', $arrCol);
+
+        if (is_array($arrValIn)) { // 旧版との互換用
             // プレースホルダー用に配列を追加
-            foreach($arradd as $val) {
-                $arrval[] = $val;
-            }
-        }
-
-        // INSERT文の実行
-        $ret = $this->conn->query($sqlup, $arrval);
-        return $ret;
+            $arrVal = array_merge($arrVal, $arrValIn);
+        }
+
+        $sqlup = "UPDATE $table SET $strcol";
+        if (strlen($where) >= 1) {
+            $sqlup .= " WHERE $where";
+        }
+
+        // UPDATE文の実行
+        return $this->conn->query($sqlup, $arrVal);
     }
 
     // MAX文の実行
     function max($table, $col, $where = "", $arrval = array()) {
-        if(strlen($where) <= 0) {
-            $sqlse = "SELECT MAX($col) FROM $table";
-        } else {
-            $sqlse = "SELECT MAX($col) FROM $table WHERE $where";
-        }
-        // MAX文の実行
-        $ret = $this->conn->getOne($sqlse, $arrval);
+        $ret = $this->get($table, "MAX($col)", $where);
         return $ret;
     }
@@ -382,11 +317,5 @@
     // MIN文の実行
     function min($table, $col, $where = "", $arrval = array()) {
-        if(strlen($where) <= 0) {
-            $sqlse = "SELECT MIN($col) FROM $table";
-        } else {
-            $sqlse = "SELECT MIN($col) FROM $table WHERE $where";
-        }
-        // MIN文の実行
-        $ret = $this->conn->getOne($sqlse, $arrval);
+        $ret = $this->get($table, "MIN($col)", $where);
         return $ret;
     }
@@ -394,11 +323,7 @@
     // 特定のカラムの値を取得
     function get($table, $col, $where = "", $arrval = array()) {
-        if(strlen($where) <= 0) {
-            $sqlse = "SELECT $col FROM $table";
-        } else {
-            $sqlse = "SELECT $col FROM $table WHERE $where";
-        }
+        $sqlse = $this->getsql($col, $table, $where);
         // SQL文の実行
-        $ret = $this->conn->getOne($sqlse, $arrval);
+        $ret = $this->getone($sqlse, $arrval);
         return $ret;
     }
@@ -408,27 +333,25 @@
         $ret = $this->conn->getOne($sql, $arrval);
         return $ret;
-
-    }
-
-    // 一行を取得
-    function getrow($table, $col, $where = "", $arrval = array()) {
-        if(strlen($where) <= 0) {
-            $sqlse = "SELECT $col FROM $table";
-        } else {
-            $sqlse = "SELECT $col FROM $table WHERE $where";
-        }
+    }
+
+    /**
+     * 一行をカラム名をキーとした連想配列として取得
+     *
+     * @param string $table テーブル名
+     * @param string $col カラム名
+     * @param string $where WHERE句
+     * @param array $arrVal プレースホルダ配列
+     * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。
+     * @return array array('カラム名' => '値', ...)の連想配列
+     */
+    function getRow($table, $col, $where = "", $arrVal = array(), $fetchmode = DB_FETCHMODE_ASSOC) {
+        $sqlse = $this->getsql($col, $table, $where);
         // SQL文の実行
-        $ret = $this->conn->getRow($sqlse, $arrval);
-
-        return $ret;
+        return $this->conn->getRow($sqlse, $arrVal ,$fetchmode);
     }
 
     // 1列取得
     function getCol($table, $col, $where = "", $arrval = array()) {
-        if (strlen($where) <= 0) {
-            $sqlse = "SELECT $col FROM $table";
-        } else {
-            $sqlse = "SELECT $col FROM $table WHERE $where";
-        }
+        $sqlse = $this->getsql($col, $table, $where);
         // SQL文の実行
         return $this->conn->getCol($sqlse, 0, $arrval);
Index: tmp/version-2_5-test/data/class/batch/SC_Batch_Daily.php
===================================================================
--- tmp/version-2_5-test/data/class/batch/SC_Batch_Daily.php	(revision 17318)
+++ tmp/version-2_5-test/data/class/batch/SC_Batch_Daily.php	(revision 18609)
@@ -44,4 +44,6 @@
      */
     function SC_Batch_Daily($argv = "") {
+        // 実行時間を制限しない
+        set_time_limit(0);
 
         if (!empty($argv)) {
@@ -136,6 +138,5 @@
             $arrRet = $objQuery->select("order_date, create_date", "dtb_bat_order_daily", "order_date = ?", array($batch_date));
             // すでにバッチ処理が終了しているかチェックする。
-            $count = count($arrRet);
-            if( $count > 0 ) {
+            if(count($arrRet) > 0) {
                 list($create_date) = split("\.", $arrRet[0]['create_date']);
                 list($order_date) = split("\.", $arrRet[0]['order_date']);
Index: tmp/version-2_5-test/data/class/SC_View.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_View.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/SC_View.php	(revision 18609)
@@ -44,5 +44,5 @@
         $this->_smarty->register_modifier("sfGetErrorColor", array("SC_Utils_Ex", "sfGetErrorColor"));
         $this->_smarty->register_modifier("sfTrim", array("SC_Utils_Ex", "sfTrim"));
-        $this->_smarty->register_modifier("sfPreTax", array("SC_Utils_Ex", "sfPreTax"));
+        $this->_smarty->register_modifier("sfPreTax", array("SC_Helper_DB_Ex", "sfPreTax"));
         $this->_smarty->register_modifier("sfPrePoint", array("SC_Utils_Ex", "sfPrePoint"));
         $this->_smarty->register_modifier("sfGetChecked",array("SC_Utils_Ex", "sfGetChecked"));
@@ -61,4 +61,5 @@
 //        $this->_smarty->register_modifier("sfPrintAffTag", array("SC_Utils_Ex", "sfPrintAffTag"));
         $this->_smarty->register_modifier("sfGetCategoryId", array("SC_Utils_Ex", "sfGetCategoryId"));
+        $this->_smarty->register_modifier("sfNoImageMainList", array("SC_Utils_Ex", "sfNoImageMainList"));
         $this->_smarty->register_function("sfIsHTTPS", array("SC_Utils_Ex", "sfIsHTTPS"));
         $this->_smarty->register_function("sfSetErrorStyle", array("SC_Utils_Ex", "sfSetErrorStyle"));
@@ -185,5 +186,5 @@
 
 class SC_SiteView extends SC_View{
-    function SC_SiteView($cart = true) {
+    function SC_SiteView($setPrevURL = true) {
         parent::SC_View();
 
@@ -195,7 +196,5 @@
         SC_Utils_Ex::sfDomainSessionStart();
 
-        if($cart){
-            $include_dir = realpath(dirname( __FILE__));
-            require_once($include_dir . "/SC_CartSession.php");
+        if ($setPrevURL) {
             $objCartSess = new SC_CartSession();
             $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
@@ -221,6 +220,6 @@
 
 class SC_MobileView extends SC_SiteView {
-    function SC_MobileView() {
-        parent::SC_SiteView();
+    function SC_MobileView($setPrevURL = true) {
+        parent::SC_SiteView($setPrevURL);
         $this->_smarty->template_dir = MOBILE_TEMPLATE_DIR;
         $this->_smarty->compile_dir = MOBILE_COMPILE_DIR;
Index: tmp/version-2_5-test/data/class/SC_Date.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Date.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/SC_Date.php	(revision 18609)
@@ -22,135 +22,152 @@
  */
 
-/*　日時表示用クラス */
+/* 日時表示用クラス */
 class SC_Date {
-	var $start_year;
-	var $month;
-	var $day;
-	var $end_year;
-	
-	// コンストラクタ
-	function SC_Date($start_year='', $end_year='') {
-		if ( $start_year ) 	$this->setStartYear($start_year);	
-		if ( $end_year )	$this->setEndYear($end_year);
-	}
-	
-	function setStartYear($year){
-		$this->start_year = $year;
-	}
-	
-	function getStartYear(){
-		return $this->start_year;
-	}
-	
-	function setEndYear($endYear) {
-		$this->end_year = $endYear;	
-	}
-	
-	function getEndYear() {
-		return $this->end_year;
-	}
-	
-	function setMonth($month){
-		$this->month = $month;			
-	}
-	
-	function setDay ($day){
-		$this->day = $day;
-	}
-			
-	function getYear($year = '', $default = ''){
-		if ( $year ) $this->setStartYear($year);
-		
-		$year = $this->start_year;
-		if ( ! $year ) $year = DATE("Y");
-		
-		$end_year = $this->end_year;
-		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
-		
-		$year_array = array();
-		
-		for ($i=$year; $i<=($end_year); $i++){		
-			$year_array[$year] = $i;
-			if($year == $default) {
-				$year_array['----'] = "----";
-			}
-			$year++;
-		}
-		return $year_array;
-	}
-	
-	function getZeroYear($year = ''){
-		if ( $year ) $this->setStartYear($year);
-		
-		$year = $this->start_year;
-		if ( ! $year ) $year = DATE("Y");
-		
-		$end_year = $this->end_year;
-		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
-		
-		$year_array = array();
-		
-		for ($i=$year; $i<=($end_year); $i++){
-			$key = substr($i, -2);
-			$year_array[$key] = $key;
-		}
-		return $year_array;
-	}
-	
-	function getZeroMonth(){
-	
-		$month_array = array();
-		for ($i=1; $i <= 12; $i++){
-			$val = sprintf("%02d", $i);
-			$month_array[$val] = $val;
-		}
-		return $month_array;
-	}	
-	
-	
-	function getMonth(){
-	
-		$month_array = array();
-		for ($i=0; $i < 12; $i++){		
-			$month_array[$i + 1 ] = $i + 1;
-		}
-		return $month_array;
-	}	
-	
-	function getDay(){	
-		
-		$day_array = array();
-		for ($i=0; $i < 31; $i++){		
-			$day_array[ $i + 1 ] = $i + 1;
-		}
-		
-		return $day_array;
-	}
+    var $start_year;
+    var $month;
+    var $day;
+    var $end_year;
+    
+    // コンストラクタ
+    function SC_Date($start_year='', $end_year='') {
+        if ( $start_year )  $this->setStartYear($start_year);
+        if ( $end_year )    $this->setEndYear($end_year);
+    }
+    
+    function setStartYear($year){
+        $this->start_year = $year;
+    }
+    
+    function getStartYear(){
+        return $this->start_year;
+    }
+    
+    function setEndYear($endYear) {
+        $this->end_year = $endYear;
+    }
+    
+    function getEndYear() {
+        return $this->end_year;
+    }
+    
+    function setMonth($month){
+        $this->month = $month;
+    }
+    
+    function setDay ($day){
+        $this->day = $day;
+    }
+    
+    /**
+     * 年プルダウン用の配列を返す
+     * FIXME $default_year に一致いる行が無かった場合、先頭か末尾に付加すべきと思われる。
+     * @param string $year    XMLファイル名
+     * @param bool|string $default_year
+     *     false  「選択なし」は含めない。
+     *     true   「選択なし」は含める。
+     *     string 「選択なし」は指定された値の下に付加する。
+     * @param string $default_key
+     */
+    function getYear($year = '', $default_year = false, $default_key = '----') {
+        if ( $year ) $this->setStartYear($year);
+        
+        $year = $this->start_year;
+        if ( ! $year ) $year = DATE("Y");
+        
+        $end_year = $this->end_year;
+        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+        
+        $year_array = array();
+        
+        if ($default_year === true) {
+            $year_array[$default_key] = '----';
+        }
+        
+        for ($i = $year; $i <= $end_year; $i++) {
+            $year_array[$i] = $i;
+            if ($default_year !== true && strlen($default_year) >= 1 && $i == $default_year) {
+                $year_array[$default_key] = '----';
+            }
+        }
+        return $year_array;
+    }
+    
+    function getZeroYear($year = ''){
+        if ( $year ) $this->setStartYear($year);
+        
+        $year = $this->start_year;
+        if ( ! $year ) $year = DATE("Y");
+        
+        $end_year = $this->end_year;
+        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+        
+        $year_array = array();
+        
+        for ($i = $year; $i <= $end_year; $i++) {
+            $key = substr($i, -2);
+            $year_array[$key] = $key;
+        }
+        return $year_array;
+    }
+    
+    function getZeroMonth(){
+    
+        $month_array = array();
+        for ($i=1; $i <= 12; $i++){
+            $val = sprintf("%02d", $i);
+            $month_array[$val] = $val;
+        }
+        return $month_array;
+    }   
+    
+    
+    function getMonth($default = false) {
+        $month_array = array();
+        
+        if ($default) $month_array[''] = '--';
+        
+        for ($i=0; $i < 12; $i++){
+            $month_array[$i + 1 ] = $i + 1;
+        }
+        return $month_array;
+    }   
+    
+    function getDay($default = false) {
+        $day_array = array();
+        
+        if ($default) $day_array[''] = '--';
+        
+        for ($i=0; $i < 31; $i++){
+            $day_array[ $i + 1 ] = $i + 1;
+        }
+        
+        return $day_array;
+    }
 
-	function getHour(){	
-		
-		$day_array = array();
-		for ($i=0; $i<=23; $i++){		
-			$hour_array[$i] = $i;
-		}
-		
-		return $hour_array;
-	}
+    function getHour(){
+        
+        $day_array = array();
+        for ($i=0; $i<=23; $i++){
+            $hour_array[$i] = $i;
+        }
+        
+        return $hour_array;
+    }
 
-	function getMinutes(){	
-		
-		$minutes_array = array();
-		for ($i=0; $i<=59; $i++){		
-			$minutes_array[$i] = $i;
-		}
-		
-		return $minutes_array;
-	}
-	
-	function getMinutesInterval(){	
-		
-		$minutes_array = array("00"=>"00", "30"=>"30");		
-		return $minutes_array;
-	}	
+    function getMinutes(){
+        
+        $minutes_array = array();
+        for ($i=0; $i<=59; $i++){
+            $minutes_array[$i] = $i;
+        }
+        
+        return $minutes_array;
+    }
+    
+    function getMinutesInterval(){
+        
+        $minutes_array = array("00"=>"00", "30"=>"30");
+        return $minutes_array;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/SC_Fpdf.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Fpdf.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_Fpdf.php	(revision 18609)
@@ -28,12 +28,11 @@
  */
 
-require(DATA_PATH . 'module/pdf/japanese.php');
-define('PDF_IMG_DIR', HTML_PATH. USER_DIR. USER_PACKAGE_DIR. TEMPLATE_NAME. '/img/pdf/');
+require(DATA_PATH . 'pdf/japanese.php');
+define('PDF_TEMPLATE_DIR', DATA_PATH . 'pdf/');
 
 class SC_Fpdf {
     function SC_Fpdf($download, $title, $tpl_pdf = "template_nouhin01.pdf") {
-        $this->arrData = $arrData;
         // デフォルトの設定
-        $this->tpl_pdf = PDF_DIR . $tpl_pdf;  // テンプレートファイル
+        $this->tpl_pdf = PDF_TEMPLATE_DIR . $tpl_pdf;  // テンプレートファイル
         $this->pdf_download = $download;      // PDFのダウンロード形式（0:表示、1:ダウンロード）
         $this->tpl_title = $title;
@@ -49,7 +48,7 @@
 
         $this->arrMessage = array(
-          'このたびはお買上げいただきありがとうございます。',
-          '下記の内容にて納品させていただきます。',
-          'ご確認いただきますよう、お願いいたします。'
+            'このたびはお買上げいただきありがとうございます。',
+            '下記の内容にて納品させていただきます。',
+            'ご確認いただきますよう、お願いいたします。'
         );
 
@@ -69,5 +68,4 @@
     }
 
-
     function setData($arrData) {
         $this->arrData = $arrData;
@@ -82,7 +80,7 @@
         $this->pdf->SetDisplayMode($this->tpl_dispmode);
 
-        if(SC_Utils_Ex::sfIsInt($arrData['order_id'])) {
-          $this->disp_mode = true;
-          $order_id = $arrData['order_id'];
+        if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) {
+            $this->disp_mode = true;
+            $order_id = $arrData['order_id'];
         }
 
@@ -113,5 +111,6 @@
 
         $text = "TEL: ".$arrInfo['law_tel01']."-".$arrInfo['law_tel02']."-".$arrInfo['law_tel03'];
-        if ( strlen($arrInfo['law_fax01']) > 0 && strlen($arrInfo['law_fax02']) > 0 && strlen($arrInfo['law_fax03']) > 0 ) {
+        //FAX番号が存在する場合、表示する
+        if (strlen($arrInfo['law_fax01']) > 0) {
             $text .= "　FAX: ".$arrInfo['law_fax01']."-".$arrInfo['law_fax02']."-".$arrInfo['law_fax03'];
         }
@@ -124,5 +123,5 @@
 
         //ロゴ画像
-        $logo_file = PDF_IMG_DIR . 'logo.png';
+        $logo_file = PDF_TEMPLATE_DIR . 'logo.png';
         $this->pdf->Image($logo_file, 124, 46, 40);
     }
@@ -138,7 +137,4 @@
 
     function setOrderData() {
-        // ショップ情報
-        $objInfo = new SC_SiteInfo();
-        $arrInfo = $objInfo->data;
         // DBから受注情報を読み込む
         $this->lfGetOrderData($this->arrData['order_id']);
@@ -176,31 +172,31 @@
 
         $monetary_unit = $this->sjis_conv("円");
-        $point_unit = $this->sjis_conv("pt");
+        $point_unit = $this->sjis_conv("Pt");
 
         // 購入商品情報
         for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) {
 
-          // 購入数量
-          $data[0] = $this->arrDisp['quantity'][$i];
-
-          // 税込金額（単価）
-          $data[1] = SC_Utils_Ex::sfPreTax($this->arrDisp['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']);
-
-          // 小計（商品毎）
-          $data[2] = $data[0] * $data[1];
-
-          $arrOrder[$i][0]  = $this->sjis_conv($this->arrDisp['product_name'][$i]." / ");
-          $arrOrder[$i][0] .= $this->sjis_conv($this->arrDisp['product_code'][$i]." / ");
-          if($this->arrDisp['classcategory_name1'][$i]) {
-            $arrOrder[$i][0] .= $this->sjis_conv(" [ ".$this->arrDisp['classcategory_name1'][$i]);
-            if($this->arrDisp['classcategory_name2'][$i] == "") {
-              $arrOrder[$i][0] .= " ]";
-            } else {
-              $arrOrder[$i][0] .= $this->sjis_conv(" * ".$this->arrDisp['classcategory_name2'][$i]." ]");
+            // 購入数量
+            $data[0] = $this->arrDisp['quantity'][$i];
+
+            // 税込金額（単価）
+            $data[1] = SC_Helper_DB_Ex::sfPreTax($this->arrDisp['price'][$i]);
+
+            // 小計（商品毎）
+            $data[2] = $data[0] * $data[1];
+
+            $arrOrder[$i][0]  = $this->sjis_conv($this->arrDisp['product_name'][$i]." / ");
+            $arrOrder[$i][0] .= $this->sjis_conv($this->arrDisp['product_code'][$i]." / ");
+            if ($this->arrDisp['classcategory_name1'][$i]) {
+                $arrOrder[$i][0] .= $this->sjis_conv(" [ ".$this->arrDisp['classcategory_name1'][$i]);
+                if ($this->arrDisp['classcategory_name2'][$i] == "") {
+                    $arrOrder[$i][0] .= " ]";
+                } else {
+                    $arrOrder[$i][0] .= $this->sjis_conv(" * ".$this->arrDisp['classcategory_name2'][$i]." ]");
+                }
             }
-          }
-          $arrOrder[$i][1]  = number_format($data[0]);
-          $arrOrder[$i][2]  = number_format($data[1]).$monetary_unit;
-          $arrOrder[$i][3]  = number_format($data[2]).$monetary_unit;
+            $arrOrder[$i][1]  = number_format($data[0]);
+            $arrOrder[$i][2]  = number_format($data[1]).$monetary_unit;
+            $arrOrder[$i][3]  = number_format($data[2]).$monetary_unit;
 
         }
@@ -241,29 +237,29 @@
         $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']).$monetary_unit;
 
-        $i++;
-        $arrOrder[$i][0] = "";
-        $arrOrder[$i][1] = "";
-        $arrOrder[$i][2] = "";
-        $arrOrder[$i][3] = "";
-
         // ポイント表記
         if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) {
-          $i++;
-          $arrOrder[$i][0] = "";
-          $arrOrder[$i][1] = "";
-          $arrOrder[$i][2] = $this->sjis_conv("利用ポイント");
-          $arrOrder[$i][3] = number_format($this->arrDisp['use_point']).$point_unit;
-
-          $i++;
-          $arrOrder[$i][0] = "";
-          $arrOrder[$i][1] = "";
-          $arrOrder[$i][2] = $this->sjis_conv("加算ポイント");
-          $arrOrder[$i][3] = number_format($this->arrDisp['add_point']).$point_unit;
-
-          $i++;
-          $arrOrder[$i][0] = "";
-          $arrOrder[$i][1] = "";
-          $arrOrder[$i][2] = $this->sjis_conv("所有ポイント");
-          $arrOrder[$i][3] = number_format($this->arrDisp['point']).$point_unit;
+            $i++;
+            $arrOrder[$i][0] = "";
+            $arrOrder[$i][1] = "";
+            $arrOrder[$i][2] = "";
+            $arrOrder[$i][3] = "";
+
+            $i++;
+            $arrOrder[$i][0] = "";
+            $arrOrder[$i][1] = "";
+            $arrOrder[$i][2] = $this->sjis_conv("利用ポイント");
+            $arrOrder[$i][3] = number_format($this->arrDisp['use_point']).$point_unit;
+
+            $i++;
+            $arrOrder[$i][0] = "";
+            $arrOrder[$i][1] = "";
+            $arrOrder[$i][2] = $this->sjis_conv("加算ポイント");
+            $arrOrder[$i][3] = number_format($this->arrDisp['add_point']).$point_unit;
+
+            $i++;
+            $arrOrder[$i][0] = "";
+            $arrOrder[$i][1] = "";
+            $arrOrder[$i][2] = $this->sjis_conv("所有ポイント");
+            $arrOrder[$i][3] = number_format($this->arrDisp['point']).$point_unit;
         }
 
@@ -282,11 +278,15 @@
     function createPdf() {
         // PDFをブラウザに送信
-ob_clean();
-        if ($this->pdf->PageNo() == 1) {
-            $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf";
-          } else {
-            $filename = "nouhinsyo.pdf";
-          }
-          $this->pdf->Output($this->sjis_conv($filename), D);
+        ob_clean();
+        if ($this->pdf_download == 1) {
+            if ($this->pdf->PageNo() == 1) {
+                $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf";
+            } else {
+                $filename = "nouhinsyo.pdf";
+            }
+            $this->pdf->Output($this->sjis_conv($filename), D);
+        } else {
+            $this->pdf->Output();
+        }
 
         // 入力してPDFファイルを閉じる
@@ -301,5 +301,4 @@
         $this->pdf->Text($x, $y, $text);
     }
-
 
     // 受注データの取得
@@ -310,11 +309,7 @@
             $where = "order_id = ?";
             $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
-            #$objFormParam->setParam($arrRet[0]);
-            list($point, $total_point) = SC_Helper_DB_Ex::sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
-            #$objFormParam->setValue('total_point', $total_point);
-            #$objFormParam->setValue('point', $point);
-            $arrRet[0]['total_point'] = $total_point;
-            $arrRet[0]['point'] = $point;
             $this->arrDisp = $arrRet[0];
+            list($point) = SC_Helper_DB_Ex::sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
+            $this->arrDisp['point'] = $point;
 
             // 受注詳細データの取得
@@ -338,17 +333,16 @@
     // 受注詳細データの取得
     function lfGetOrderDetail($order_id) {
-      $objQuery = new SC_Query();
-      $col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
-      $where = "order_id = ?";
-      $objQuery->setorder("classcategory_id1, classcategory_id2");
-      $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
-      return $arrRet;
+        $objQuery = new SC_Query();
+        $col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+        $where = "order_id = ?";
+        $objQuery->setorder("classcategory_id1, classcategory_id2");
+        $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+        return $arrRet;
     }
 
     // 文字コードSJIS変換 -> japanese.phpで使用出来る文字コードはSJISのみ
     function sjis_conv($conv_str) {
-      return (mb_convert_encoding($conv_str, "SJIS", CHAR_CODE));
-    }
-
+        return (mb_convert_encoding($conv_str, "SJIS", CHAR_CODE));
+    }
 
 }
Index: tmp/version-2_5-test/data/class/SC_Product.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Product.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/SC_Product.php	(revision 18609)
@@ -0,0 +1,163 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/*  [名称] SC_Product
+ *  [概要] 商品クラス
+ */
+class SC_Product {
+
+    /** 規格名一覧 */
+    var $arrClassName;
+    /** 規格分類名一覧 */
+    var $arrClassCatName;
+    var $classCategories = array();
+    var $stock_find;
+    /** 規格1クラス名 */
+    var $className1 = '';
+    /** 規格2クラス名 */
+    var $className2 = '';
+    /** 規格1が設定されている */
+    var $classCat1_find;
+    /** 規格2が設定されている */
+    var $classCat2_find;
+    var $classCats1;
+    
+    function SC_Product($arrProductId = null) {
+        $objDb = new SC_Helper_DB_Ex();
+        
+        // 規格名一覧
+        $this->arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
+        // 規格分類名一覧
+        $this->arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+        $this->arrClassCatName[''] = '選択してください';
+        
+        if (!is_null($arrProductId)) {
+            $this->setProductId($arrProductId);
+        }
+    }
+
+    function setProductId($arrProductId) {
+        
+        // 商品規格情報の取得
+        $rows = $this->lfGetProductsClass($arrProductId);
+        
+        $arrProductsClass = array();
+        foreach ($rows as $row) {
+            $productId = $row['product_id'];
+            $arrProductsClass[$productId][] = $row;
+        }
+        unset($rows);
+        
+        foreach ($arrProductsClass as $productId => $arrProductClass) {
+            $classCats1 = array();
+            $classCats1[''] = '選択してください';
+            
+            // 規格1クラス名
+            $this->className1[$productId] =
+                isset($this->arrClassName[$arrProductClass[0]['class_id1']])
+                ? $this->arrClassName[$arrProductClass[0]['class_id1']]
+                : '';
+
+            // 規格2クラス名
+            $this->className2[$productId] =
+                isset($this->arrClassName[$arrProductClass[0]['class_id2']])
+                ? $this->arrClassName[$arrProductClass[0]['class_id2']]
+                : '';
+            
+            // 規格1が設定されている
+            $this->classCat1_find[$productId] = ($arrProductClass[0]['classcategory_id1'] != '0');
+            // 規格2が設定されている
+            $this->classCat2_find[$productId] = ($arrProductClass[0]['classcategory_id2'] != '0');
+
+            $this->stock_find[$productId] = false;
+            $classCategories = array();
+            $classCategories['']['']['name'] = '選択してください';
+            foreach ($arrProductClass as $productsClass) {
+                $productsClass1 = $productsClass['classcategory_id1'];
+                $productsClass2 = $productsClass['classcategory_id2'];
+                $classCategories[$productsClass1]['']['name'] = '選択してください';
+
+                // 在庫
+                $stock_find_class = ($productsClass['stock_unlimited'] || $productsClass['stock'] > 0);
+                
+                $classCategories[$productsClass1][$productsClass2]['name'] = $this->arrClassCatName[$productsClass2]
+                    . ($stock_find_class ? '' : ' (品切れ中)');
+                
+                $classCategories[$productsClass1][$productsClass2]['stock_find'] = $stock_find_class;
+                
+                if ($stock_find_class) {
+                    $this->stock_find[$productId] = true;
+                }
+
+                if (!in_array($classcat_id1, $classCats1)) {
+                    $classCats1[$productsClass1] = $this->arrClassCatName[$productsClass1]
+                        . ($productsClass2 == 0 && !$stock_find_class ? ' (品切れ中)' : '');
+                }
+                
+                // 価格
+                $classCategories[$productsClass1][$productsClass2]['price01']
+                    = strlen($productsClass['price01'])
+                    ? number_format(SC_Helper_DB_Ex::sfPreTax($productsClass['price01']))
+                    : '';
+                
+                $classCategories[$productsClass1][$productsClass2]['price02']
+                    = strlen($productsClass['price02'])
+                    ? number_format(SC_Helper_DB_Ex::sfPreTax($productsClass['price02']))
+                    : '';
+                
+                // ポイント
+                // XXX sfPrePoint() の第4パラメータは、処理にバグがあるため現状省略している。(http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=3540&forum=1&post_id=13853#forumpost13853)
+                $classCategories[$productsClass1][$productsClass2]['point']
+                    = SC_Utils_Ex::sfPrePoint($productsClass['price02'], $productsClass['point_rate']);
+                
+                // 商品コード
+                $classCategories[$productsClass1][$productsClass2]['product_code'] = $productsClass['product_code'];
+            }
+            
+            $this->classCategories[$productId] = $classCategories;
+            
+            // 規格1
+            $this->classCats1[$productId] = $classCats1;
+        }
+    }
+
+    /* 商品規格情報の取得 */
+    function lfGetProductsClass($arrProductId) {
+        $arrProductId = (Array) $arrProductId;
+        
+        if (empty($arrProductId)) {
+            return array();
+        }
+        
+        // 商品規格取得
+        $objQuery = new SC_Query();
+        $col = 'product_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, price01, price02, point_rate, product_code';
+        $table = 'vw_product_class AS prdcls';
+        $where = 'product_id IN (' . implode(', ', array_pad(array(), count($arrProductId), '?')) . ')';
+        $objQuery->setorder("product_id, rank1 DESC, rank2 DESC");
+        $arrRet = $objQuery->select($col, $table, $where, $arrProductId);
+        
+        return $arrRet;
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/SC_Session.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Session.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/SC_Session.php	(revision 18609)
@@ -41,5 +41,5 @@
             $this->cert = $_SESSION['cert'];
             $this->login_id  = $_SESSION['login_id'];
-            $this->authority = $_SESSION['authority'];	// 管理者:0, 一般:1, 閲覧:2
+            $this->authority = $_SESSION['authority'];	// 管理者:0, 店舗オーナー:1, 閲覧:2, 販売担当:3 (XXX 現状 0, 1 を暫定実装。2, 3 は未実装。)
             $this->member_id = $_SESSION['member_id'];
             if (isset($_SESSION['uniq_id'])) {
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Confirm.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 18609)
@@ -53,6 +53,5 @@
         $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
         $this->arrReminder = $masterData->getMasterData("mtb_reminder");
-
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -71,5 +70,4 @@
         $objCampaignSess = new SC_CampaignSession();
         $objCustomer = new SC_Customer();
-        $arrInfo = $objSiteInfo->data;
         $objQuery = new SC_Query();
         $objDb = new SC_Helper_DB_Ex();
@@ -83,5 +81,5 @@
 
         // カート集計処理
-        $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
+        $objDb->sfTotalCart($this, $objCartSess);
         if (strlen($this->tpl_message) >= 1) {
             SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
@@ -90,5 +88,5 @@
         $arrData = $objDb->sfGetOrderTemp($uniqid);
         // カート集計を元に最終計算
-        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer, $objCampaignSess);
+        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
         // キャンペーンからの遷移で送料が無料だった場合の処理
         if($objCampaignSess->getIsCampaign()) {
@@ -101,8 +99,4 @@
         }
 
-
-        // カート内の商品の売り切れチェック
-        $objCartSess->chkSoldOut($objCartSess->getCartList());
-
         // 会員ログインチェック
         if($objCustomer->isLoginSuccess()) {
@@ -164,5 +158,5 @@
 
         $this->arrData = $arrData;
-        $this->arrInfo = $arrInfo;
+        $this->arrInfo = $objSiteInfo->data;
         $objView->assignobj($this);
         // フレームを選択(キャンペーンページから遷移なら変更)
@@ -190,10 +184,9 @@
         $objSiteSess = new SC_SiteSession();
         $objCustomer = new SC_Customer();
-        $arrInfo = $objSiteInfo->data;
         $objQuery = new SC_Query();
         $objDb = new SC_Helper_DB_Ex();
 
         // 前のページで正しく登録手続きが行われた記録があるか判定
-        SC_Utils_Ex::sfIsPrePage($objSiteSess, true);
+        SC_Utils_Ex::sfIsPrePage($objSiteSess);
 
         // ユーザユニークIDの取得と購入状態の正当性をチェック
@@ -202,12 +195,12 @@
 
         // カート集計処理
-        $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
+        $objDb->sfTotalCart($this, $objCartSess);
+        if (strlen($this->tpl_message) >= 1) {
+            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
+        }
         // 一時受注テーブルの読込
         $arrData = $objDb->sfGetOrderTemp($uniqid);
         // カート集計を元に最終計算
-        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer);
-
-        // カート内の商品の売り切れチェック
-        $objCartSess->chkSoldOut($objCartSess->getCartList());
+        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
 
         // 会員ログインチェック
@@ -268,5 +261,5 @@
         }
         $this->arrData = $arrData;
-        $this->arrInfo = $arrInfo;
+        $this->arrInfo = $objSiteInfo->data;
         $objView->assignobj($this);
         $objView->display(SITE_FRAME);
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Payment.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 18609)
@@ -24,4 +24,5 @@
 // {{{ requires
 require_once(CLASS_PATH . "pages/LC_Page.php");
+require_once(DATA_PATH . 'module/Services/JSON.php');
 
 /**
@@ -30,5 +31,5 @@
  * @package Page
  * @author LOCKON CO.,LTD.
- * @version $Id:LC_Page_Shopping_Payment.php 15532 2007-08-31 14:39:46Z nanasess $
+ * @version $Id:LC_Page_Shopping_Payment.php 15532 2009-10-30 20:04:46Z satou $
  */
 class LC_Page_Shopping_Payment extends LC_Page {
@@ -52,10 +53,8 @@
     function init() {
         parent::init();
-        $this->tpl_mainpage = 'shopping/payment.tpl';
+        $this->tpl_mainpage = "shopping/payment.tpl";
         $this->tpl_column_num = 1;
-        $this->tpl_onload = 'fnCheckInputPoint();';
+        $this->tpl_onload = "fnCheckInputPoint(); fnSetDelivTime('payment','payment_id','deliv_time_id');";
         $this->tpl_title = "お支払方法・お届け時間等の指定";
-
-        $this->allowClientCache();
     }
 
@@ -74,6 +73,4 @@
         $objDb = new SC_Helper_DB_Ex();
         $this->objCustomer = new SC_Customer();
-        $objSiteInfo = $objView->objSiteInfo;
-        $arrInfo = $objSiteInfo->data;
 
         // パラメータ管理クラス
@@ -102,16 +99,16 @@
         $arrOrderTemp = $objDb->sfGetOrderTemp($uniqid);
         //不正遷移チェック（正常に受注情報が格納されていない場合は一旦カート画面まで戻す）
-        if (!$arrOrderTemp){
+        if (!$arrOrderTemp) {
             $this->sendRedirect($this->getLocation(URL_CART_TOP));
             exit;
         }
-        // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が０になる)
-        $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
-
-        if (empty($arrData)) $arrData = array();
-        $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo);
-
-        // カート内の商品の売り切れチェック
-        $objCartSess->chkSoldOut($objCartSess->getCartList());
+
+        // カート内商品の集計処理を行う
+        $objDb->sfTotalCart($this, $objCartSess);
+        if (strlen($this->tpl_message) >= 1) {
+            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
+        }
+
+        $this->arrData = $objDb->sfTotalConfirm(array(), $this, $objCartSess);
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
@@ -121,5 +118,5 @@
             // 入力値の変換
             $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError($this->arrData );
+            $this->arrErr = $this->lfCheckError($this->arrData);
             // 入力エラーなし
             if(count($this->arrErr) == 0) {
@@ -148,5 +145,6 @@
         // 支払い方法が変更された場合
         case 'payment':
-            // ここのbreakは、意味があるので外さないで下さい。
+            // 配送時間の配列を生成
+            $this->lfSetDelivTime();
             break;
         default:
@@ -156,16 +154,10 @@
         }
 
-        // 店舗情報の取得
-        $arrInfo = $objSiteInfo->data;
         // 購入金額の取得得
-        $total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+        $total_pretax = $objCartSess->getAllProductsTotal();
         // 支払い方法の取得
         $this->arrPayment = $this->lfGetPayment($total_pretax);
         // 支払い方法の画像があるなしを取得（$img_show true:ある false:なし）
         $this->img_show = $this->lfGetImgShow($this->arrPayment);
-        // お届け時間の取得
-        $arrRet = $objDb->sfGetDelivTime($this->objFormParam->getValue('payment_id'));
-        $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
-
         // お届け日一覧の取得
         $this->arrDelivDate = $this->lfGetDelivDate();
@@ -198,6 +190,4 @@
         $this->objCustomer = new SC_Customer();
         $objDb = new SC_Helper_DB_Ex();
-        $objSiteInfo = $objView->objSiteInfo;
-        $arrInfo = $objSiteInfo->data;
 
         // パラメータ管理クラス
@@ -222,15 +212,16 @@
         $arrOrderTemp = $objDb->sfGetOrderTemp($uniqid);
         //不正遷移チェック（正常に受注情報が格納されていない場合は一旦カート画面まで戻す）
-        if (!$arrOrderTemp){
+        if (!$arrOrderTemp) {
             $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP));
             exit;
         }
-        // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が０になる)
-        $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
-        if (empty($arrData)) $arrData = array();
-        $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo);
-
-        // カート内の商品の売り切れチェック
-        $objCartSess->chkSoldOut($objCartSess->getCartList(), true);
+
+        // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の数量が０になる)
+        $objDb->sfTotalCart($this, $objCartSess);
+        if (strlen($this->tpl_message) >= 1) {
+            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
+        }
+
+        $this->arrData = $objDb->sfTotalConfirm(array(), $this, $objCartSess);
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
@@ -271,5 +262,5 @@
             // 入力値の変換
             $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError($this->arrData );
+            $this->arrErr = $this->lfCheckError($this->arrData);
             // 入力エラーなし
             if(count($this->arrErr) == 0) {
@@ -311,8 +302,6 @@
         }
 
-        // 店舗情報の取得
-        $arrInfo = $objSiteInfo->data;
         // 購入金額の取得得
-        $total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+        $total_pretax = $objCartSess->getAllProductsTotal();
         // 支払い方法の取得
         $this->arrPayment = $this->lfGetPayment($total_pretax);
@@ -352,25 +341,30 @@
         $objQuery = new SC_Query();
         $objQuery->setorder("rank DESC");
-        //削除されていない支払方法を取得
+        // 削除されていない支払方法を取得
         $arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 0) ");
-        //利用条件から支払可能方法を判定
+        // 配列初期化
+        $data = array();
+        // 選択可能な支払方法を判定
         foreach($arrRet as $data) {
-            //下限と上限が設定されている
-            if($data['rule'] > 0 && $data['upper_rule'] > 0) {
-                if($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
+            // 下限と上限が設定されている
+            if (strlen($data['rule']) != 0 && strlen($data['upper_rule']) != 0) {
+                if ($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
                     $arrPayment[] = $data;
                 }
-            //下限のみ設定されている
-            } elseif($data['rule'] > 0) {
+            }
+            // 下限のみ設定されている
+            elseif (strlen($data['rule']) != 0) {
                 if($data['rule'] <= $total_pretax) {
                     $arrPayment[] = $data;
                 }
-            //上限のみ設定されている
-            } elseif($data['upper_rule'] > 0) {
+            }
+            // 上限のみ設定されている
+            elseif (strlen($data['upper_rule']) != 0) {
                 if($data['upper_rule'] >= $total_pretax) {
                     $arrPayment[] = $data;
                 }
-            //設定なし
-            } else {
+            }
+            // いずれも設定なし
+            else {
                 $arrPayment[] = $data;
             }
@@ -390,4 +384,5 @@
             $_POST['use_point'] = "0";
         }
+
         if (!isset($_POST['point_check'])) $_POST['point_check'] = "";
 
@@ -408,11 +403,7 @@
         }
 
-        $objView = new SC_MobileView();
-        $objSiteInfo = $objView->objSiteInfo;
-        $arrInfo = $objSiteInfo->data;
         $objCartSess = new SC_CartSession();
-        $arrInfo = $objSiteInfo->data;
         // 購入金額の取得得
-        $total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+        $total_pretax = $objCartSess->getAllProductsTotal();
         // 支払い方法の取得
         $arrPayment = $this->lfGetPayment($total_pretax);
@@ -424,5 +415,5 @@
             }
         }
-        if ($pay_flag && $arrRet['payment_id'] != "" ) {
+        if ($pay_flag && $arrRet['payment_id'] != "") {
             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
@@ -435,19 +426,12 @@
         $objQuery = new SC_Query();
         $where = "payment_id = ?";
-        $arrRet = $objQuery->select("payment_method, charge", "dtb_payment", $where, array($payment_id));
-        return (array($arrRet[0]['payment_method'], $arrRet[0]['charge']));
-    }
-
-    /* お届け時間文字列の取得 */
-    function lfGetDelivTimeInfo($time_id) {
-        $objQuery = new SC_Query();
-        $where = "time_id = ?";
-        $arrRet = $objQuery->select("deliv_id, deliv_time", "dtb_delivtime", $where, array($time_id));
-        return (array($arrRet[0]['deliv_id'], $arrRet[0]['deliv_time']));
+        $arrRet = $objQuery->select("charge, deliv_id", "dtb_payment", $where, array($payment_id));
+        return (array($arrRet[0]['charge'], $arrRet[0]['deliv_id']));
     }
 
     /* DBへデータの登録 */
     function lfRegistData($uniqid) {
-        $arrRet = $this->objFormParam->getHashArray();
+        $objDb = new SC_Helper_DB_Ex();
+
         $sqlval = $this->objFormParam->getDbArray();
         // 登録データの作成
@@ -455,17 +439,6 @@
         $sqlval['update_date'] = 'Now()';
 
-        if($sqlval['payment_id'] != "") {
-            list($sqlval['payment_method'], $sqlval['charge']) = $this->lfGetPaymentInfo($sqlval['payment_id']);
-        } else {
-            $sqlval['payment_id'] = '0';
-            $sqlval['payment_method'] = "";
-        }
-
-        if($sqlval['deliv_time_id'] != "") {
-            list($sqlval['deliv_id'], $sqlval['deliv_time']) = $this->lfGetDelivTimeInfo($sqlval['deliv_time_id']);
-        } else {
-            $sqlval['deliv_time_id'] = '0';
-            $sqlval['deliv_id'] = '0';
-            $sqlval['deliv_time'] = "";
+        if (strlen($sqlval['payment_id']) >= 1) {
+            list($sqlval['charge'], $sqlval['deliv_id']) = $this->lfGetPaymentInfo($sqlval['payment_id']);
         }
 
@@ -475,5 +448,5 @@
         }
 
-        $objDb = new SC_Helper_DB_Ex();
+        // 受注_Tempテーブルに登録
         $objDb->sfRegistTempOrder($uniqid, $sqlval);
     }
@@ -567,5 +540,4 @@
     //一時受注テーブルからの情報を格納する
     function lfSetOrderTempData($uniqid) {
-
         $objQuery = new SC_Query();
         $col = "payment_id, use_point, deliv_time_id, message, point_check, deliv_date";
@@ -589,4 +561,16 @@
         return $img_show;
     }
+
+    /* 配送時間の配列を生成 */
+    function lfSetDelivTime() {
+        $objDb = new SC_Helper_DB_Ex();
+        $objJson = new Services_JSON;
+
+        // 配送時間の取得
+        $arrRet = $objDb->sfGetDelivTime($this->objFormParam->getValue('payment_id'));
+        // JSONエンコード
+        echo $objJson->encode($arrRet);
+        exit;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_DelivAddr.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_DelivAddr.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_DelivAddr.php	(revision 18609)
@@ -80,5 +80,5 @@
         //ログイン判定
         if (!$objCustomer->isLoginSuccess(true)){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
 
@@ -138,5 +138,5 @@
                 // 郵便番号から住所の取得
                 if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") {
-                    $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
+                    $address = SC_Utils_Ex::sfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
                     $this->arrForm['pref'] = @$address[0]['state'];
                     $this->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town'];
@@ -177,5 +177,5 @@
                 exit;
             } else {
-                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
             }
             break;
@@ -298,33 +298,4 @@
     }
 
-    // 郵便番号から住所の取得
-    function lfGetAddress($zipcode) {
-
-        $conn = new SC_DBconn(ZIP_DSN);
-
-        // 郵便番号検索文作成
-        $zipcode = mb_convert_kana($zipcode ,"n");
-        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
-
-        $data_list = $conn->getAll($sqlse, array($zipcode));
-
-        // インデックスと値を反転させる。
-        $arrREV_PREF = array_flip($this->arrPref);
-
-        /*
-          総務省からダウンロードしたデータをそのままインポートすると
-          以下のような文字列が入っているので	対策する。
-          ・（１・１９丁目）
-          ・以下に掲載がない場合
-        */
-        $town =  $data_list[0]['town'];
-        $town = ereg_replace("（.*）$","",$town);
-        $town = ereg_replace("以下に掲載がない場合","",$town);
-        $data_list[0]['town'] = $town;
-        $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
-
-        return $data_list;
-    }
-
     /* 別のお届け先住所を一時受注テーブルへ */
     function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping.php	(revision 18609)
@@ -54,4 +54,5 @@
         $this->tpl_mainpage = 'shopping/index.tpl';
         $this->tpl_column_num = 1;
+        $this->tpl_title = 'ログイン';
         $masterData = new SC_DB_MasterData();
         $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
@@ -59,5 +60,5 @@
         $this->arrJob = $masterData->getMasterData("mtb_job");
         $this->tpl_onload = 'fnCheckInputDeliv();';
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -116,7 +117,4 @@
                 // DBへのデータ登録
                 $this->lfRegistData($uniqid);
-
-                // お届け先のコピー
-                $this->lfCopyDeliv($uniqid, $_POST);
 
                 // 正常に登録されたことを記録しておく
@@ -152,5 +150,5 @@
             // DB値の取得
             $this->objFormParam->setParam($arrRet[0]);
-            $this->objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
+            $this->objFormParam->setValue('order_email02', $arrRet[0]['order_email']);
             $this->objFormParam->setDBDate($arrRet[0]['order_birth']);
             break;
@@ -163,20 +161,12 @@
         }
 
-        // 選択用日付の取得
-        $objDate = new SC_Date(START_BIRTH_YEAR);
-        $this->arrYear = $objDate->getYear('', 1950);    //　日付プルダウン設定
-        $this->arrMonth = $objDate->getMonth();
-        $this->arrDay = $objDate->getDay();
-
-        if($this->year == '') {
-            $this->year = '----';
-        }
+        // 生年月日選択肢の取得
+        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+        $this->arrYear = $objDate->getYear('', 1950, '');
+        $this->arrMonth = $objDate->getMonth(true);
+        $this->arrDay = $objDate->getDay(true);
 
         // 入力値の取得
         $this->arrForm = $this->objFormParam->getFormParamList();
-
-        if(empty($this->arrForm['year']['value'])){
-            $this->arrForm['year']['value'] = '----';
-        }
 
         $this->transactionid = $this->getToken();
@@ -228,64 +218,4 @@
         $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
 
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
-        switch($_POST['mode']) {
-        case 'nonmember_confirm':
-            $this->lfSetNonMember($this);
-            // ※breakなし
-        case 'confirm':
-            // 入力値の変換
-            $this->objFormParam->convParam();
-            $this->objFormParam->toLower('order_mail');
-            $this->objFormParam->toLower('order_mail_check');
-
-            $this->arrErr = $this->lfCheckError();
-
-            // 入力エラーなし
-            if(count($this->arrErr) == 0) {
-                // DBへのデータ登録
-                $this->lfRegistData($uniqid);
-
-                // お届け先のコピー
-                $this->lfCopyDeliv($uniqid, $_POST);
-
-                // 正常に登録されたことを記録しておく
-                $objSiteSess->setRegistFlag();
-                // お支払い方法選択ページへ移動
-                $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true);
-                exit;
-            }
-
-            break;
-            // 前のページに戻る
-        case 'return':
-            // 確認ページへ移動
-            $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true);
-            exit;
-            break;
-        case 'nonmember':
-            $this->lfSetNonMember($this);
-            // ※breakなし
-        default:
-            if($_GET['from'] == 'nonmember') {
-                $this->lfSetNonMember($this);
-            }
-            // ユーザユニークIDの取得
-            $uniqid = $objSiteSess->getUniqId();
-            $objQuery = new SC_Query();
-            $where = "order_temp_id = ?";
-            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
-
-            if (empty($arrRet)) $arrRet = array(
-                                                array('order_email' => "",
-                                                      'order_birth' => ""));
-
-            // DB値の取得
-            $this->objFormParam->setParam($arrRet[0]);
-            $this->objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
-            $this->objFormParam->setDBDate($arrRet[0]['order_birth']);
-            break;
-        }
-
         // クッキー判定
         $this->tpl_login_email = $objCookie->getCookie('login_email');
@@ -294,21 +224,4 @@
         }
 
-        // 選択用日付の取得
-        $objDate = new SC_Date(START_BIRTH_YEAR);
-        $this->arrYear = $objDate->getYear('', 1950);    //　日付プルダウン設定
-        $this->arrMonth = $objDate->getMonth();
-        $this->arrDay = $objDate->getDay();
-
-        if($this->year == '') {
-            $this->year = '----';
-        }
-
-        // 入力値の取得
-        $this->arrForm = $this->objFormParam->getFormParamList();
-
-        if($this->arrForm['year']['value'] == ""){
-            $this->arrForm['year']['value'] = '----';
-        }
-
         $objView->assignobj($this);
         $objView->display(SITE_FRAME);
@@ -327,4 +240,5 @@
     function lfSetNonMember(&$objPage) {
         $objPage->tpl_mainpage = 'shopping/nonmember_input.tpl';
+        $this->tpl_title = 'お客様情報入力';
     }
 
@@ -338,6 +252,6 @@
         $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
         $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "order_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "order_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
@@ -347,5 +261,5 @@
         $this->objFormParam->addParam("FAX番号3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("メールアドレス", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
-        $this->objFormParam->addParam("メールアドレス（確認）", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
+        $this->objFormParam->addParam("メールアドレス（確認）", "order_email02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
         $this->objFormParam->addParam("年", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
         $this->objFormParam->addParam("月", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
@@ -361,6 +275,6 @@
         $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
         $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "deliv_addr01", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "deliv_addr02", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
@@ -374,8 +288,13 @@
         $sqlval = $this->objFormParam->getDbArray();
         // 登録データの作成
-        $sqlval['order_temp_id'] = $uniqid;
         $sqlval['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
         $sqlval['update_date'] = 'Now()';
         $sqlval['customer_id'] = '0';
+
+        // お届け先を指定しない場合、
+        if ($sqlval['deliv_check'] != '1') {
+            // 受注一時テーブルに登録する顧客(お客様情報)をお届け先へコピーする
+            $this->lfCopyDeliv($sqlval);
+        }
 
         // 既存データのチェック
@@ -385,4 +304,5 @@
         // 既存データがない場合
         if ($cnt == 0) {
+            $sqlval['order_temp_id'] = $uniqid;
             $sqlval['create_date'] = 'Now()';
             $objQuery->insert("dtb_order_temp", $sqlval);
@@ -423,6 +343,6 @@
         $objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
         $objErr->doFunc(array("郵便番号", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
-        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
-        $objErr->doFunc(array("メールアドレス", "メールアドレス（確認）", "order_email", "order_email_check"), array("EQUAL_CHECK"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
+        $objErr->doFunc(array("メールアドレス", "メールアドレス（確認）", "order_email", "order_email02"), array("EQUAL_CHECK"));
 
         //既存メールアドレスでの登録不可（購入時強制会員登録が有効の場合のみ）
@@ -453,25 +373,23 @@
     }
 
-    // 受注一時テーブルのお届け先をコピーする
-    function lfCopyDeliv($uniqid, $arrData) {
-        $objQuery = new SC_Query();
-
-        // 別のお届け先を指定していない場合、お届け先に登録住所をコピーする。
-        if($arrData["deliv_check"] != "1") {
-            $sqlval['deliv_name01'] = $arrData['order_name01'];
-            $sqlval['deliv_name02'] = $arrData['order_name02'];
-            $sqlval['deliv_kana01'] = $arrData['order_kana01'];
-            $sqlval['deliv_kana02'] = $arrData['order_kana02'];
-            $sqlval['deliv_pref'] = $arrData['order_pref'];
-            $sqlval['deliv_zip01'] = $arrData['order_zip01'];
-            $sqlval['deliv_zip02'] = $arrData['order_zip02'];
-            $sqlval['deliv_addr01'] = $arrData['order_addr01'];
-            $sqlval['deliv_addr02'] = $arrData['order_addr02'];
-            $sqlval['deliv_tel01'] = $arrData['order_tel01'];
-            $sqlval['deliv_tel02'] = $arrData['order_tel02'];
-            $sqlval['deliv_tel03'] = $arrData['order_tel03'];
-            $where = "order_temp_id = ?";
-            $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
-        }
+    /**
+     * 受注一時テーブルに登録する顧客(お客様情報)をお届け先へコピーする
+     *
+     * @param array $sqlval
+     * @return void
+     */
+    function lfCopyDeliv(&$sqlval) {
+        $sqlval['deliv_name01'] = $sqlval['order_name01'];
+        $sqlval['deliv_name02'] = $sqlval['order_name02'];
+        $sqlval['deliv_kana01'] = $sqlval['order_kana01'];
+        $sqlval['deliv_kana02'] = $sqlval['order_kana02'];
+        $sqlval['deliv_pref']   = $sqlval['order_pref'];
+        $sqlval['deliv_zip01']  = $sqlval['order_zip01'];
+        $sqlval['deliv_zip02']  = $sqlval['order_zip02'];
+        $sqlval['deliv_addr01'] = $sqlval['order_addr01'];
+        $sqlval['deliv_addr02'] = $sqlval['order_addr02'];
+        $sqlval['deliv_tel01']  = $sqlval['order_tel01'];
+        $sqlval['deliv_tel02']  = $sqlval['order_tel02'];
+        $sqlval['deliv_tel03']  = $sqlval['order_tel03'];
     }
 }
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Deliv.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * お届け先指定 のページクラス.
+ * お届け先の指定 のページクラス.
  *
  * @package Page
@@ -57,7 +57,6 @@
         $masterData = new SC_DB_MasterData();
         $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
-        $this->tpl_title = "お届け先指定";
-
-        $this->allowClientCache();
+        $this->tpl_title = "お届け先の指定";
+        $this->httpCacheControl('nocache');
     }
 
@@ -265,5 +264,5 @@
         if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) {
             // 不正アクセスとみなす
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
 
@@ -290,7 +289,7 @@
 
                     if($ret > 0) {
-                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     } else {
-                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                     }
                 }
@@ -424,6 +423,6 @@
         $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
         $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "deliv_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "deliv_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
Index: tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Complete.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 18609)
@@ -51,6 +51,4 @@
         $this->arrCONVENIENCE = $masterData->getMasterData("mtb_convenience");
         $this->arrCONVENIMESSAGE = $masterData->getMasterData("mtb_conveni_message");
-
-        $this->allowClientCache();
     }
 
@@ -107,5 +105,5 @@
                         // URLの場合にはリンクつきで表示させる
                         if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
-                            $arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
+                            $arrOther[$key]["value"] = "<a href='". $val["value"] . "' target=\"_blank\">" . $val["value"] ."</a>";
                         }
                     }
@@ -177,5 +175,5 @@
 
         // 前のページで正しく登録手続きが行われたか判定
-        SC_Utils_Ex::sfIsPrePage($this->objSiteSess, true);
+        SC_Utils_Ex::sfIsPrePage($this->objSiteSess);
         // ユーザユニークIDの取得と購入状態の正当性をチェック
         $uniqid = SC_Utils_Ex::sfCheckNormalAccess($this->objSiteSess, $this->objCartSess);
@@ -300,25 +298,11 @@
             $this->lfSetCustomerPurchase($this->objCustomer->getValue('customer_id'), $arrData, $objQuery);
         } else {
-            //購入時強制会員登録
-            switch(PURCHASE_CUSTOMER_REGIST) {
-            //無効
-            case '0':
-                // 購入時会員登録
-                if(isset($arrData['member_check']) && $arrData['member_check'] == '1') {
-                    // 会員登録
-                    $customer_id = $this->lfRegistCustomer($arrData, $this->arrInfo);
-                    // 購入集計を顧客テーブルに反映
-                    $this->lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
-                }
-                break;
-            //有効
-            case '1':
+            // 購入時強制会員登録が有効の場合
+            if (PURCHASE_CUSTOMER_REGIST == '1') {
                 // 会員登録
                 $customer_id = $this->lfRegistCustomer($arrData, $this->arrInfo);
                 // 購入集計を顧客テーブルに反映
                 $this->lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
-                break;
-            }
-
+            }
         }
         // 一時テーブルを受注テーブルに格納する
@@ -377,5 +361,5 @@
 
         // 仮会員登録の場合
-        if($confirm_flg == true) {
+        if ($confirm_flg == true) {
             // 重複しない会員登録キーを発行する。
             $count = 1;
@@ -397,9 +381,9 @@
 
         // メルマガフラグ
-        switch($arrData["mailmaga_flg"]) {
-            case 1:
+        switch ($arrData["mailmaga_flg"]) {
+            case 1: // HTMLメール
                 $mail_flag = 4;
                 break;
-            case 2:
+            case 2: // TEXTメール
                 $mail_flag = 5;
                 break;
@@ -434,11 +418,11 @@
 
         //仮会員メール
-        if($confirm_flg == true) {
-            $subject = $mailHelper->sfMakeSubject($objQuery,$objMailView,$objMailPage,"会員登録のご確認");
-            $body = $objMailView->fetch("mail_templates/customer_mail.tpl");
+        if ($confirm_flg == true) {
+            $subject = $mailHelper->sfMakeSubject('会員登録のご確認');
+            $body = $objMailView->fetch('mail_templates/customer_mail.tpl');
         //本会員メール
-        }else{
-            $subject = $mailHelper->sfMakeSubject($objQuery,$objMailView,$objMailPage,'会員登録のご完了');
-            $body = $objMailView->fetch("mail_templates/customer_regist_mail.tpl");
+        } else {
+            $subject = $mailHelper->sfMakeSubject('会員登録のご完了');
+            $body = $objMailView->fetch('mail_templates/customer_regist_mail.tpl');
             // ログイン状態にする
             $this->objCustomer->setLogin($arrData['order_email']);
@@ -465,26 +449,35 @@
     }
 
-    // 受注テーブルへ登録
+    /**
+     * 受注テーブルへ登録
+     *
+     * @return integer 注文番号
+     */
     function lfRegistOrder($objQuery, $arrData, $objCampaignSess = null) {
         $sqlval = $arrData;
 
         // 受注テーブルに書き込まない列を除去
-        unset($sqlval['mailmaga_flg']);		// メルマガチェック
-        unset($sqlval['deliv_check']);		// 別のお届け先チェック
-        unset($sqlval['point_check']);		// ポイント利用チェック
-        unset($sqlval['member_check']);		// 購入時会員チェック
-        unset($sqlval['password']);			// ログインパスワード
-        unset($sqlval['reminder']);			// リマインダー質問
-        unset($sqlval['reminder_answer']);	// リマインダー答え
-        unset($sqlval['mail_flag']);		// メールフラグ
-        unset($sqlval['session']);		    // セッション情報
+        unset($sqlval['mailmaga_flg']);     // メルマガチェック
+        unset($sqlval['deliv_check']);      // 別のお届け先チェック
+        unset($sqlval['point_check']);      // ポイント利用チェック
+        unset($sqlval['password']);         // ログインパスワード
+        unset($sqlval['reminder']);         // リマインダー質問
+        unset($sqlval['reminder_answer']);  // リマインダー答え
+        unset($sqlval['mail_flag']);        // メールフラグ
+        unset($sqlval['session']);          // セッション情報
+
+        // ポイントは別登録
+        $addPoint = $sqlval['add_point'];
+        $usePoint = $sqlval['use_point'];
+        $sqlval['add_point'] = 0;
+        $sqlval['use_point'] = 0;
 
         // 注文ステータス:指定が無ければ新規受付に設定
-        if($sqlval["status"] == ""){
-            $sqlval['status'] = '1';
+        if (strlen($sqlval['status']) == 0) {
+            $sqlval['status'] = ORDER_NEW;
         }
 
         // 別のお届け先を指定していない場合、お届け先に登録住所をコピーする。
-        if($arrData["deliv_check"] == "-1") {
+        if ($arrData["deliv_check"] == "-1") {
             $sqlval['deliv_name01'] = $arrData['order_name01'];
             $sqlval['deliv_name02'] = $arrData['order_name02'];
@@ -501,10 +494,11 @@
         }
 
-        $order_id = $arrData['order_id'];		// 注文番号
-        $sqlval['create_date'] = 'now()';		// 受注日
+        $order_id = $arrData['order_id'];       // 注文番号
+        $sqlval['create_date'] = 'Now()';       // 受注日
+        $sqlval['update_date'] = 'Now()';       // 更新日時
 
         // キャンペーンID
         if (!defined("MOBILE_SITE")) {
-            if($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] = $objCampaignSess->getCampaignId();
+            if ($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] = $objCampaignSess->getCampaignId();
         }
 
@@ -512,6 +506,9 @@
         //$sqlval = lfGetInsParam($sqlval);
 
-        // INSERTの実行
+        // 受注テーブルの登録
         $objQuery->insert("dtb_order", $sqlval);
+
+        // 受注.対応状況の更新
+        SC_Helper_DB_Ex::sfUpdateOrderStatus($order_id, null, $addPoint, $usePoint);
 
         return $order_id;
@@ -554,9 +551,5 @@
                 $objQuery->insert("dtb_order_detail", $sqlval);
             } else {
-                if (defined("MOBILE_SITE")) {
-                    SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND, "", false, "", true);
-                } else {
-                    SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
-                }
+                SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
             }
         }
@@ -577,5 +570,5 @@
 
         $sqlval = $arrOrder[0];
-        $sqlval['create_date'] = 'now()';
+        $sqlval['create_date'] = 'Now()';
 
         // INSERTの実行
@@ -649,5 +642,5 @@
     /* 購入情報を会員テーブルに登録する */
     function lfSetCustomerPurchase($customer_id, $arrData, &$objQuery) {
-        $col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
+        $col = "first_buy_date, last_buy_date, buy_times, buy_total";
         $where = "customer_id = ?";
         $arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
@@ -660,16 +653,4 @@
         $sqlval['buy_times']++;
         $sqlval['buy_total']+= $arrData['total'];
-        if (USE_POINT === false) {
-            $sqlval['point'] = $sqlval['point'];
-        } else {
-            //$sqlval['point'] = ($sqlval['point'] - $arrData['use_point']);
-            $sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
-        }
-
-        // ポイントが不足している場合
-        if($sqlval['point'] < 0) {
-            $objQuery->rollback();
-            SC_Utils_Ex::sfDispSiteError(LACK_POINT);
-        }
 
         $objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
@@ -678,23 +659,32 @@
     // 在庫を減らす処理
     function lfReduceStock(&$objQuery, $arrID, $quantity) {
+        $objDb = new SC_Helper_DB_Ex();
+        
+        if (!SC_Utils_Ex::sfIsInt($quantity)) {
+            $objQuery->rollback();
+            SC_Utils_Ex::sfDispException();
+        }
+        
         $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
         $arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
 
-        // 売り切れエラー
-        if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
+        if (($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
+            // 売り切れエラー
             $objQuery->rollback();
             SC_Utils_Ex::sfDispSiteError(SOLD_OUT, "", true);
-        // 無制限の場合、在庫はNULL
-        } elseif($arrRet[0]['stock_unlimited'] == '1') {
-            $sqlval['stock'] = null;
-            $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+        }
+        
         // 在庫を減らす
-        } else {
-            $sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
-            if($sqlval['stock'] == "") {
-                $sqlval['stock'] = '0';
-            }
-            $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
-        }
+        $arrRawSql = array();
+        $arrRawSql['stock'] = 'stock - ?';
+        $arrRawSqlVal[] = $quantity;
+        $objQuery->update('dtb_products_class', array(), $where, $arrID, $arrRawSql, $arrRawSqlVal);
+        
+        // 在庫無し商品の非表示対応
+        if (NOSTOCK_HIDDEN === true) {
+            // 件数カウントバッチ実行
+            $objDb->sfCategory_Count($objQuery);
+        }
+        
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php	(revision 17735)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php	(revision 18609)
@@ -228,19 +228,18 @@
 	}
 
-	/**
-	 * 使用するテンプレートをDBへ登録する
-	 */
-	function lfRegisterTemplate($template_code) {
-	    $objQuery = new SC_Query();
-	    $sqlval['name'] = "\"" . $template_code . "\"";
-		$objQuery->update("mtb_constants", $sqlval, "id = ?", array('TEMPLATE_NAME'));
-		// キャッシュを生成
-		$masterData = new SC_DB_MasterData_Ex();
-		// 更新したデータを取得
-        $mtb_constants = $masterData->getDBMasterData("mtb_constants");
-        $masterData->clearCache("mtb_constants");
-        $masterData->createCache("mtb_constants", $mtb_constants, true,
-                                 array("id", "remarks", "rank"));
-	}
+    /**
+     * 使用するテンプレートをDBへ登録する
+     */
+    function lfRegisterTemplate($template_code) {
+        $masterData = new SC_DB_MasterData_Ex();
+
+        $data = array('TEMPLATE_NAME' => var_export($template_code, TRUE));
+
+        // DBのデータを更新
+        $masterData->updateMasterData('mtb_constants', array(), $data);
+
+        // キャッシュを生成
+        $masterData->createCache('mtb_constants', array(), true, array('id', 'remarks'));
+    }
 
 	/**
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Up_Down.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Up_Down.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Up_Down.php	(revision 18609)
@@ -66,10 +66,10 @@
 		SC_Utils::sfIsSuccess($objSession);
 		$this->now_template = $this->lfGetNowTemplate();
-
+		
 		// uniqidをテンプレートへ埋め込み
 		$this->uniqid = $objSession->getUniqId();
-
+		
 		switch($this->lfGetMode()) {
-
+		
 		// ダウンロードボタン押下時の処理
 		case 'download':
@@ -102,10 +102,10 @@
 		    $this->tpl_onload = "alert('テンプレートファイルをアップロードしました。');";
 		    break;
-
+		
 		// 初回表示
 		default:
 		    break;
 		}
-
+		
 		// 画面の表示
 		$objView = new SC_AdminView();
@@ -142,5 +142,5 @@
 	    $objUpFile = new SC_UploadFile(TEMPLATE_TEMP_DIR, $pkg_dir);
 	    $objUpFile->addFile("テンプレートファイル", 'template_file', array(), TEMPLATE_SIZE, true, 0, 0, false);
-
+	
 	    return $objUpFile;
 	}
@@ -153,9 +153,9 @@
 	function lfInitUpload() {
 	    $objForm = new SC_FormParam;
-
+	
 	    $objForm->addParam("テンプレートコード", "template_code", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK"));
 	    $objForm->addParam("テンプレート名", "template_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
 	    $objForm->setParam($_POST);
-
+	
 	    return $objForm;
 	}
@@ -171,12 +171,12 @@
 	        return $arrErr;
 	    }
-
+	
 	    $arrForm = $objForm->getHashArray();
-
+	
 	    // 同名のフォルダが存在する場合はエラー
 	    if(file_exists(USER_TEMPLATE_PATH . $arrForm['template_code'])) {
 	        $arrErr['template_code'] = "※ 同名のファイルがすでに存在します。<br/>";
 	    }
-
+	
 	    // 登録不可の文字列チェック
 	    $arrIgnoreCode = array(
@@ -186,5 +186,5 @@
 	        $arrErr['template_code'] = "※ このテンプレートコードは使用できません。<br/>";
 	    }
-
+	
 	    // DBにすでに登録されていないかチェック
 	    $objQuery = new SC_Query();
@@ -193,5 +193,5 @@
 	        $arrErr['template_code'] = "※ すでに登録されているテンプレートコードです。<br/>";
 	    }
-
+	
 	    // ファイルの拡張子チェック(.tar/tar.gzのみ許可)
 	    $errFlag = true;
@@ -209,9 +209,9 @@
 	        $errFlag = false;
 	    }
-
+	
 	    if($errFlag) {
 	        $arrErr['template_file'] = "※ アップロードするテンプレートファイルで許可されている形式は、tar/tar.gzです。<br />";
 	    }
-
+	
 	    return $arrErr;
 	}
@@ -234,20 +234,20 @@
 		    mkdir($compile_dir);
 	    }
-
+	    	    
 	    // 一時フォルダから保存ディレクトリへ移動
 	    $objUpFile->moveTempFile();
-
+	    
 	    // 解凍
 	    SC_Helper_FileManager::unpackFile($template_dir . "/" . $_FILES['template_file']['name']);
 	    // ユーザデータの下のファイルをコピーする
-        $from_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";
+        $from_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";	    
 	    $to_dir = USER_PATH . "packages/" . $template_code . "/";
 	    SC_Utils::sfMakeDir($to_dir);
         SC_Utils::sfCopyDir($from_dir, $to_dir);
-
+	    
 	    // DBにテンプレート情報を保存
 	    $this->lfRegisterTemplates($objForm->getHashArray());
 	}
-
+	
 	/**
 	 * dtb_templatesへ入力内容を登録する.
@@ -276,5 +276,5 @@
 	        'templates'
 	    );
-
+	
 	    foreach ($arrDirs as $dir) {
 	        $from = USER_PATH .  $dir;
@@ -291,5 +291,5 @@
 	    $nowTpl = $this->lfGetNowTemplate();
 	    if (!$nowTpl) return;
-
+	
 	    $from = TPL_PKG_PATH . $nowTpl . '/';
 	    SC_Utils::sfCopyDir($from, $to, '');
@@ -308,5 +308,5 @@
 	    }
 	    return null;
-	}
+	}    
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design.php	(revision 17653)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design.php	(revision 18609)
@@ -25,7 +25,11 @@
 require_once(CLASS_PATH . "pages/LC_Page.php");
 
+/** ターゲットID 未使用 */
+define('TARGET_ID_UNUSED', 0);
+
 /**
  * デザイン管理 のページクラス.
  *
+ * ターゲットID 0:未使用 1:レフトナビ 2:ライトナビ 3:イン画面上部 4:メイン画面下部  5:画面上部 6:画面下部 7:ヘッダより上 8:フッタより下 9:HEADタグ内
  * @package Page
  * @author LOCKON CO.,LTD.
@@ -79,9 +83,12 @@
 
         // ブロック配置用データを取得
-        $sel   = ", pos.target_id, pos.bloc_id, pos.bloc_row ";
+        $sel   = ", pos.target_id, pos.bloc_id, pos.bloc_row ,pos.anywhere";
         $from  = ", dtb_blocposition AS pos";
         $where = " where ";
-        $where .= " lay.page_id = ? AND ";
-        $where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
+        $where .= "( pos.anywhere = 1 OR (lay.page_id = ? AND ";
+        $where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) )) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
+        //        $where .= "((lay.page_id = ? AND ";
+        //        $where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) )) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
+
         $arrData = array($page_id);
         $arrBlocPos = $this->lfgetLayoutData($sel, $from, $where, $arrData );
@@ -143,5 +150,7 @@
                 $arrUpdBlocData[$upd_cnt]['target_id']  = $arrTargetFlip[$_POST['target_id_'.$upd_cnt]];    // ターゲットID
                 $arrUpdBlocData[$upd_cnt]['top']        = $_POST['top_'.$upd_cnt];                          // TOP座標
+                $arrUpdBlocData[$upd_cnt]['anywhere']   = $_POST['anywhere_'.$upd_cnt];                     // 全ページ適用か
                 $arrUpdBlocData[$upd_cnt]['update_url'] = $_SERVER['HTTP_REFERER'];                         // 更新URL
+
             }
 
@@ -157,15 +166,12 @@
             // ブロックの順序を取得し、更新を行う
             foreach($arrUpdBlocData as $key => $val){
+                if ($arrUpdBlocData[$key]['target_id'] == TARGET_ID_UNUSED) {
+                    continue;
+                }
+
                 // ブロックの順序を取得
                 $bloc_row = $this->lfGetRowID($arrUpdBlocData, $val);
                 $arrUpdBlocData[$key]['bloc_row'] = $bloc_row;
                 $arrUpdBlocData[$key]['page_id']    =  $page_id;    // ページID
-
-                /*
-                ターゲットID 1:レフトナビ 2:ライトナビ 3:イン画面上部 4:メイン画面下部 5:欄外
-                */
-                if ($arrUpdBlocData[$key]['target_id'] == 5) {
-                    $arrUpdBlocData[$key]['bloc_row'] = "0";
-                }
 
                 // insert文生成
@@ -178,13 +184,29 @@
                 $ins_sql .= "   ,? ";           // ブロックの並び順序
                 $ins_sql .= "   ,(SELECT filename FROM dtb_bloc WHERE bloc_id = ?) ";           // ファイル名称
+                $ins_sql .= "   ,? ";           // 全ページフラグ
                 $ins_sql .= "   )  ";
 
                 // insertデータ生成
                 $arrInsData = array($page_id,
-                                    $arrUpdBlocData[$key]['target_id'],
-                                    $arrUpdBlocData[$key]['id'],
-                                    $arrUpdBlocData[$key]['bloc_row'],
-                                    $arrUpdBlocData[$key]['id']
-                                    );
+                    $arrUpdBlocData[$key]['target_id'],
+                    $arrUpdBlocData[$key]['id'],
+                    $arrUpdBlocData[$key]['bloc_row'],
+                    $arrUpdBlocData[$key]['id'],
+                    $arrUpdBlocData[$key]['anywhere'] ? 1 : 0
+                );
+                $count = $objDBConn->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id']));
+
+                if($arrUpdBlocData[$key]['anywhere'] == 1){
+                    $count = $objDBConn->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id']));
+                    $objDBConn->getLastQuery();
+                    if($count != 0){
+                        continue;
+                    }else{
+                    }
+                }else{
+                    if($count > 0){
+                        $objDBConn->query("DELETE FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id']));
+                    }
+                }
                 // SQL実行
                 $arrRet = $objDBConn->query($ins_sql,$arrInsData);
@@ -194,5 +216,5 @@
             if ($_POST['mode'] == 'preview') {
                 if ($page_id === "") {
-                    $this->sendRedirect($this->getLocation("./index.php"));
+                    $this->sendRedirect($this->getLocation(DIR_INDEX_URL));
                     exit;
                 }
@@ -201,12 +223,12 @@
                 $_SESSION['preview'] = "ON";
 
-                $this->sendRedirect($this->getLocation(URL_DIR . "preview/index.php", array("filename" => $arrPageData[0]["filename"])));
+                $this->sendRedirect($this->getLocation(URL_DIR . "preview/" . DIR_INDEX_URL, array("filename" => $arrPageData[0]["filename"])));
                 exit;
 
             }else{
-                $this->sendRedirect($this->getLocation("./index.php",
-                                            array("page_id" => $page_id,
+                $this->sendRedirect($this->getLocation(DIR_INDEX_URL,
+                array("page_id" => $page_id,
                                                   "msg" => "on")));
-				exit;
+                exit;
 
             }
@@ -216,5 +238,5 @@
         if ($_POST['mode'] == 'delete' and  !$objLayout->lfCheckBaseData($page_id)) {
             $objLayout->lfDelPageData($page_id);
-            $this->sendRedirect($this->getLocation("./index.php"));
+            $this->sendRedirect($this->getLocation(DIR_INDEX_URL));
             exit;
         }
@@ -228,4 +250,5 @@
                 $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
                 $cnt++;
+            }else{
             }
         }
@@ -234,7 +257,8 @@
         foreach($arrBloc as $key => $val){
             if (!$this->lfChkBloc($val, $tpl_arrBloc)) {
-                $val['target_id'] = 5;  // 未使用に追加する
+                $val['target_id'] = TARGET_ID_UNUSED; // 未使用に追加する
                 $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
                 $cnt++;
+            }else{
             }
         }
@@ -373,6 +397,9 @@
         $tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id'];
         $tpl_arrBloc[$cnt]['bloc_row'] =
-            isset($val['bloc_row']) ? $val['bloc_row'] : "";
-
+        isset($val['bloc_row']) ? $val['bloc_row'] : "";
+        $tpl_arrBloc[$cnt]['anywhere'] = $val['anywhere'];
+        if($val['anywhere'] == 1){
+            $tpl_arrBloc[$cnt]['anywhere_selected'] = 'checked="checked"';
+        }
         foreach($arrBloc as $bloc_key => $bloc_val){
             if ($bloc_val['bloc_id'] == $val['bloc_id']) {
@@ -447,10 +474,14 @@
         }
 
-        $tplfile = TEMPLATE_DIR . $filename;
-
         // filename が空の場合にはMYページと判断
         if($filename == ""){
             $tplfile = TEMPLATE_DIR . "mypage/index";
             $filename = 'mypage';
+        } else {
+            if (file_exists(TEMPLATE_FTP_DIR . $filename . ".tpl")) {
+                $tplfile = TEMPLATE_FTP_DIR . $filename;
+            } else {
+                $tplfile = TEMPLATE_DIR . $filename;
+            }
         }
 
@@ -465,5 +496,6 @@
 
         // 更新データの取得
-        $sql = "select page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ?";
+        $sql = "select page_id,page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ? OR page_id = (SELECT page_id FROM dtb_blocposition WHERE anywhere = 1)" ;
+        
         $ret = $objDBConn->getAll($sql, array($arrPageData[0]['page_id']));
 
@@ -476,13 +508,18 @@
         $sql .= "     ,tpl_dir = ?";
         $sql .= "     ,filename = ?";
+//      $sql .= "     ,anywhere = ?";
         $sql .= " where page_id = 0";
+        var_dump($ret);
+                echo("####<br/>\n\n".__LINE__ ." in file:".__FILE__."<br/>\n\n ####");
 
         $arrUpdData = array($ret[0]['page_id']
-                            ,$ret[0]['page_id']
-                            ,$ret[0]['page_id']
-                            ,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
-                            ,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
-                            ,$filename
-                            );
+        ,$ret[0]['page_id']
+        ,$ret[0]['page_id']
+        ,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
+        ,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
+        ,$filename
+//      ,$ret[0]['anywhere']
+         
+        );
 
         $objDBConn->query($sql,$arrUpdData);
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php	(revision 18609)
@@ -24,4 +24,5 @@
 // {{{ requires
 require_once(CLASS_PATH . "pages/LC_Page.php");
+require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_FileManager_Ex.php");
 
 /**
@@ -64,25 +65,54 @@
         SC_Utils_Ex::sfIsSuccess($objSess);
 
-        $css_path = USER_PATH . "css/common.css";
-
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
-        // データ更新処理
-        if ($_POST['mode'] == 'confirm'){
-            // プレビュー用テンプレートに書き込み
-            $fp = fopen($css_path,"w"); // TODO
-            fwrite($fp, $_POST['css']);
-            fclose($fp);
-
-            $this->tpl_onload="alert('登録が完了しました。');";
-        }
+        $objFileManager = new SC_Helper_FileManager_Ex();
+
+        // CSSファイル名を取得
+        if (isset($_POST['css_name'])) {
+            $css_name = $_POST['css_name'];
+        }else if (isset($_GET['css_name'])){
+            $css_name = $_GET['css_name'];
+        }else{
+            $css_name = '';
+        }
+        $this->css_name = $css_name;
+
+        if (isset($_POST['old_css_name'])) {
+            $old_css_name = $_POST['old_css_name'];
+        }else if (isset($_GET['css_name'])) {
+            $old_css_name = $_GET['css_name'];
+        }else{
+            $old_css_name = '';
+        }
+        $this->old_css_name = $old_css_name;
+
+        $css_dir =  USER_TEMPLATE_PATH . TEMPLATE_NAME . "/css/";
+        $css_path = $css_dir . $css_name . '.css';
 
         // CSSファイルの読み込み
-        if(file_exists($css_path)){
-            $css_data = file_get_contents($css_path);
-        }
-
+        if($css_name != ''){
+            $css_data = $objFileManager->sfReadFile($css_path);
+        }
         // テキストエリアに表示
         $this->css_data = $css_data;
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+
+        switch($_POST['mode']) {
+            // データ更新処理
+            case 'confirm':
+                $this->lfExecuteConfirm($css_dir, $css_name, $old_css_name, $css_path);
+        	    break;
+            case 'delete':
+                $this->lfExecuteDelete($css_path);
+            	break;
+            default:
+            	if(isset($_POST['mode'])) {
+            	   GC_Utils::gfPrintLog("MODEエラー：".$_POST['mode']);
+            	}
+            	break;
+        }
+
+        // ファイルリストを取得
+        $this->arrCSSList = $this->lfGetCSSList($css_dir);
 
         // 画面の表示
@@ -99,4 +129,91 @@
         parent::destroy();
     }
+
+    function lfExecuteConfirm($css_dir, $css_name, $old_css_name, $css_path) {
+        $objFileManager = new SC_Helper_FileManager_Ex();
+
+        // エラーチェック
+        $this->arrErr = $this->lfErrorCheck($_POST, $css_dir);
+
+        // エラーがなければ更新処理を行う
+        if (count($this->arrErr) == 0) {
+            // 旧ファイルの削除
+            if ($old_css_name != '' && $old_css_name != $css_name) {
+                $objFileManager->sfDeleteDir($css_dir . $old_css_name . '.css');
+            }
+            // プレビュー用テンプレートに書き込み
+            $objFileManager->sfWriteFile($css_path, $_POST['css']);
+
+            $this->tpl_onload="alert('登録が完了しました。');";
+            $this->old_css_name = $css_name;
+        }
+        $this->css_data = $_POST['css'];
+    }
+
+    function lfExecuteDelete($css_path) {
+        $objFileManager = new SC_Helper_FileManager_Ex();
+
+        // css_name が空でない場合にはdeleteを実行
+        if ($_POST['css_name'] !== '') {
+            $objFileManager->sfDeleteDir($css_path);
+        }
+        $this->sendRedirect($this->getLocation("./css.php"));
+    }
+
+    /**
+     * CSSファイルのリストを取得.
+     *
+     * @param array $css_dir CSSディレクトリ
+     * @return array ファイルリスト
+     */
+    function lfGetCSSList($css_dir) {
+        $objFileManager = new SC_Helper_FileManager_Ex();
+
+        $arrFileList = $objFileManager->sfGetFileList($css_dir);
+        foreach ($arrFileList as $key => $val) {
+            if (!$val['is_dir']) {
+                $arrCSSList[] = array(
+                    'file_name' => $val['file_name'],
+                    'css_name'  => preg_replace('/(.+)\.(.+?)$/','$1',$val['file_name']),
+                );
+            }
+        }
+        return $arrCSSList;
+    }
+
+    /**
+     * 入力項目のエラーチェックを行う.
+     *
+     * @param array $arrData 入力データ
+     * @param array $css_dir CSSディレクトリ
+     * @return array エラー情報
+     */
+    function lfErrorCheck($array, $css_dir) {
+        $objErr = new SC_CheckError($array);
+
+        $objErr->doFunc(array("CSSファイル名", "css_name", STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK"));
+
+        // 入力文字が英数字,"_","-"以外ならエラーを返す
+        if(!isset($objErr->arrErr['css_name'])){
+            if(!ereg("^[a-zA-Z0-9_\.-]+$", $array['css_name'])) {
+                $objErr->arrErr['css_name'] = '※ CSSファイル名は英数字と"_"および"-"だけを入力してください。<br />';
+            }
+        }
+
+        // 同一のファイル名が存在している場合にはエラー
+        if(!isset($objErr->arrErr['css_name'])){
+            $arrCSSList = $this->lfGetCSSList($css_dir);
+            foreach ($arrCSSList as $key => $val) {
+                if ($val['css_name'] == $array['css_name']) {
+                    if ($array['old_css_name'] == '' || $array['old_css_name'] != $array['css_name']) {
+                        $errFlg = TRUE;
+                    }
+                }
+            }
+            if ($errFlg) $objErr->arrErr['css_name'] = '※ 同じファイル名のデータが存在しています。別の名称を付けてください。<br />';
+        }
+
+        return $objErr->arrErr;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php	(revision 18609)
@@ -51,5 +51,4 @@
         $this->tpl_mainno = "design";
         $this->tpl_subtitle = 'ヘッダー･フッター編集';
-        $this->tpl_onload = 'comment_start(); comment_end();';
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php	(revision 17653)
+++ tmp/version-2_5-test/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php	(revision 18609)
@@ -87,91 +87,12 @@
         // page_id が指定されている場合にはテンプレートデータの取得
         if (is_numeric($page_id) and $page_id != '') {
-            $arrPageData = $this->objLayout->lfgetPageData(" page_id = ? " , array($page_id));
-
-            if ($arrPageData[0]['tpl_dir'] === "") {
-                $this->arrErr['page_id_err'] = "※ 指定されたページは編集できません。";
-                // 画面の表示
-                $objView->assignobj($this);
-                $objView->display(MAIN_FRAME);
-                exit;
-            }
-
-            // テンプレートファイルが存在していれば読み込む
-            $tpl_file =  USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl";
-            if (file_exists($tpl_file)){
-                $arrPageData[0]['tpl_data'] = file_get_contents($tpl_file);
-            // 存在してなければ, 指定されたテンプレートのファイルを読み込む
-            } else {
-                $arrPageData[0]['tpl_data'] = file_get_contents(TEMPLATE_DIR . $arrPageData[0]['filename'] . ".tpl");
-            }
-
-            // チェックボックスの値変更
-            $arrPageData[0]['header_chk'] = SC_Utils_Ex::sfChangeCheckBox($arrPageData[0]['header_chk'], true);
-            $arrPageData[0]['footer_chk'] = SC_Utils_Ex::sfChangeCheckBox($arrPageData[0]['footer_chk'], true);
-
-            // ディレクトリを画面表示用に編集
-            $arrPageData[0]['directory'] = str_replace( USER_DIR,'', $arrPageData[0]['php_dir']);
-
-            $this->arrPageData = $arrPageData[0];
-        }
-
+            $this->lfGetPageData($page_id, $objView);
+        }
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+        
         // プレビュー処理
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-        
         if ($_POST['mode'] == 'preview') {
-
-            $page_id_old = $page_id;
-            // プレビューの場合ページIDを0にセットする。
-            $page_id = "0";
-            $url = basename($_POST['url']);
-            
-            $tmpPost = $_POST;
-            $tmpPost['page_id'] = $page_id;
-            $tmpPost['url'] = $url;
-            $tmpPost['tpl_dir'] = USER_PATH . "templates/preview/";
-            
-            $arrPreData = $this->objLayout->lfgetPageData("page_id = ?" , array($page_id));
-            
-            // tplファイルの削除
-            $del_tpl = USER_PATH . "templates/" . $arrPreData[0]['filename'] . '.tpl';
-            if (file_exists($del_tpl)){
-                unlink($del_tpl);
-            }
-
-            // DBへデータを更新する
-            $this->lfEntryPageData($tmpPost);
-
-            // TPLファイル作成
-            $preview_tpl = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $url . '.tpl';
-            $this->lfCreateFile($preview_tpl);
-            
-            // blocposition を削除
-            $objDBConn = new SC_DbConn;		// DB操作オブジェクト
-            $sql = 'delete from dtb_blocposition where page_id = 0';
-            $ret = $objDBConn->query($sql);
-
-            if ($page_id_old != "") {
-                // 登録データを取得
-                $sql = "SELECT 0, target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ?";
-                $ret = $objDBConn->getAll($sql,array($page_id_old));
-
-                if (count($ret) > 0) {
-
-                    // blocposition を複製
-                    $sql = " insert into dtb_blocposition (";
-                    $sql .= "     page_id,";
-                    $sql .= "     target_id,";
-                    $sql .= "     bloc_id,";
-                    $sql .= "     bloc_row";
-                    $sql .= "     )values(?, ?, ?, ?)";
-
-                    // 取得件数文INSERT実行
-                    foreach($ret as $key => $val){
-                        $ret = $objDBConn->query($sql,$val);
-                    }
-                }
-            }
-            $_SESSION['preview'] = "ON";
-            $this->sendRedirect($this->getLocation(URL_DIR . "preview/index.php", array("filename" => $arrPageData[0]["filename"])));
+            $this->lfPreviewPageData($page_id);
             exit;
         }
@@ -179,51 +100,10 @@
         // データ登録処理
         if ($_POST['mode'] == 'confirm') {
-
-            // エラーチェック
-            $this->arrErr = $this->lfErrorCheck($_POST);
-
-            // エラーがなければ更新処理を行う
-            if (count($this->arrErr) == 0) {
-                // DBへデータを更新する
-                $this->lfEntryPageData($_POST);
-
-                // ベースデータでなければファイルを削除し、PHPファイルを作成する
-                if (!$this->objLayout->lfCheckBaseData($page_id)) {
-                    // ファイル削除
-                    $this->objLayout->lfDelFile($arrPageData[0]);
-                    // PHPファイル作成
-                    $cre_php = USER_PATH . $_POST['url'] . ".php";
-                    $this->lfCreatePHPFile($cre_php);
-                }
-
-                // TPLファイル作成
-                $cre_tpl = USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/" . basename($_POST['url']) . '.tpl';
-
-                $this->lfCreateFile($cre_tpl);
-
-                // 編集可能ページの場合にのみ処理を行う
-                if ($arrPageData[0]['edit_flg'] != 2) {
-                    // 新規作成した場合のために改にページIDを取得する
-                    $arrPageData = $this->objLayout->lfgetPageData(" url = ? " , array(USER_URL.$_POST['url'].".php"));
-                    $page_id = $arrPageData[0]['page_id'];
-                }
-                $this->sendRedirect($this->getLocation("./main_edit.php",
-                                        array("page_id" => $page_id,
-                                              "msg"     => "on")));
-				exit;
-            }else{
-                // エラーがあれば入力時のデータを表示する
-                $this->arrPageData = $_POST;
-                $this->arrPageData['header_chk'] = SC_Utils_Ex::sfChangeCheckBox(SC_Utils_Ex::sfChangeCheckBox($_POST['header_chk']), true);
-                $this->arrPageData['footer_chk'] = SC_Utils_Ex::sfChangeCheckBox(SC_Utils_Ex::sfChangeCheckBox($_POST['footer_chk']), true);
-                $this->arrPageData['directory'] = $_POST['url'];
-                $this->arrPageData['filename'] = "";
-            }
+            $this->lfConfirmPageData($page_id);
         }
 
         // データ削除処理 ベースデータでなければファイルを削除
-        if ($_POST['mode'] == 'delete' and 	!$this->objLayout->lfCheckBaseData($page_id)) {
-            $this->objLayout->lfDelPageData($_POST['page_id']);
-            $this->sendRedirect($this->getLocation("./main_edit.php"));
+        if ($_POST['mode'] == 'delete' and !$this->objLayout->lfCheckBaseData($page_id)) {
+            $this->lfDeletePageData($page_id);
             exit;
         }
@@ -241,4 +121,152 @@
     function destroy() {
         parent::destroy();
+    }
+
+    /**
+     * ページデータを取得する.
+     *
+     * @param integer $page_id ページID
+     * @param object $objView ビューオブジェクト
+     * @return void
+     */
+    function lfGetPageData($page_id, $objView){
+        $arrPageData = $this->objLayout->lfgetPageData(" page_id = ? " , array($page_id));
+
+        if (strlen($arrPageData[0]['filename']) == 0) {
+            $this->arrErr['page_id_err'] = "※ 指定されたページは編集できません。";
+            // 画面の表示
+            $objView->assignobj($this);
+            $objView->display(MAIN_FRAME);
+            exit;
+        }
+
+        // テンプレートファイルが存在していれば読み込む
+        $tpl_file =  USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl";
+        if (file_exists($tpl_file)){
+            $arrPageData[0]['tpl_data'] = file_get_contents($tpl_file);
+        // 存在してなければ, 指定されたテンプレートのファイルを読み込む
+        } else {
+            $arrPageData[0]['tpl_data'] = file_get_contents(TEMPLATE_DIR . $arrPageData[0]['filename'] . ".tpl");
+        }
+
+        // チェックボックスの値変更
+        $arrPageData[0]['header_chk'] = SC_Utils_Ex::sfChangeCheckBox($arrPageData[0]['header_chk'], true);
+        $arrPageData[0]['footer_chk'] = SC_Utils_Ex::sfChangeCheckBox($arrPageData[0]['footer_chk'], true);
+
+        // ディレクトリを画面表示用に編集
+        $arrPageData[0]['directory'] = str_replace(USER_DIR, '', $arrPageData[0]['php_dir']);
+
+        $this->arrPageData = $arrPageData[0];
+    }
+
+    /**
+     * プレビュー画面を表示する.
+     *
+     * @param integer $page_id ページID
+     * @return void
+     */
+    function lfPreviewPageData($page_id){
+
+        $page_id_old = $page_id;
+        // プレビューの場合ページIDを0にセットする。
+        $page_id = "0";
+        $url = basename($_POST['url']);
+        
+        $tmpPost = $_POST;
+        $tmpPost['page_id'] = $page_id;
+        $tmpPost['url'] = $url;
+        $tmpPost['tpl_dir'] = USER_PATH . "templates/preview/";
+        
+        $arrPreData = $this->objLayout->lfgetPageData("page_id = ?" , array($page_id));
+        
+        // tplファイルの削除 (XXX: 処理の意図が不明。存在していると都合が悪いファイル?)
+        $del_tpl = USER_PATH . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+        if (file_exists($del_tpl)){
+            unlink($del_tpl);
+        }
+
+        // DBへデータを更新する
+        $this->lfEntryPageData($tmpPost);
+
+        // TPLファイル作成
+        $preview_tpl = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $url . '.tpl';
+        $this->lfCreateFile($preview_tpl, $_POST['tpl_data']);
+        
+        // blocposition を削除
+        $objDBConn = new SC_DbConn;		// DB操作オブジェクト
+        $sql = 'delete from dtb_blocposition where page_id = 0';
+        $ret = $objDBConn->query($sql);
+
+        if ($page_id_old != "") {
+            // 登録データを取得
+            $sql = "SELECT 0, target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ?";
+            $ret = $objDBConn->getAll($sql,array($page_id_old));
+
+            if (count($ret) > 0) {
+
+                // blocposition を複製
+                $sql = " insert into dtb_blocposition (";
+                $sql .= "     page_id,";
+                $sql .= "     target_id,";
+                $sql .= "     bloc_id,";
+                $sql .= "     bloc_row";
+                $sql .= "     )values(?, ?, ?, ?)";
+
+                // 取得件数文INSERT実行
+                foreach($ret as $key => $val){
+                    $ret = $objDBConn->query($sql,$val);
+                }
+            }
+        }
+        $_SESSION['preview'] = "ON";
+        $this->sendRedirect($this->getLocation(URL_DIR . "preview/" . DIR_INDEX_URL, array("filename" => $arrPageData[0]["filename"])));
+
+    }
+
+    /**
+     * データ登録処理.
+     *
+     * @param integer $page_id ページID
+     * @return void
+     */
+    function lfConfirmPageData($page_id){
+        // エラーチェック
+        $this->arrErr = $this->lfErrorCheck($_POST);
+
+        // エラーがなければ更新処理を行う
+        if (count($this->arrErr) == 0) {
+            // DBへデータを更新する
+            $this->lfEntryPageData($_POST);
+
+            // ベースデータでなければファイルを削除し、PHPファイルを作成する
+            if (!$this->objLayout->lfCheckBaseData($page_id)) {
+                // ファイル削除
+                $this->objLayout->lfDelFile($this->arrPageData);
+                // PHPファイル作成
+                $this->lfCreatePHPFile($_POST['url']);
+            }
+
+            // TPLファイル作成
+            $cre_tpl = USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/" . basename($_POST['url']) . '.tpl';
+            $this->lfCreateFile($cre_tpl, $_POST['tpl_data']);
+
+            // 新規作成の場合、
+            if ($page_id == '') {
+                // ページIDを取得する
+                $arrPageData = $this->objLayout->lfgetPageData(" url = ? AND page_id <> 0" , array(USER_DIR . $_POST['url'] . '.php'));
+                $page_id = $arrPageData[0]['page_id'];
+            }
+            $this->sendRedirect($this->getLocation("./main_edit.php",
+                                    array("page_id" => $page_id,
+                                          "msg"     => "on")));
+            exit;
+        } else {
+            // エラーがあれば入力時のデータを表示する
+            $this->arrPageData = $_POST;
+            $this->arrPageData['header_chk'] = SC_Utils_Ex::sfChangeCheckBox(SC_Utils_Ex::sfChangeCheckBox($_POST['header_chk']), true);
+            $this->arrPageData['footer_chk'] = SC_Utils_Ex::sfChangeCheckBox(SC_Utils_Ex::sfChangeCheckBox($_POST['footer_chk']), true);
+            $this->arrPageData['directory'] = '';
+            $this->arrPageData['filename'] = $_POST['url'];
+        }
     }
 
@@ -281,5 +309,5 @@
             $sql .= " ) VALUES ( ?,?,?,?,?,?,?,?,now(),now() )";
             $sql .= " ";
-        }else{
+        } else {
             // データが存在してる場合にはアップデートを行う
             // SQL生成
@@ -318,26 +346,46 @@
         if ($this->objLayout->lfCheckBaseData($arrData['page_id'])) {
             $arrPageData = $this->objLayout->lfgetPageData( ' page_id = ? ' , array($arrData['page_id']));
+            
             $name = $arrPageData[0]['page_name'] ;
             $url = $arrPageData[0]['url'];
+            $php_dir = $arrPageData[0]['php_dir'];
             $filename = $arrPageData[0]['filename'];
-        }else{
+        } else {
             $name = $arrData['page_name'] ;
-            $url = USER_URL.$arrData['url'].".php";
-            $filename = basename($arrData['url']);
+            $url = USER_DIR . $arrData['url'] . '.php';
+            $php_dir = dirname($url);
+            if ($php_dir == '.') {
+                $php_dir = '';
+            } else {
+                $php_dir .= '/';
+            }
+            $tpl_dir = substr(TPL_DIR, strlen(URL_DIR));
+            $filename = basename($arrData['url']); // 拡張子を付加しない
         }
         
         // 更新データ配列の作成
         $arrUpdData = array(
-                            $name										// 名称
-                            ,$url										// URL
-                            ,$php_dir									// PHPディレクトリ
-                            ,$tpl_dir									// TPLディレクトリ
-                            ,$filename									// ファイル名
-                            ,SC_Utils_Ex::sfChangeCheckBox($arrData['header_chk'])	// ヘッダー使用
-                            ,SC_Utils_Ex::sfChangeCheckBox($arrData['footer_chk'])	// フッター使用
-                            ,$_SERVER['HTTP_REFERER']					// 更新URL
-                            );
+            $name                                                   // 名称
+            ,$url                                                   // URL
+            ,$php_dir                                               // PHPディレクトリ
+            ,$tpl_dir                                               // TPLディレクトリ
+            ,$filename                                              // ファイル名
+            ,SC_Utils_Ex::sfChangeCheckBox($arrData['header_chk'])  // ヘッダー使用
+            ,SC_Utils_Ex::sfChangeCheckBox($arrData['footer_chk'])  // フッター使用
+            ,$_SERVER['HTTP_REFERER']                               // 更新URL
+        );
 
         return $arrUpdData;
+    }
+
+    /**
+     * ページデータを削除する.
+     *
+     * @param integer $page_id ページID
+     * @return void
+     */
+    function lfDeletePageData($page_id){
+        $this->objLayout->lfDelPageData($_POST['page_id']);
+        $this->sendRedirect($this->getLocation("./main_edit.php"));
     }
 
@@ -352,25 +400,42 @@
         $objErr->doFunc(array("名称", "page_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("URL", "url", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-
+        
         // URLチェック
-        if (substr(strrev(trim($array['url'])),0,1) == "/") {
+        $okUrl = true;
+        foreach (explode('/', $array['url']) as $url_part) {
+            if (!ereg( '^[a-zA-Z0-9:_~\.-]+$', $url_part)) {
+                $okUrl = false;
+            }
+            if ($url_part == '.' || $url_part == '..') {
+                $okUrl = false;
+            }
+        }
+        if (!$okUrl) {
             $objErr->arrErr['url'] = "※ URLを正しく入力してください。<br />";
         }
-
-        $check_url = USER_URL . $array['url'] . ".php";
-        if( strlen($array['url']) > 0 && !ereg( "^https?://+($|[a-zA-Z0-9:_~=&\?\.\/-])+$", $check_url ) ) {
-            $objErr->arrErr['url'] = "※ URLを正しく入力してください。<br />";
-        }
-
+        
         // 同一のURLが存在している場合にはエラー
-        if(!isset($objErr->arrErr['url']) and $array['url'] !== ''){
-        	// URLのチェック（プレビュー用のレコードは含まない）
-            $arrChk = $this->objLayout->lfgetPageData(" url = ? AND page_id <> 0" , array(USER_URL . $array['url'].".php"));
-
-            if (count($arrChk[0]) >= 1 and $arrChk[0]['page_id'] != $array['page_id']) {
-                $objErr->arrErr['url'] = '※ 同じURLのデータが存在しています。別のURLを付けてください。<br />';
-            }
-        }
-
+        $sqlWhere = '';
+        $params = array();
+        
+        $sqlWhere .= ' (url = ? OR url = ?)';
+        $params[] = USER_DIR . $array['url'] . '.php';
+        $params[] = USER_URL . $array['url'] . '.php'; // 従来形式
+        
+        // プレビュー用のレコードは除外
+        $sqlWhere .= ' AND page_id <> 0';
+        
+        // 変更の場合、自身のレコードは除外
+        if (strlen($array['page_id']) != 0) {
+            $sqlWhere .= ' AND page_id <> ?';
+            $params[] = $array['page_id'];
+        }
+        
+        $arrChk = $this->objLayout->lfgetPageData($sqlWhere , $params);
+        
+        if (count($arrChk) >= 1) {
+            $objErr->arrErr['url'] = '※ 同じURLのデータが存在しています。別のURLを付けてください。<br />';
+        }
+        
         return $objErr->arrErr;
     }
@@ -380,7 +445,8 @@
      *
      * @param string $path テンプレートファイルのパス
-     * @return void
-     */
-    function lfCreateFile($path){
+     * @param string $data テンプレートの内容
+     * @return void
+     */
+    function lfCreateFile($path, $data){
 
         // ディレクトリが存在していなければ作成する
@@ -391,5 +457,5 @@
         // ファイル作成
         $fp = fopen($path,"w");
-        fwrite($fp, $_POST['tpl_data']); // FIXME いきなり POST はちょっと...
+        fwrite($fp, $data); // FIXME いきなり POST はちょっと...
         fclose($fp);
     }
@@ -401,6 +467,8 @@
      * @return void
      */
-    function lfCreatePHPFile($path){
-
+    function lfCreatePHPFile($url){
+
+        $path = USER_PATH . $url . ".php";
+        
         // php保存先ディレクトリが存在していなければ作成する
         if (!is_dir(dirname($path))) {
@@ -414,5 +482,5 @@
 
         // require.phpの場所を書き換える
-        $php_data = str_replace("###require###", HTML_PATH . "require.php", $php_data);
+        $php_data = str_replace("###require###", str_repeat('../', substr_count($url, '/')) . '../require.php', $php_data);
 
         // phpファイルの作成
Index: tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php	(revision 18609)
@@ -47,5 +47,4 @@
 
         $this->tpl_mainpage = 'ownersstore/index.tpl';
-        $this->tpl_subnavi  = 'ownersstore/subnavi.tpl';
         $this->tpl_mainno   = 'ownersstore';
         $this->tpl_subno    = 'index';
Index: tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php	(revision 18609)
@@ -55,8 +55,8 @@
 
         $this->tpl_mainpage = 'ownersstore/settings.tpl';
-        $this->tpl_subnavi  = 'ownersstore/subnavi.tpl';
         $this->tpl_mainno   = 'ownersstore';
         $this->tpl_subno    = 'settings';
         $this->tpl_subtitle = '認証キー設定';
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Log.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Log.php	(revision 16870)
+++ tmp/version-2_5-test/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Log.php	(revision 18609)
@@ -46,5 +46,4 @@
 
         $this->tpl_mainpage = 'ownersstore/log.tpl';
-        $this->tpl_subnavi  = 'ownersstore/subnavi.tpl';
         $this->tpl_mainno   = 'ownersstore';
         $this->tpl_subno    = 'log';
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php	(revision 17466)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php	(revision 18609)
@@ -48,4 +48,5 @@
         $this->tpl_mainno = 'order';
         $this->tpl_subno = 'status';
+        $this->tpl_subtitle = 'ステータス管理';
 
         $masterData = new SC_DB_MasterData_Ex();
@@ -63,5 +64,4 @@
         $objSess = new SC_Session();
         $objDb = new SC_Helper_DB_Ex();
-        $objQuery = new SC_Query();
 
         // 認証可否の判定
@@ -81,9 +81,20 @@
         case 'update':
             if (!isset($_POST['change_status'])) $_POST['change_status'] = "";
-            if ($_POST['change_status'] == 'delete') {
-                $this->lfStatusMove("delete",$_POST['move']);
-            } elseif (!empty($_POST['change_status'])) {
-                $this->lfStatusMove($_POST['change_status'], $_POST['move']);
+            
+            switch ($_POST['change_status']) {
+                case '':
+                    break;
+                
+                // 削除
+                case 'delete':
+                    $this->lfDelete($_POST['move']);
+                    break;
+                
+                // 更新
+                default:
+                    $this->lfStatusMove($_POST['change_status'], $_POST['move']);
+                    break;
             }
+            
             //ステータス情報
             $status = isset($_POST['status']) ? $_POST['status'] : "";
@@ -152,42 +163,53 @@
     }
 
-    //ステータス情報の更新（削除）
-    function lfStatusMove($status_id, $arrMove){
+    /**
+     * ステータス情報の更新
+     */
+    function lfStatusMove($statusId, $arrOrderId) {
         $objQuery = new SC_Query();
+        
+        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
+            return false;
+        }
         $masterData = new SC_DB_MasterData_Ex();
         $arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
-
-        $table = 'dtb_order';
-        $where = 'order_id = ?';
-        $arrUpdate = array('update_date' => 'NOW()');
-
-        $delflg  = '1'; // 削除フラグ
-        $message = '';  // ステータス変更後にポップアップするメッセージの内容
-
-        if ( $status_id == 'delete' ) {
-            $arrUpdate['del_flg'] = $delflg;
-            $message = '削除';
-        }
-        // ステータスが発送済みの時は発送日を更新
-        elseif ( $status_id == ORDER_DELIV ) {
-            $arrUpdate['status'] = $status_id;
-            $arrUpdate['commit_date'] = 'NOW()';
-            $message = $arrORDERSTATUS[$status_id] . 'へ移動';
-        }
-        else {
-            $arrUpdate['status'] = $status_id;
-            $message = $arrORDERSTATUS[$status_id] . 'へ移動';
-        }
-
-        if ( isset($arrMove) ){
-            foreach ( $arrMove as $val ){
-                if ( $val != "" ) {
-                    $objQuery->update($table, $arrUpdate, $where, array($val));
-                }
-
-            }
-        }
-
-        $this->tpl_onload = "window.alert('選択項目を" . $message . "しました。');";
+        
+        $objQuery->begin();
+        
+        foreach ($arrOrderId as $orderId) {
+            SC_Helper_DB_Ex::sfUpdateOrderStatus($orderId, $statusId);
+        }
+        
+        $objQuery->commit();
+        
+        $this->tpl_onload = "window.alert('選択項目を" . $arrORDERSTATUS[$statusId] . "へ移動しました。');";
+        return true;
+    }
+
+    /**
+     * 受注テーブルの論理削除
+     */
+    function lfDelete($arrOrderId) {
+        $objQuery = new SC_Query();
+        
+        if (!isset($arrOrderId) || !is_array($arrOrderId)) {
+            return false;
+        }
+        
+        $arrUpdate = array(
+             'del_flg' => 1
+            ,'update_date' => 'Now()'
+        );
+        
+        $objQuery->begin();
+        
+        foreach ($arrOrderId as $orderId) {
+            $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId));
+        }
+        
+        $objQuery->commit();
+        
+        $this->tpl_onload = "window.alert('選択項目を削除しました。');";
+        return true;
     }
 }
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php	(revision 18609)
@@ -27,10 +27,10 @@
 /* GMO決済モジュール連携用 */
 if (file_exists(MODULE_PATH . 'mdl_gmopg/inc/include.php') === TRUE) {
-  require_once(MODULE_PATH . 'mdl_gmopg/inc/include.php');
+    require_once(MODULE_PATH . 'mdl_gmopg/inc/include.php');
 }
 
 /* ペイジェント決済モジュール連携用 */
 if (file_exists(MODULE_PATH . 'mdl_paygent/include.php') === TRUE) {
-    require_once(MODULE_PATH . 'mdl_paygent/include.php');
+  require_once(MODULE_PATH . 'mdl_paygent/include.php');
 }
 
@@ -98,4 +98,5 @@
             $this->arrFregiDispKind = $arrFregiDispKind;
         }
+        $this->httpCacheControl('nocache');
     }
 
@@ -109,11 +110,9 @@
         $objView = new SC_AdminView();
         $objSess = new SC_Session();
-        $objSiteInfo = new SC_SiteInfo();
         $objDb = new SC_Helper_DB_Ex();
-        $objDate = new SC_Date(1901); 
+        $objDate = new SC_Date(1901);
         $this->arrYearDelivDate = $objDate->getYear('', date('Y'), '');
         $this->arrMonthDelivDate = $objDate->getMonth(true);
         $this->arrDayDelivDate = $objDate->getDay(true);
-        $arrInfo = $objSiteInfo->data;
 
         // パラメータ管理クラス
@@ -157,5 +156,4 @@
             $this->objFormParam->convParam();
             $this->arrErr = $this->lfCheckError();
-            $this->arrErr = array_merge( (array) $this->arrErr, (array)$this->lfCheek($arrInfo, $_POST['mode']) );
 
             if(count($this->arrErr) == 0) {
@@ -179,5 +177,5 @@
             }
             break;
-        // 再計算
+            // 再計算
         case 'cheek':
         //支払い方法の選択
@@ -188,7 +186,4 @@
             $this->objFormParam->convParam();
             $this->arrErr = $this->lfCheckError();
-            if(count($this->arrErr) == 0) {
-                $this->arrErr = $this->lfCheek($arrInfo, $_POST['mode']);
-            }
             break;
         /* ペイジェント決済モジュール連携用 */
@@ -214,4 +209,5 @@
             // 入力値の変換
             $this->objFormParam->convParam();
+            $this->arrErr = $this->lfCheckError();
             break;
         /* 商品追加ポップアップより商品選択後、商品情報取得*/
@@ -236,4 +232,5 @@
             // 入力値の変換
             $this->objFormParam->convParam();
+            $this->arrErr = $this->lfCheckError();
             break;
         /* 顧客検索ポップアップより顧客指定後、顧客情報取得*/
@@ -302,5 +299,6 @@
         $this->tpl_onload .= $anchor_hash;
 
-        $this->arrInfo = $arrInfo;
+        $objSiteInfo = new SC_SiteInfo();
+        $this->arrInfo = $objSiteInfo->data;
 
         /**
@@ -343,27 +341,27 @@
         $this->objFormParam->addParam("顧客名カナ1", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("顧客名カナ2", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("メールアドレス", "order_email", MTEXT_LEN, "KVCa", array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "order_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "order_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-        $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-        $this->objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("メールアドレス", "order_email", MTEXT_LEN, "KVCa", array("NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
 
         // お届け先情報
-        $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("フリガナ1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("フリガナ2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "deliv_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "deliv_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
-        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ1", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("フリガナ2", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array( "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
 
 
@@ -374,5 +372,5 @@
 
         // ポイント機能ON時のみ
-        if( USE_POINT === true ){
+        if (USE_POINT !== false) {
             $this->objFormParam->addParam("利用ポイント", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
         }
@@ -387,5 +385,5 @@
         // 受注詳細情報
         $this->objFormParam->addParam("単価", "price", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
-        $this->objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+        $this->objFormParam->addParam("数量", "quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
         $this->objFormParam->addParam("商品ID", "product_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
         $this->objFormParam->addParam("ポイント付与率", "point_rate");
@@ -410,5 +408,5 @@
         $this->objFormParam->addParam("受注日", "create_date");
         $this->objFormParam->addParam("発送日", "commit_date");
-        $this->objFormParam->addParam("お届け日", "deliv_date"); 
+        $this->objFormParam->addParam("備考", "message");
     }
 
@@ -424,9 +422,4 @@
             $this->objFormParam->setValue('total_point', $total_point);
             $this->objFormParam->setValue('point', $point);
-            $delivDate = split(" ", $arrRet[0]["deliv_date"]);
-            $delivDate = split("-", $delivDate[0]);
-            $this->objFormParam->setValue('deliv_date_year', $delivDate[0]);
-            $this->objFormParam->setValue('deliv_date_month', isset($delivDate[1]) ? $delivDate[1] : "");
-            $this->objFormParam->setValue('deliv_date_day', isset($delivDate[2]) ? $delivDate[2] : "");
             $this->arrForm = $arrRet[0];
 
@@ -446,5 +439,5 @@
                 $this->arrForm["payment_type"] = "お支払い";
             }
-            //受注データを表示用配列に代入（各EC-CUBEバージョンと決済モジュールとのデータ連携保全のため）
+            // 受注データを表示用配列に代入（各EC-CUBEバージョンと決済モジュールとのデータ連携保全のため）
             $this->arrDisp = $this->arrForm;
         }
@@ -468,15 +461,13 @@
         $objErr->arrErr = $this->objFormParam->checkError();
 
-        $objErr->doFunc(array("お届け日", "deliv_date_year", "deliv_date_month", "deliv_date_day"), array("CHECK_DATE"));
-
         if (count($objErr->arrErr) >= 1) {
             return $objErr->arrErr;
         }
-
-        return $objErr->arrErr;
+        
+        return $this->lfCheek();
     }
 
     /* 計算処理 */
-    function lfCheek($arrInfo,$mode = "") {
+    function lfCheek() {
         $objDb = new SC_Helper_DB_Ex();
         $arrVal = $this->objFormParam->getHashArray();
@@ -490,7 +481,7 @@
         for($i = 0; $i < $max; $i++) {
             // 小計の計算
-            $subtotal += SC_Utils_Ex::sfPreTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+            $subtotal += SC_Helper_DB_Ex::sfPreTax($arrVal['price'][$i]) * $arrVal['quantity'][$i];
             // 小計の計算
-            $totaltax += SC_Utils_Ex::sfTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+            $totaltax += SC_Helper_DB_Ex::sfTax($arrVal['price'][$i]) * $arrVal['quantity'][$i];
             // 加算ポイントの計算
             $totalpoint += SC_Utils_Ex::sfPrePoint($arrVal['price'][$i], $arrVal['point_rate'][$i]) * $arrVal['quantity'][$i];
@@ -507,22 +498,22 @@
 
         // 加算ポイント
-        $arrVal['add_point'] = SC_Utils_Ex::sfGetAddPoint($totalpoint, $arrVal['use_point'], $arrInfo);
-
-        if (strlen($_POST['customer_id']) >0){
+        $arrVal['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($totalpoint, $arrVal['use_point']);
+
+        if (strlen($_POST['customer_id']) > 0){
             list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPointFromCid($_POST['customer_id'], $arrVal['use_point'], $arrVal['add_point']);
         }else{
             list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
         }
-        if($arrVal['total'] < 0) {
+        if ($arrVal['total'] < 0) {
             $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />';
         }
 
-        if($arrVal['payment_total'] < 0) {
+        if ($arrVal['payment_total'] < 0) {
             $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />';
         }
         //新規追加受注のみ
-        if ($mode == "add"){
-            if($arrVal['total_point'] < 0) {
-                $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />';
+        if ($_POST['mode'] == "add") {
+            if ($arrVal['total_point'] < 0) {
+                    $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />';
             }
         }
@@ -532,118 +523,37 @@
     }
 
-    function lfReCheek($arrData, $arrInfo) {
-        // 情報上書き
-        $this->objFormParam->setParam($arrData);
-        // 入力値の変換
-        $this->objFormParam->convParam();
-        #if(count($this->arrErr) == 0) {
-            $this->arrErr = $this->lfCheek($arrInfo);
-        #}
-    }
-    /* DB登録処理 */
+    /**
+     * DB更新処理
+     *
+     * @param integer $order_id 注文番号
+     * @return void
+     */
     function lfRegistData($order_id) {
         $objQuery = new SC_Query();
 
+        $sqlval = $this->lfMakeSqlvalForDtbOrder();
+
+        $where = "order_id = ?";
+
         $objQuery->begin();
 
-        // 入力データを渡す。
-        $arrRet =  $this->objFormParam->getHashArray();
-        foreach($arrRet as $key => $val) {
-            // 配列は登録しない
-            if(!is_array($val)) {
-                $sqlval[$key] = $val;
-            }
-        }
-        $sqlval['update_date'] = 'Now()';
-
-        if (strlen($sqlval['deliv_date_year']) >= 0) {
-            $sqlval['deliv_date'] = $sqlval['deliv_date_year'] . '-' . $sqlval['deliv_date_month'] . '-' . $sqlval['deliv_date_day'];
-        }
-        unset($sqlval['deliv_date_year']);
-        unset($sqlval['deliv_date_month']);
-        unset($sqlval['deliv_date_day']);
-
-        unset($sqlval['total_point']);
-        unset($sqlval['point']);
-        unset($sqlval['commit_date']);
-
-        $where = "order_id = ?";
-
-        /*
-         * XXX 本来なら配列だが, update 関数を string として
-         *     チェックしているため...
-         */
-        if (!isset($addcol)) $addcol = "";
+        // 受注.対応状況の更新
+        SC_Helper_DB_Ex::sfUpdateOrderStatus($order_id, $sqlval['status'], $sqlval['add_point'], $sqlval['use_point']);
+        unset($sqlval['status']);
+        unset($sqlval['add_point']);
+        unset($sqlval['use_point']);
 
         // 受注テーブルの更新
-        $objQuery->update("dtb_order", $sqlval, $where, array($order_id), $addcol);
-
-        $sql = "";
-        $sql .= " UPDATE";
-        $sql .= "     dtb_order";
-        $sql .= " SET";
-        $sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
-        $sql .= "     ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
-        // 受注ステータスの判定
-        if ($sqlval['status'] == ODERSTATUS_COMMIT) {
-            // 受注テーブルの発送済み日を更新する
-            $sql .= "     ,commit_date = NOW()";
-        }
-        $sql .= " WHERE order_id = ?";
-
-        if ($arrRet['deliv_time_id'] == "") {
-            $deliv_time_id = 0;
-        }else{
-            $deliv_time_id = $arrRet['deliv_time_id'];
-        }
-        $arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
-        $objQuery->query($sql, $arrUpdData);
-
+        $objQuery->update("dtb_order", $sqlval, $where, array($order_id));
+        
+        // 受注テーブルの名称列を更新
+        SC_Helper_DB_Ex::sfUpdateOrderNameCol($order_id);
+        
+        // 受注詳細データの更新
         $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
-
-
-        // 変更しようとしている商品情報とDBに登録してある商品情報を比較することで、更新すべき数量を計算
+        $objQuery->delete("dtb_order_detail", $where, array($order_id));
+
         $max = count($arrDetail);
-        $k = 0;
-        $arrStockData = array();
-        for($i = 0; $i < $max; $i++) {
-            if (!empty($arrDetail[$i]['product_id'])) {
-                $arrPreDetail = $objQuery->select('*', "dtb_order_detail", "order_id = ? AND product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?", array($order_id, $arrDetail[$i]['product_id'], $arrDetail[$i]['classcategory_id1'], $arrDetail[$i]['classcategory_id2']));
-                if (!empty($arrPreDetail) && $arrPreDetail[0]['quantity'] != $arrDetail[$i]['quantity']) {
-                    // 数量が変更された商品
-                    $arrStockData[$k]['product_id'] = $arrDetail[$i]['product_id'];
-                    $arrStockData[$k]['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
-                    $arrStockData[$k]['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
-                    $arrStockData[$k]['quantity'] = $arrPreDetail[0]['quantity'] - $arrDetail[$i]['quantity'];
-                    ++$k;
-                } elseif (empty($arrPreDetail)) {
-                    // 新しく追加された商品 もしくは 違う商品に変更された商品
-                    $arrStockData[$k]['product_id'] = $arrDetail[$i]['product_id'];
-                    $arrStockData[$k]['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
-                    $arrStockData[$k]['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
-                    $arrStockData[$k]['quantity'] = -$arrDetail[$i]['quantity'];
-                    ++$k;
-                }
-                $objQuery->delete("dtb_order_detail", "order_id = ? AND product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?", array($order_id, $arrDetail[$i]['product_id'], $arrDetail[$i]['classcategory_id1'], $arrDetail[$i]['classcategory_id2']));
-            }
-        }
-
-        // 上記の新しい商品のループでDELETEされなかった商品は、注文より削除された商品
-        $arrPreDetail = $objQuery->select('*', "dtb_order_detail", "order_id = ?", array($order_id));
-        foreach ($arrPreDetail AS $key=>$val) {
-            $arrStockData[$k]['product_id'] = $val['product_id'];
-            $arrStockData[$k]['classcategory_id1'] = $val['classcategory_id1'];
-            $arrStockData[$k]['classcategory_id2'] = $val['classcategory_id2'];
-            $arrStockData[$k]['quantity'] = $val['quantity'];
-            ++$k;
-        }
-
-        // 受注詳細データの初期化
-        $objQuery->delete("dtb_order_detail", $where, array($order_id));
-
-
-        // 受注詳細データの更新
-        $max = count($arrDetail);
-        for($i = 0; $i < $max; $i++) {
+        for ($i = 0; $i < $max; $i++) {
             $sqlval = array();
             $sqlval['order_id'] = $order_id;
@@ -661,93 +571,51 @@
         }
 
-        // 在庫数調整
-        $status = $sqlval['status'];
-        if (ORDER_DELIV != $status && ORDER_CANCEL != $status) {
-            $stock_sql = "UPDATE dtb_products_class SET stock = stock + ? WHERE product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?;";
-            foreach ($arrStockData AS $key=>$val) {
-                $stock_sqlval = array();
-                $stock_sqlval[] = $val['quantity'];
-                $stock_sqlval[] = $val['product_id'];
-                $stock_sqlval[] = $val['classcategory_id1'];
-                $stock_sqlval[] = $val['classcategory_id2'];
-
-                $objQuery->query($stock_sql, $stock_sqlval);
-            }
-        }
-
         $objQuery->commit();
     }
 
-    /* DB登録処理(追加) */
+    /**
+     * DB登録処理
+     *
+     * @return integer 注文番号
+     */
     function lfRegistNewData() {
         $objQuery = new SC_Query();
 
+        $sqlval = $this->lfMakeSqlvalForDtbOrder();
+
+        // 受注テーブルに書き込まない列を除去
+        unset($sqlval['order_id']); 
+
+        // ポイントは別登録
+        $addPoint = $sqlval['add_point'];
+        $usePoint = $sqlval['use_point'];
+        $sqlval['add_point'] = 0;
+        $sqlval['use_point'] = 0;
+
+        // customer_id
+        if ($sqlval["customer_id"] == "") {
+            $sqlval['customer_id'] = '0';
+        }
+
+        $sqlval['create_date'] = 'Now()';       // 受注日
+
         $objQuery->begin();
-
-        // 入力データを渡す。
-        $arrRet =  $this->objFormParam->getHashArray();
-        foreach($arrRet as $key => $val) {
-            // 配列は登録しない
-            if(!is_array($val)) {
-                $sqlval[$key] = $val;
-            }
-        }
-
-        // postgresqlとmysqlとで処理を分ける
-        if (DB_TYPE == "pgsql") {
-            $order_id = $objQuery->nextval("dtb_order","order_id");
-        }elseif (DB_TYPE == "mysql") {
-            $order_id = $objQuery->get_auto_increment("dtb_order");
-        }
-
-        $sqlval['order_id'] = $order_id;
-        $sqlval['create_date'] = "Now()";
-
-        // 注文ステータス:指定が無ければ新規受付に設定
-        if($sqlval["status"] == ""){
-            $sqlval['status'] = '1';
-        }
-
-        // customer_id
-        if($sqlval["customer_id"] == ""){
-            $sqlval['customer_id'] = '0';
-        }
-
-        unset($sqlval['total_point']);
-        unset($sqlval['point']);
-
-        $where = "order_id = ?";
-
-        // 受注ステータスの判定
-        if ($sqlval['status'] == ODERSTATUS_COMMIT) {
-            // 受注テーブルの発送済み日を更新する
-            $sqlval['commit_date'] = "Now()";
-        }
 
         // 受注テーブルの登録
         $objQuery->insert("dtb_order", $sqlval);
-
-        $sql = "";
-        $sql .= " UPDATE";
-        $sql .= "     dtb_order";
-        $sql .= " SET";
-        $sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
-        $sql .= "     ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
-        $sql .= " WHERE order_id = ?";
-
-        if ($arrRet['deliv_time_id'] == "") {
-            $deliv_time_id = 0;
-        } else {
-            $deliv_time_id = $arrRet['deliv_time_id'];
-        }
-        $arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
-        $objQuery->query($sql, $arrUpdData);
+        $order_id = $objQuery->currval('dtb_order', 'order_id'); 
+
+        // 受注.対応状況の更新
+        SC_Helper_DB_Ex::sfUpdateOrderStatus($order_id, null, $addPoint, $usePoint);
+
+        // 受注テーブルの名称列を更新
+        SC_Helper_DB_Ex::sfUpdateOrderNameCol($order_id);
 
         // 受注詳細データの更新
         $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
-        $objQuery->delete("dtb_order_detail", $where, array($order_id));
+        $objQuery->delete("dtb_order_detail", 'order_id = ?', array($order_id));
 
         $max = count($arrDetail);
-        for($i = 0; $i < $max; $i++) {
+        for ($i = 0; $i < $max; $i++) {
             $sqlval = array();
             $sqlval['order_id'] = $order_id;
@@ -762,25 +630,7 @@
             $sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
             $sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];
-
             $objQuery->insert("dtb_order_detail", $sqlval);
-
-
-            // 在庫数減少処理
-            // 現在の実在庫数取得
-            $pre_stock = $objQuery->getone("SELECT stock FROM dtb_products_class WHERE product_id = ? AND classcategory_id1 = ?  AND classcategory_id2 = ?", array($arrDetail[$i]['product_id'], $arrDetail[$i]['classcategory_id1'], $arrDetail[$i]['classcategory_id2']));
-
-            $stock_sqlval = array();
-            $stock_sqlval['stock'] = intval($pre_stock - $arrDetail[$i]['quantity']);
-            if ($stock_sqlval['stock'] === 0) {
-                $stock_sqlval['stock'] = '0';
-            }
-
-            $st_params = array();
-            $st_params[] = $arrDetail[$i]['product_id'];
-            $st_params[] = $arrDetail[$i]['classcategory_id1'];
-            $st_params[] = $arrDetail[$i]['classcategory_id2'];
-
-            $objQuery->update("dtb_products_class", $stock_sqlval, 'product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?', $st_params);
-        }
+        }
+
         $objQuery->commit();
 
@@ -796,6 +646,6 @@
         if (!empty($this->arrForm['product_id']['value'])) {
             foreach ($this->arrForm['product_id']['value'] AS $key=>$val) {
+                // 既に同じ商品がある場合
                 if ($val == $product_id && $this->arrForm['product_id']['classcategory_id1'][$key] == $classcategory_id1 && $this->arrForm['product_id']['classcategory_id2'][$key] == $classcategory_id2) {
-                    // 既に同じ商品がある
                     $existes = true;
                     $existes_key = $key;
@@ -805,8 +655,8 @@
 
         if ($existes) {
-            // 既に同じ商品がある場合
+        // 既に同じ商品がある場合
             ++$this->arrForm['quantity']['value'][$existes_key];
         } else {
-            // 既に同じ商品がない場合
+        // 既に同じ商品がない場合
             $this->lfSetProductData($arrProduct);
         }
@@ -835,5 +685,5 @@
         $objDb = new SC_Helper_DB_Ex();
         $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
-        $arrRet = $objDb->sfGetProductsClass(array($product_id, $classcategory_id1, $classcategory_id2));
+        $arrRet = $objDb->sfGetProductsClass(array($product_id, $classcategory_id1, $classcategory_id2), true);
 
         $arrProduct['price'] = $arrRet['price02'];
@@ -889,4 +739,31 @@
         }
     }
+
+    /**
+     * 受注テーブルの登録・更新用データの共通部分を作成する
+     *
+     * @return array
+     */
+    function lfMakeSqlvalForDtbOrder() {
+
+        // 入力データを取得する
+        $sqlval = $this->objFormParam->getHashArray();
+        foreach ($sqlval as $key => $val) {
+            // 配列は登録しない
+            if (is_array($val)) {
+                unset($sqlval[$key]);
+            }
+        }
+
+        // 受注テーブルに書き込まない列を除去
+        unset($sqlval['total_point']);
+        unset($sqlval['point']);
+        unset($sqlval['commit_date']);
+
+        // 更新日時
+        $sqlval['update_date'] = 'Now()';
+
+        return $sqlval;
+   }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php	(revision 18609)
@@ -102,11 +102,9 @@
             // エラー入力なし
             if (count($this->arrErr) == 0) {
-                $i = 0;
                 $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']);
-                foreach ( $arrRet['order_id'] AS $key=>$val ) {
+                foreach ($arrRet['order_id'] AS $key => $val) {
                     $arrPdfData = $arrRet;
                     $arrPdfData['order_id'] = $val;
                     $objFpdf->setData($arrPdfData);
-                    ++$i;
                 }
                 $objFpdf->createPdf();
@@ -130,10 +128,10 @@
             // 注文番号があったら、セットする
             if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
-                  $arrForm['order_id'][0] = $_GET['order_id'];
+	              $arrForm['order_id'][0] = $_GET['order_id'];
             } elseif (is_array($_POST['pdf_order_id'])) {
-                    sort($_POST['pdf_order_id']);
-                    foreach ($_POST['pdf_order_id'] AS $key=>$val) {
-                          $arrForm['order_id'][] = $val;
-                    }
+                sort($_POST['pdf_order_id']);
+                foreach ($_POST['pdf_order_id'] AS $key=>$val) {
+	                  $arrForm['order_id'][] = $val;
+                }
             }
 
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_MailView.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_MailView.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_MailView.php	(revision 18609)
@@ -45,4 +45,5 @@
         parent::init();
         $this->tpl_mainpage = 'order/mail_view.tpl';
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 18609)
@@ -27,9 +27,9 @@
 /* ペイジェント決済モジュール連携用 */
 if (file_exists(MODULE_PATH . 'mdl_paygent/include.php') === TRUE) {
-  require_once(MODULE_PATH . 'mdl_paygent/include.php');
+    require_once(MODULE_PATH . 'mdl_paygent/include.php');
 }
 
 /**
- * 受注管理 のページクラス.
+ * 受注管理 のページクラス
  *
  * @package Page
@@ -66,4 +66,5 @@
             $this->arrDispKind = sfPaygentOrderPage();
         }
+        $this->httpCacheControl('nocache');
     }
 
@@ -91,11 +92,11 @@
             if (ereg("^search_", $key)) {
                 switch($key) {
-                case 'search_order_sex':
-                case 'search_payment_id':
-                    $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
-                    break;
-                default:
-                    $this->arrHidden[$key] = $val;
-                    break;
+                    case 'search_order_sex':
+                    case 'search_payment_id':
+                        $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
+                        break;
+                    default:
+                        $this->arrHidden[$key] = $val;
+                        break;
                 }
             }
@@ -104,5 +105,5 @@
         // ページ送り用
         $this->arrHidden['search_pageno'] =
-            isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
+        isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
 
         // 認証可否の判定
@@ -122,217 +123,223 @@
 
         switch($_POST['mode']) {
-        case 'delete':
-        case 'csv':
-        case 'pdf':
-        case 'delete_all':
-        case 'search':
-            // 入力値の変換
-            $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError($arrRet);
-            $arrRet = $this->objFormParam->getHashArray();
-            // 入力なし
-            if (count($this->arrErr) == 0) {
-                $where = "del_flg = 0";
-                foreach ($arrRet as $key => $val) {
-                    if($val == "") {
-                        continue;
+            case 'delete':
+            case 'csv':
+            case 'delete_all':
+            case 'search':
+                // 入力値の変換
+                $this->objFormParam->convParam();
+                $this->arrErr = $this->lfCheckError($arrRet);
+                $arrRet = $this->objFormParam->getHashArray();
+                // 入力なし
+                if (count($this->arrErr) == 0) {
+                    $where = "del_flg = 0";
+                    foreach ($arrRet as $key => $val) {
+                        if($val == "") {
+                            continue;
+                        }
+                        $val = SC_Utils_Ex::sfManualEscape($val);
+
+                        switch ($key) {
+
+                            case 'search_product_name':
+                                if(DB_TYPE == "pgsql"){
+//                                    $val = mb_convert_encoding($val,"UTF-8",mb_detect_encoding($val));
+                                    $where .= " AND (SELECT COUNT(*) FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_name ILIKE ?) > 0";
+                                    $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
+                                    $arrval[] = "%$nonsp_val%";
+                                }elseif(DB_TYPE == "mysql"){
+                                    $where .= " AND (SELECT COUNT(*) FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_name LIKE ?) > 0";
+                                    $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
+                                    $arrval[] = "%$nonsp_val%";
+                                }
+                                break;
+                            case 'search_order_name':
+                                if(DB_TYPE == "pgsql"){
+                                    $where .= " AND order_name01||order_name02 ILIKE ?";
+                                }elseif(DB_TYPE == "mysql"){
+                                    $where .= " AND concat(order_name01,order_name02) ILIKE ?";
+                                }
+                                $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
+                                $arrval[] = "%$nonsp_val%";
+                                break;
+                            case 'search_order_kana':
+                                if(DB_TYPE == "pgsql"){
+                                    $where .= " AND order_kana01||order_kana02 ILIKE ?";
+                                }elseif(DB_TYPE == "mysql"){
+                                    $where .= " AND concat(order_kana01,order_kana02) ILIKE ?";
+                                }
+                                $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
+                                $arrval[] = "%$nonsp_val%";
+                                break;
+                            case 'search_order_id1':
+                                $where .= " AND order_id >= ?";
+                                $arrval[] = $val;
+                                break;
+                            case 'search_order_id2':
+                                $where .= " AND order_id <= ?";
+                                $arrval[] = $val;
+                                break;
+                            case 'search_order_sex':
+                                $tmp_where = "";
+                                foreach($val as $element) {
+                                    if($element != "") {
+                                        if($tmp_where == "") {
+                                            $tmp_where .= " AND (order_sex = ?";
+                                        } else {
+                                            $tmp_where .= " OR order_sex = ?";
+                                        }
+                                        $arrval[] = $element;
+                                    }
+                                }
+
+                                if($tmp_where != "") {
+                                    $tmp_where .= ")";
+                                    $where .= " $tmp_where ";
+                                }
+                                break;
+                            case 'search_order_tel':
+                                if(DB_TYPE == "pgsql"){
+                                    $where .= " AND (order_tel01 || order_tel02 || order_tel03 ILIKE ?)";
+                                }elseif(DB_TYPE == "mysql"){
+                                    $where .= " AND concat(order_tel01,order_tel02,order_tel03) ILIKE ?";
+                                }
+                                $nonmark_val = ereg_replace("[()-]+","",$val);
+                                $arrval[] = "%$nonmark_val%";
+                                break;
+                            case 'search_order_email':
+                                $where .= " AND order_email ILIKE ?";
+                                $arrval[] = "%$val%";
+                                break;
+                            case 'search_payment_id':
+                                $tmp_where = "";
+                                foreach($val as $element) {
+                                    if($element != "") {
+                                        if($tmp_where == "") {
+                                            $tmp_where .= " AND (payment_id = ?";
+                                        } else {
+                                            $tmp_where .= " OR payment_id = ?";
+                                        }
+                                        $arrval[] = $element;
+                                    }
+                                }
+
+                                if($tmp_where != "") {
+                                    $tmp_where .= ")";
+                                    $where .= " $tmp_where ";
+                                }
+                                break;
+                            case 'search_total1':
+                                $where .= " AND total >= ?";
+                                $arrval[] = $val;
+                                break;
+                            case 'search_total2':
+                                $where .= " AND total <= ?";
+                                $arrval[] = $val;
+                                break;
+                            case 'search_sorderyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sorderyear'], $_POST['search_sordermonth'], $_POST['search_sorderday']);
+                                $where.= " AND create_date >= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_eorderyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eorderyear'], $_POST['search_eordermonth'], $_POST['search_eorderday'], true);
+                                $where.= " AND create_date <= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_supdateyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_supdateyear'], $_POST['search_supdatemonth'], $_POST['search_supdateday']);
+                                $where.= " AND update_date >= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_eupdateyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eupdateyear'], $_POST['search_eupdatemonth'], $_POST['search_eupdateday'], true);
+                                $where.= " AND update_date <= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_sbirthyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
+                                $where.= " AND order_birth >= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_ebirthyear':
+                                $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
+                                $where.= " AND order_birth <= ?";
+                                $arrval[] = $date;
+                                break;
+                            case 'search_order_status':
+                                $where.= " AND status = ?";
+                                $arrval[] = $val;
+                                break;
+                            default:
+                                if (!isset($arrval)) $arrval = array();
+                                break;
+                        }
                     }
-                    $val = SC_Utils_Ex::sfManualEscape($val);
-
-                    switch ($key) {
-                    case 'search_order_name':
-                        if(DB_TYPE == "pgsql"){
-                            $where .= " AND order_name01||order_name02 ILIKE ?";
-                        }elseif(DB_TYPE == "mysql"){
-                            $where .= " AND concat(order_name01,order_name02) ILIKE ?";
-                        }
-                        $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
-                        $arrval[] = "%$nonsp_val%";
-                        break;
-                    case 'search_order_kana':
-                        if(DB_TYPE == "pgsql"){
-                            $where .= " AND order_kana01||order_kana02 ILIKE ?";
-                        }elseif(DB_TYPE == "mysql"){
-                            $where .= " AND concat(order_kana01,order_kana02) ILIKE ?";
-                        }
-                        $nonsp_val = mb_ereg_replace("[ 　]+","",$val);
-                        $arrval[] = "%$nonsp_val%";
-                        break;
-                    case 'search_order_id1':
-                        $where .= " AND order_id >= ?";
-                        $arrval[] = $val;
-                        break;
-                    case 'search_order_id2':
-                        $where .= " AND order_id <= ?";
-                        $arrval[] = $val;
-                        break;
-                    case 'search_order_sex':
-                        $tmp_where = "";
-                        foreach($val as $element) {
-                            if($element != "") {
-                                if($tmp_where == "") {
-                                    $tmp_where .= " AND (order_sex = ?";
-                                } else {
-                                    $tmp_where .= " OR order_sex = ?";
-                                }
-                                $arrval[] = $element;
+
+                    $order = "update_date DESC";
+
+                    switch($_POST['mode']) {
+                        case 'csv':
+
+                            require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php");
+                            $objCSV = new SC_Helper_CSV_Ex();
+                            // オプションの指定
+                            $option = "ORDER BY $order";
+
+                            // CSV出力タイトル行の作成
+                            $arrCsvOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
+
+                            if (count($arrCsvOutput) <= 0) break;
+
+                            $arrCsvOutputCols = $arrCsvOutput['col'];
+                            $arrCsvOutputTitle = $arrCsvOutput['disp_name'];
+                            $head = SC_Utils_Ex::sfGetCSVList($arrCsvOutputTitle);
+                            $data = $objCSV->lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
+
+                            // CSVを送信する。
+                            SC_Utils_Ex::sfCSVDownload($head.$data);
+                            exit;
+                            break;
+                        case 'delete_all':
+                            // 検索結果をすべて削除
+                            $sqlval['del_flg'] = 1;
+                            $objQuery = new SC_Query();
+                            $objQuery->update("dtb_order", $sqlval, $where, $arrval);
+                            break;
+                        default:
+                            // 読み込む列とテーブルの指定
+                            $col = "*";
+                            $from = "dtb_order";
+
+                            $objQuery = new SC_Query();
+                            // 行数の取得
+                            $linemax = $objQuery->count($from, $where, $arrval);
+                            $this->tpl_linemax = $linemax;               // 何件が該当しました。表示用
+                            // ページ送りの処理
+                            if(is_numeric($_POST['search_page_max'])) {
+                                $page_max = $_POST['search_page_max'];
+                            } else {
+                                $page_max = SEARCH_PMAX;
                             }
-                        }
-
-                        if($tmp_where != "") {
-                            $tmp_where .= ")";
-                            $where .= " $tmp_where ";
-                        }
-                        break;
-                    case 'search_order_tel':
-                        if(DB_TYPE == "pgsql"){
-                            $where .= " AND (order_tel01 || order_tel02 || order_tel03) LIKE ?";
-                        }elseif(DB_TYPE == "mysql"){
-                            $where .= " AND concat(order_tel01,order_tel02,order_tel03) LIKE ?";
-                        }
-                        $nonmark_val = ereg_replace("[()-]+","",$val);
-                        $arrval[] = "%$nonmark_val%";
-                        break;
-                    case 'search_order_email':
-                        $where .= " AND order_email ILIKE ?";
-                        $arrval[] = "%$val%";
-                        break;
-                    case 'search_payment_id':
-                        $tmp_where = "";
-                        foreach($val as $element) {
-                            if($element != "") {
-                                if($tmp_where == "") {
-                                    $tmp_where .= " AND (payment_id = ?";
-                                } else {
-                                    $tmp_where .= " OR payment_id = ?";
-                                }
-                                $arrval[] = $element;
-                            }
-                        }
-
-                        if($tmp_where != "") {
-                            $tmp_where .= ")";
-                            $where .= " $tmp_where ";
-                        }
-                        break;
-                    case 'search_total1':
-                        $where .= " AND total >= ?";
-                        $arrval[] = $val;
-                        break;
-                    case 'search_total2':
-                        $where .= " AND total <= ?";
-                        $arrval[] = $val;
-                        break;
-                    case 'search_sorderyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sorderyear'], $_POST['search_sordermonth'], $_POST['search_sorderday']);
-                        $where.= " AND create_date >= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_eorderyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eorderyear'], $_POST['search_eordermonth'], $_POST['search_eorderday'], true);
-                        $where.= " AND create_date <= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_supdateyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_supdateyear'], $_POST['search_supdatemonth'], $_POST['search_supdateday']);
-                        $where.= " AND update_date >= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_eupdateyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eupdateyear'], $_POST['search_eupdatemonth'], $_POST['search_eupdateday'], true);
-                        $where.= " AND update_date <= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_sbirthyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
-                        $where.= " AND order_birth >= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_ebirthyear':
-                        $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
-                        $where.= " AND order_birth <= ?";
-                        $arrval[] = $date;
-                        break;
-                    case 'search_order_status':
-                        $where.= " AND status = ?";
-                        $arrval[] = $val;
-                        break;
-                    default:
-                        if (!isset($arrval)) $arrval = array();
-                        break;
+
+                            // ページ送りの取得
+                            $objNavi = new SC_PageNavi($this->arrHidden['search_pageno'],
+                            $linemax, $page_max,
+                                               "fnNaviSearchPage", NAVI_PMAX);
+                            $startno = $objNavi->start_row;
+                            $this->arrPagenavi = $objNavi->arrPagenavi;
+
+                            // 取得範囲の指定(開始行番号、行数のセット)
+                            $objQuery->setlimitoffset($page_max, $startno);
+                            // 表示順序
+                            $objQuery->setorder($order);
+                            // 検索結果の取得
+                            $this->arrResults = $objQuery->select($col, $from, $where, $arrval);
                     }
                 }
-
-                $order = "update_date DESC";
-
-                switch($_POST['mode']) {
-                case 'csv':
-
-                    require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php");
-                    $objCSV = new SC_Helper_CSV_Ex();
-                    // オプションの指定
-                    $option = "ORDER BY $order";
-
-                    // CSV出力タイトル行の作成
-                    $arrCsvOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
-
-                    if (count($arrCsvOutput) <= 0) break;
-
-                    $arrCsvOutputCols = $arrCsvOutput['col'];
-                    $arrCsvOutputTitle = $arrCsvOutput['disp_name'];
-                    $head = SC_Utils_Ex::sfGetCSVList($arrCsvOutputTitle);
-                    $data = $objCSV->lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
-
-                    // CSVを送信する。
-                    SC_Utils_Ex::sfCSVDownload($head.$data);
-                    exit;
-                    break;
-                case 'pdf':
-                    $objFpdf = new SC_Fpdf(1, '納品書');
-                    $objFpdf->setData($arrRet);
-                    $objFpdf->createPdf();
-                    break;
-                case 'delete_all':
-                    // 検索結果をすべて削除
-                    $sqlval['del_flg'] = 1;
-                    $objQuery = new SC_Query();
-                    $objQuery->update("dtb_order", $sqlval, $where, $arrval);
-                    break;
-                default:
-                    // 読み込む列とテーブルの指定
-                    $col = "*";
-                    $from = "dtb_order";
-
-                    $objQuery = new SC_Query();
-                    // 行数の取得
-                    $linemax = $objQuery->count($from, $where, $arrval);
-                    $this->tpl_linemax = $linemax;               // 何件が該当しました。表示用
-
-                    // ページ送りの処理
-                    if(is_numeric($_POST['search_page_max'])) {
-                        $page_max = $_POST['search_page_max'];
-                    } else {
-                        $page_max = SEARCH_PMAX;
-                    }
-
-                    // ページ送りの取得
-                    $objNavi = new SC_PageNavi($this->arrHidden['search_pageno'],
-                                               $linemax, $page_max,
-                                               "fnNaviSearchPage", NAVI_PMAX);
-                    $startno = $objNavi->start_row;
-                    $this->arrPagenavi = $objNavi->arrPagenavi;
-
-                    // 取得範囲の指定(開始行番号、行数のセット)
-                    $objQuery->setlimitoffset($page_max, $startno);
-                    // 表示順序
-                    $objQuery->setorder($order);
-                    // 検索結果の取得
-                    $this->arrResults = $objQuery->select($col, $from, $where, $arrval);
-                }
-            }
-            break;
-
-        default:
-            break;
+                break;
+
+                        default:
+                            break;
         }
 
@@ -357,5 +364,5 @@
 
         $objView->assignobj($this);
-        $objView->display(MAIN_FRAME);
+                $objView->display(MAIN_FRAME);
     }
 
@@ -385,22 +392,27 @@
         $this->objFormParam->addParam("購入金額2", "search_total2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("表示件数", "search_page_max", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_sorderyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_sordermonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        // 受注日
+        $this->objFormParam->addParam("開始年", "search_sorderyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("開始月", "search_sordermonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("開始日", "search_sorderday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_eorderyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_eordermonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了年", "search_eorderyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了月", "search_eordermonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("終了日", "search_eorderday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_supdateyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_supdatemonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        // 更新日
+        $this->objFormParam->addParam("開始年", "search_supdateyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("開始月", "search_supdatemonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("開始日", "search_supdateday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_eupdateyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_eupdatemonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了年", "search_eupdateyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了月", "search_eupdatemonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("終了日", "search_eupdateday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_sbirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("開始日", "search_sbirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        // 生年月日
+        $this->objFormParam->addParam("開始年", "search_sbirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("開始月", "search_sbirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("開始日", "search_sbirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_ebirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("終了日", "search_ebirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了年", "search_ebirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("終了月", "search_ebirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("終了日", "search_ebirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("購入商品","search_product_name",STEXT_LEN,"KVa",array("MAX_LENGTH_CHECK"));
+
     }
 
@@ -408,5 +420,5 @@
     function lfCheckError() {
         // 入力データを渡す。
-        $arrRet = $this->objFormParam->getHashArray();
+        $arrRet =  $this->objFormParam->getHashArray();
         $objErr = new SC_CheckError($arrRet);
         $objErr->arrErr = $this->objFormParam->checkError();
@@ -416,15 +428,16 @@
         $objErr->doFunc(array("年齢1", "年齢2", "search_age1", "search_age2"), array("GREATER_CHECK"));
         $objErr->doFunc(array("購入金額1", "購入金額2", "search_total1", "search_total2"), array("GREATER_CHECK"));
-        $objErr->doFunc(array("開始日", "search_sorderyear", "search_sordermonth", "search_sorderday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("終了日", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("開始日", "終了日", "search_sorderyear", "search_sordermonth", "search_sorderday", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_SET_TERM"));
-
-        $objErr->doFunc(array("開始日", "search_supdateyear", "search_supdatemonth", "search_supdateday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("終了日", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("開始日", "終了日", "search_supdateyear", "search_supdatemonth", "search_supdateday", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_SET_TERM"));
-
-        $objErr->doFunc(array("開始日", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("終了日", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_DATE"));
-        $objErr->doFunc(array("開始日", "終了日", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_SET_TERM"));
+        // 受注日
+        $objErr->doFunc(array("開始", "search_sorderyear", "search_sordermonth", "search_sorderday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("終了", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("開始", "終了", "search_sorderyear", "search_sordermonth", "search_sorderday", "search_eorderyear", "search_eordermonth", "search_eorderday"), array("CHECK_SET_TERM"));
+        // 更新日
+        $objErr->doFunc(array("開始", "search_supdateyear", "search_supdatemonth", "search_supdateday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("終了", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("開始", "終了", "search_supdateyear", "search_supdatemonth", "search_supdateday", "search_eupdateyear", "search_eupdatemonth", "search_eupdateday"), array("CHECK_SET_TERM"));
+        // 生年月日
+        $objErr->doFunc(array("開始", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("終了", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_DATE"));
+        $objErr->doFunc(array("開始", "終了", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_SET_TERM"));
 
         return $objErr->arrErr;
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 18609)
@@ -49,5 +49,4 @@
         $this->tpl_subno = "";
         $this->tpl_subtitle = '商品選択';
-
     }
 
@@ -71,5 +70,5 @@
         if ($_GET['no'] != '') {
             $this->tpl_no = strval($_GET['no']);
-        }elseif ($_POST['no'] != '') {
+        } elseif ($_POST['no'] != '') {
             $this->tpl_no = strval($_POST['no']);
         }
@@ -89,4 +88,5 @@
                     continue;
                 }
+
                 switch ($key) {
                 case 'search_name':
@@ -110,31 +110,23 @@
             }
 
-
-            /*
-            $order = "update_date DESC, product_id DESC ";
-
             // 読み込む列とテーブルの指定
-            $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
-            $from = "vw_products_nonclass AS noncls ";
-            */
             $col = "DISTINCT T1.product_id, product_code_min, product_code_max,"
-                 . " price01_min, price01_max, price02_min, price02_max,"
-                 . " stock_min, stock_max, stock_unlimited_min,"
-                 . " stock_unlimited_max, del_flg, status, name, comment1,"
-                 . " comment2, comment3, main_list_comment, main_image,"
-                 . " main_list_image, product_flag, deliv_date_id, sale_limit,"
-                 . " point_rate, sale_unlimited, create_date, deliv_fee, "
-                 . " T4.product_rank, T4.category_rank";
+                . " price01_min, price01_max, price02_min, price02_max,"
+                . " stock_min, stock_max, stock_unlimited_min,"
+                . " stock_unlimited_max, del_flg, status, name, comment1,"
+                . " comment2, comment3, main_list_comment, main_image,"
+                . " main_list_image, product_flag, deliv_date_id, sale_limit,"
+                . " point_rate, create_date, deliv_fee, "
+                . " T4.product_rank, T4.category_rank";
             $from = "vw_products_allclass AS T1"
-                  . " JOIN ("
-                  . " SELECT max(T3.rank) AS category_rank,"
-                  . "        max(T2.rank) AS product_rank,"
-                  . "        T2.product_id"
-                  . "   FROM dtb_product_categories T2"
-                  . "   JOIN dtb_category T3 USING (category_id)"
-                  . " GROUP BY product_id) AS T4 USING (product_id)";
+                . " JOIN ("
+                . " SELECT max(T3.rank) AS category_rank,"
+                . "        max(T2.rank) AS product_rank,"
+                . "        T2.product_id"
+                . "   FROM dtb_product_categories T2"
+                . "   JOIN dtb_category T3 USING (category_id)"
+                . " GROUP BY product_id) AS T4 USING (product_id)";
             $order = "T4.category_rank DESC, T4.product_rank DESC";
 
-            $objQuery = new SC_Query();
             // 行数の取得
             if (empty($arrval)) {
@@ -368,10 +360,10 @@
 
     // 購入制限数の設定
-    function lfGetSaleLimit($product) {
+    function lfGetSaleLimit($arrProduct) {
         //在庫が無限または購入制限値が設定値より大きい場合
-        if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
-            $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
+        if (!SC_Utils_Ex::sfIsInt($arrProduct['sale_limit']) || $arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+            $this->tpl_sale_limit[$arrProduct['product_id']] = SALE_LIMIT_MAX;
         } else {
-            $this->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
+            $this->tpl_sale_limit[$arrProduct['product_id']] = $arrProduct['sale_limit'];
         }
     }
Index: tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php	(revision 18609)
@@ -52,5 +52,5 @@
         $masterData = new SC_DB_MasterData_Ex();
         $this->arrMAILTEMPLATE = $masterData->getMasterData("mtb_mail_template");
-
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * おすすめ管理 のページクラス.
+ * おすすめ商品管理 のページクラス.
  *
  * @package Page
@@ -48,5 +48,5 @@
         $this->tpl_subnavi = 'contents/subnavi.tpl';
         $this->tpl_subno = "recommend";
-        $this->tpl_subtitle = 'オススメ管理';
+        $this->tpl_subtitle = 'おすすめ商品管理';
     }
 
@@ -65,5 +65,4 @@
                                  array(  "column" => "category_id", "convert" => "n" ),
                                  array(  "column" => "rank", "convert" => "n" ),
-                                 array(  "column" => "title", "convert" => "aKV" ),
                                  array(  "column" => "comment", "convert" => "aKV" ),
                                  );
@@ -124,6 +123,9 @@
         }
 
-        // 商品変更時は、選択された商品に一時的に置き換える
-        if ( $_POST['mode'] == 'set_item'){
+        // 商品変更時 or 登録エラー時は、選択された商品に一時的に置き換える
+        if (
+            $_POST['mode'] == 'set_item'
+            || $_POST['mode'] == 'regist' && !empty($this->arrErr[$this->arrForm['rank']])
+        ) {
             $sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND del_flg = 0";
             $result = $conn->getAll($sql, array($_POST['product_id']));
@@ -185,6 +187,5 @@
         $objErr = new SC_CheckError();
 
-        $objErr->doFunc(array("見出しコメント", "title", STEXT_LEN), array("MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("オススメコメント", "comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("コメント", "comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
 
         return $objErr->arrErr;
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_FileManager.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_FileManager.php	(revision 17657)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_FileManager.php	(revision 18609)
@@ -92,5 +92,5 @@
             $arrErr = $this->lfErrorCheck();
 
-            if(!is_array($arrErr)) {
+            if (empty($arrErr)) {
                 // 選択されたファイルがディレクトリなら移動
                 if(is_dir($_POST['select_file'])) {
@@ -112,5 +112,5 @@
             // エラーチェック
             $arrErr = $this->lfErrorCheck();
-            if(!is_array($arrErr)) {
+            if (empty($arrErr)) {
                 if(is_dir($_POST['select_file'])) {
                     // ディレクトリの場合はjavascriptエラー
@@ -127,5 +127,5 @@
             // エラーチェック
             $arrErr = $this->lfErrorCheck();
-            if(!is_array($arrErr)) {
+            if (empty($arrErr)) {
                 $objFileManager->sfDeleteDir($_POST['select_file']);
             }
@@ -135,5 +135,5 @@
             // エラーチェック
             $arrErr = $this->lfCreateErrorCheck();
-            if(!is_array($arrErr)) {
+            if (empty($arrErr)) {
                 $create_dir = ereg_replace("/$", "", $now_dir);
                 // ファイル作成
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CSV.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CSV.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CSV.php	(revision 18609)
@@ -119,13 +119,13 @@
         // 出力項目の取得
         $arrOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 1", array($subno_id)));
-        $arrOutput = SC_Utils_Ex::sfarrCombine($arrOutput['col'], $arrOutput['disp_name']);
+        $arrOutput = SC_Utils_Ex::sfarrCombine($arrOutput['no'], $arrOutput['disp_name']);
 
         // 非出力項目の取得
         $arrChoice = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 2", array($subno_id)));
 
-        if (!isset($arrChoice['col'])) $arrChoice['col'] = array();
+        if (!isset($arrChoice['no'])) $arrChoice['no'] = array();
         if (!isset($arrChoice['disp_name'])) $arrChoice['disp_name'] = array();
 
-        $arrChoice = SC_Utils_Ex::sfarrCombine($arrChoice['col'], $arrChoice['disp_name']);
+        $arrChoice = SC_Utils_Ex::sfarrCombine($arrChoice['no'], $arrChoice['disp_name']);
 
         $this->arrOutput=$arrOutput;
@@ -160,6 +160,6 @@
         if (is_array($arrData)) {
             foreach($arrData as $key => $val){
-                $upd_sql = "UPDATE dtb_csv SET status = 1, rank = ? WHERE csv_id = ? AND col = ? ";
-                $objQuery->query($upd_sql, array($key+1, $csv_id,$val));
+                $upd_sql = "UPDATE dtb_csv SET status = 1, rank = ? WHERE csv_id = ? AND no = ? ";
+                $objQuery->query($upd_sql, array($key+1, $csv_id, $val));
             }
         }
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php	(revision 18609)
@@ -24,5 +24,4 @@
 // {{{ requires
 require_once(CLASS_PATH . "pages/LC_Page.php");
-require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php");
 
 /**
@@ -61,6 +60,4 @@
         $objView = new SC_AdminView();
         $objDbFactory = SC_DB_DBFactory_Ex::getInstance();
-        $objCSV = new SC_Helper_CSV_Ex();
-        $this->arrSubnavi = $objCSV->arrSubnavi;
 
         // 認証可否の判定
@@ -151,5 +148,5 @@
                     $i ++;
                 }
-                $header .= "\r\n";
+                $header .= "\n";
 
                 $data = SC_Utils_Ex::getCSVData($arrCsvOutputData, $arrKey);
@@ -157,5 +154,4 @@
                 SC_Utils_Ex::sfCSVDownload($header.$data);
                 exit;
-                break;
             }else{
                 $this->tpl_onload = "alert('出力データがありません。');";
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CampaignCreateTag.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CampaignCreateTag.php	(revision 17500)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_CampaignCreateTag.php	(revision 18609)
@@ -47,5 +47,4 @@
         $this->tpl_mainno = 'create';
         $this->tpl_subtitle = '商品設定';
-        $this->allowClientCache();
     }
 
@@ -94,9 +93,6 @@
                     break;
                 case 'search_product_id':
-                    if($val != "") {
-                        $where .= " AND product_id = ?";
-                        if(!SC_Utils_Ex::sfIsInt($val)) $val = 0;
-                        $arrval[] = $val;
-                    }
+                    $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
+                    $arrval[] = "$val%";
                     break;
                 default:
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php	(revision 17463)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * おすすめ管理検索 のページクラス.
+ * おすすめ商品管理 商品検索のページクラス.
  *
  * @package Page
@@ -73,5 +73,5 @@
             $this->lfConvertParam();
 
-            $where = "del_flg = 0 AND status = 1";
+            $where = 'del_flg = 0';
 
             /* 入力エラーなし */
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents.php	(revision 18609)
@@ -81,8 +81,6 @@
 
             if ($this->arrErr = $this->lfErrorCheck()) {       // 入力エラーのチェック
-                $arrParams = array("news_url", "news_title", "news_comment", "link_method");
-
-                foreach($arrParams as $key) {
-                    $this->$key = $_POST[$key];
+                foreach($_POST as $key => $val) {
+                    $this->$key = $val;
                 }
                 $this->selected_year = $_POST["year"];
Index: tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php	(revision 18609)
@@ -110,17 +110,4 @@
                 for ( $j=0; $j<count( $_POST['question'][$i]['option'] ); $j++ ){
                     $_POST['question'][$i]['option'][$j] = mb_convert_kana( trim ( $_POST['question'][$i]['option'][$j] ) );
-                }
-            }
-
-            for( $i = 0; $i < count( $_POST["question"] ); $i++ ) {
-                if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) {
-                    $temp_data = array();
-                    // 項目間（テキストボックス）があいていたら詰めていく
-                    for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) {
-                        if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" );
-                    }
-                    $_POST["question"][$i]["option"] = $temp_data;
-                } else {
-                    $_POST["question"][$i]["option"] = NULL;
                 }
             }
@@ -300,5 +287,5 @@
                 if (strlen($_POST["question"][$i]["name"]) == 0) {
                     $objErr->arrErr["question"][$i]["name"] = "タイトルを入力して下さい。";
-                } else if ( strlen($_POST["question"][$i]["name"]) > STEXT_LEN ) {
+                } else if ( mb_strlen($_POST["question"][$i]["name"]) > STEXT_LEN ) {
                     $objErr->arrErr["question"][$i]["name"] = "タイトルは". STEXT_LEN  ."字以内で入力して下さい。";
                 }
@@ -307,19 +294,16 @@
             if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) {
 
+                $temp_data = array();
                 for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) {
-                    // 同じ回答がないかチェック
-                    if (strlen($_POST["question"][$i]["option"][$j]) > 0) {
-                        $checkArray = $_POST["question"][$i]["option"];
-                        // 自身の値をunset
-                        unset($checkArray[$j]);
-                        if (in_array($_POST["question"][$i]["option"][$j], $checkArray)) {
-                            $objErr->arrErr["question"][$i]["option"][$j] = "同じ質問に同じ回答は設定出来ません。";
-                        }
-                    }
-                }
+
+                    // 項目間（テキストボックス）があいていたら詰めていく
+                    if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" );
+
+                }
+
+                $_POST["question"][$i]["option"] = $temp_data;
 
                 if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0
                                                                                  && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "下記の2つ以上の項目に記入してください。";
-
             }
         }
Index: tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin.php	(revision 18609)
@@ -0,0 +1,114 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * プラグイン管理のページクラス
+ *
+ * @package Page
+ * @author Seasoft 塚田将久
+ * @version $Id:$
+ */
+class LC_Page_Admin_Plugin extends LC_Page {
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応
+        parent::init();
+
+        $this->tpl_mainpage = 'plugin/index.tpl';
+        $this->tpl_mainno   = 'plugin';
+        $this->tpl_subno    = 'index';
+        $this->tpl_subtitle = 'プラグイン管理';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView  = new SC_AdminView();
+        $objSess = new SC_Session();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        $this->loadPluginsList();
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /**
+     * プラグインの一覧を読み込む
+     *
+     * @return void
+     */
+    function loadPluginsList() {
+        $plugins = array();
+        $this->arrInstalledPlugin = array();
+        $this->arrInstallablePlugin = array();
+
+        $d = dir(PLUGIN_PATH);
+        while (false !== ($entry = $d->read())) {
+            if ($entry == '.') continue;
+            if ($entry == '..') continue;
+            if (!is_dir($d->path . $entry)) continue;
+
+            $plugins[$entry]['dir_exists'] = true;
+        }
+        $d->close();
+
+        $pluginsXml = SC_Utils_Ex::sfGetPluginsXml();
+        foreach ($pluginsXml->plugin as $plugin) {
+            $plugins[(string)$plugin->path]['installed'] = true;
+        }
+
+        foreach ($plugins as $path=>$plugin) {
+            $plugin['info'] = SC_Utils_Ex::sfGetPluginInfoArray($path);
+            $plugin['path'] = $path;
+            if ($plugin['installed']) {
+                $this->arrInstalledPlugin[] = $plugin;
+            } else {
+                $this->arrInstallablePlugin[] = $plugin;
+            }
+        }
+
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Install.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Install.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Install.php	(revision 18609)
@@ -0,0 +1,135 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * プラグインのインストールのページクラス
+ *
+ * FIXME インストール直後のレンダリング時点では、上部ナビに反映されない
+ * TODO Transaction Token を使用する
+ *
+ * @package Page
+ * @author Seasoft 塚田将久
+ * @version $Id:$
+ */
+class LC_Page_Admin_Plugin_Install extends LC_Page {
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応
+        parent::init();
+
+        $this->tpl_mainpage = 'plugin/install.tpl';
+        $this->tpl_mainno   = 'plugin';
+        $this->tpl_subno    = 'install';
+        $this->tpl_subtitle = 'プラグインのインストール';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView  = new SC_AdminView();
+        $objSess = new SC_Session();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        // パラメータ管理クラス
+        $this->objFormParam = new SC_FormParam();
+        // パラメータ情報の初期化
+        $this->lfInitParam();
+        // POST値の取得
+        $this->objFormParam->setParam($_REQUEST);
+        // 入力情報を渡す
+        $this->arrForm = $this->objFormParam->getHashArray();
+        $this->arrErr = $this->objFormParam->checkError();
+        if (count($this->arrErr) == 0) {
+        // インストール
+            $this->lfInstall($this->arrForm['path']);
+            $this->tpl_result = '完了しました。';
+        } else {
+            SC_Utils_Ex::sfDispException();
+        }
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /**
+     * インストール
+     *
+     * @return void
+     */
+    function lfInstall($path) {
+
+        // アンインストール SQL を実行 (クリーンアップ)
+        SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_PATH . "$path/sql/uninstall.sql");
+
+        // インストール SQL を実行
+        SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_PATH . "$path/sql/install.sql");
+
+        // プラグイン XML に追加
+        $this->lfAddToPluginsXml($path);
+    }
+
+    /**
+     * プラグイン XML に追加
+     *
+     * @return void
+     */
+    function lfAddToPluginsXml($path) {
+        $pluginsXml = SC_Utils_Ex::sfGetPluginsXml();
+        $addPluginXml = $pluginsXml->addChild('plugin');
+        $addPluginXml->addChild('path', $path);
+        $arrPluginInfo = SC_Utils_Ex::sfGetPluginInfoArray($path);
+        $addPluginXml->addChild('name', $arrPluginInfo['name']);
+        SC_Utils_Ex::sfPutPluginsXml($pluginsXml);
+    }
+
+    /**
+     * パラメータ情報の初期化
+     *
+     * @return void
+     */
+    function lfInitParam() {
+        $this->objFormParam->addParam('プラグインのパス', 'path', STEXT_LEN, '', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Uninstall.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Uninstall.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Uninstall.php	(revision 18609)
@@ -0,0 +1,134 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * プラグインのアンインストールのページクラス
+ *
+ * FIXME インストール直後のレンダリング時点では、上部ナビに反映されない
+ * TODO Transaction Token を使用する
+ *
+ * @package Page
+ * @author Seasoft 塚田将久
+ * @version $Id:$
+ */
+class LC_Page_Admin_Plugin_Uninstall extends LC_Page {
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応
+        parent::init();
+
+        $this->tpl_mainpage = 'plugin/uninstall.tpl';
+        $this->tpl_mainno   = 'plugin';
+        $this->tpl_subno    = 'uninstall';
+        $this->tpl_subtitle = 'プラグインのアンインストール';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView  = new SC_AdminView();
+        $objSess = new SC_Session();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        // パラメータ管理クラス
+        $this->objFormParam = new SC_FormParam();
+        // パラメータ情報の初期化
+        $this->lfInitParam();
+        // POST値の取得
+        $this->objFormParam->setParam($_REQUEST);
+        // 入力情報を渡す
+        $this->arrForm = $this->objFormParam->getHashArray();
+        $this->arrErr = $this->objFormParam->checkError();
+        if (count($this->arrErr) == 0) {
+            // アンインストール
+            $this->lfUninstall($this->arrForm['path']);
+            $this->tpl_result = '完了しました。';
+        } else {
+            SC_Utils_Ex::sfDispException();
+        }
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /**
+     * アンインストール
+     *
+     * @return void
+     */
+    function lfUninstall($path) {
+        $objQuery = new SC_Query();
+
+        // アンインストール SQL を実行
+        SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_PATH . "$path/sql/uninstall.sql");
+
+        // プラグイン XML から削除
+        $this->lfRemoveFromPluginsXml($path);
+    }
+
+    /**
+     * プラグイン XML から削除
+     *
+     * @return void
+     */
+    function lfRemoveFromPluginsXml($path) {
+        $pluginsXml = SC_Utils_Ex::sfGetPluginsXml();
+        for ($i = 0; $i <= count($pluginsXml->plugin) - 1; $i++) {
+            if ((string)$pluginsXml->plugin[$i]->path == $path) {
+                unset($pluginsXml->plugin[$i]);
+            }
+        }
+        SC_Utils_Ex::sfPutPluginsXml($pluginsXml);
+    }
+
+    /**
+     * パラメータ情報の初期化
+     *
+     * @return void
+     */
+    function lfInitParam() {
+        $this->objFormParam->addParam('プラグインのパス', 'path', STEXT_LEN, '', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Home.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Home.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Home.php	(revision 18609)
@@ -195,8 +195,8 @@
     }
 
-    // 品切れ商品番号の取得
+    // 品切れ商品IDの取得
     function lfGetSoldOut() {
         $objQuery = new SC_Query();
-        $where = "product_id IN (SELECT product_id FROM dtb_products_class WHERE stock_unlimited IS NULL AND stock <= 0)";
+        $where = "product_id IN (SELECT product_id FROM dtb_products_class WHERE stock_unlimited = 0 AND stock <= 0)";
         $arrRet = $objQuery->select("product_id, name", "dtb_products", $where);
         return $arrRet;
@@ -253,7 +253,14 @@
      */
     function lfGetInfo() {
+
+        // パラメータ「UPDATE_HTTP」が空文字の場合、処理しない。
+        // XXX これと別に on/off を持たせるべきか。
+        if (strlen(UPDATE_HTTP) == 0) return array();
+
         $query = '';
-        // TODO サイト情報の送信可否設定を行う
-        if (true) {
+        // サイト情報の送信可否設定
+        // XXX インストール時に問い合わせて送信可否設定を行うように設定すべきか。
+        // XXX (URLは強制送信すべきではないと思うが)バージョンは強制送信すべきか。
+        if (UPDATE_SEND_SITE_INFO === true) {
             $query = '?site_url=' . SITE_URL . '&eccube_version=' . ECCUBE_VERSION;
         }
Index: tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Login.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Login.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Login.php	(revision 18609)
@@ -63,5 +63,4 @@
         if (!isset($_POST['login_id'])) $_POST['login_id'] = "";
         if (!isset($_POST['password'])) $_POST['password'] = "";
-
 
         // 入力判定
Index: tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Logout.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Logout.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/LC_Page_Admin_Logout.php	(revision 18609)
@@ -55,5 +55,5 @@
         $objSess->logout();
 
-        $this->sendRedirect($this->getLocation(URL_DIR . "admin/index.php"));
+        $this->sendRedirect($this->getLocation(URL_DIR . "admin/" . DIR_INDEX_URL));
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php	(revision 17143)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * 会員規約設定 のページクラス.
+ * 定休日管理のページクラス.
  *
  * @package Page
@@ -47,5 +47,5 @@
         $this->tpl_subnavi = 'basis/subnavi.tpl';
         $this->tpl_subno = 'holiday';
-        $this->tpl_subtitle = '定休日登録';
+        $this->tpl_subtitle = '定休日管理';
         $this->tpl_mainno = 'basis';
     }
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php	(revision 16749)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php	(revision 18609)
@@ -3,5 +3,5 @@
  * This file is part of EC-CUBE
  *
- * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved.
  *
  * http://www.lockon.co.jp/
@@ -28,9 +28,12 @@
 define("ZIP_CSV_LINE_MAX", 8192);
 
-/** 画像の表示個数 */
+/** 画像の表示数量 */
 define("IMAGE_MAX", 680);
 
 /** 郵便番号CSV ファイルのパス */
 define("ZIP_CSV_FILE_PATH", DATA_PATH . "downloads/KEN_ALL.CSV");
+
+/** UTF-8 変換済みの郵便番号CSV ファイルのパス */
+define("ZIP_CSV_UTF8_FILE_PATH", DATA_PATH . "downloads/KEN_ALL_utf-8.CSV");
 
 /**
@@ -43,4 +46,12 @@
 class LC_Page_Admin_Basis_ZipInstall extends LC_Page {
 
+    /** CSVの行数 */
+    var $tpl_line = 0;
+    var $tpl_mode;
+    var $exec;
+    var $tpl_count_mtb_zip;
+    /** フォームパラメータの配列 */
+    var $objFormParam;
+
     // }}}
     // {{{ functions
@@ -53,4 +64,12 @@
     function init() {
         parent::init();
+        $this->tpl_mainpage = 'basis/zip_install.tpl';
+        $this->tpl_subnavi = 'basis/subnavi.tpl';
+        $this->tpl_subno = 'zip_install';
+        $this->tpl_subtitle = '郵便番号DB登録';
+        $this->tpl_mainno = 'basis';
+
+        $this->tpl_mode = $_GET['mode'];
+        $this->exec = (boolean)$_GET['exec'];
     }
 
@@ -62,4 +81,83 @@
     function process() {
         $objQuery = new SC_Query();
+
+        SC_Utils_Ex::sfIsSuccess(new SC_Session);
+
+        // パラメータ管理クラス
+        $this->objFormParam = new SC_FormParam();
+        // パラメータ情報の初期化
+        $this->lfInitParam();
+        // POST値の取得
+        $this->objFormParam->setParam($_GET);
+        $this->arrErr = $this->objFormParam->checkError();
+        $this->arrForm = $this->objFormParam->getHashArray();
+
+        if ($this->exec) {
+            if (!empty($this->arrErr)) {
+                SC_Utils_Ex::sfDispException();
+            }
+            switch ($this->tpl_mode) {
+                // 自動登録
+                case 'auto':
+                    $objQuery->begin();
+                    $objQuery->delete('mtb_zip');
+                    $this->insertMtbZip();
+                    $objQuery->commit();
+                    break;
+                // 手動登録
+                case 'manual':
+                    $this->insertMtbZip($this->arrForm['startRowNum']);
+                    break;
+            }
+            exit;
+        }
+
+        switch ($this->tpl_mode) {
+            // 手動削除
+            case 'delete':
+                $objQuery->delete('mtb_zip');
+
+                // 進捗・完了画面を表示しない
+                $this->tpl_mode = null;
+
+                break;
+        }
+
+        $this->tpl_line = $this->countZipCsv();
+        $this->tpl_count_mtb_zip = $this->countMtbZip();
+
+        $objView = new SC_AdminView();
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /**
+     * パラメータ情報の初期化
+     *
+     * @return void
+     */
+    function lfInitParam() {
+        if ($this->tpl_mode == 'manual') {
+            $this->objFormParam->addParam("開始行", "startRowNum", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        }
+    }
+
+    /**
+     * DB登録
+     *
+     * @return void
+     */
+    function insertMtbZip($start = 1) {
+        $objQuery = new SC_Query();
         $objSess = new SC_Session();
 
@@ -67,100 +165,157 @@
         SC_Utils_Ex::sfIsSuccess($objSess);
 
-        $fp = fopen(ZIP_CSV_FILE_PATH, "r");
-        $img_path = USER_URL . "packages/" . TEMPLATE_NAME . "/img/";
-
+        $img_path = USER_URL . USER_PACKAGE_DIR . DEFAULT_TEMPLATE_NAME . "/img/";
+
+        ?>
+        <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
+        <head>
+            <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHAR_CODE ?>" />
+        </head>
+        <body>
+        <p>進捗状況</p>
+        <div style="background-color: #494E5F;">
+        <?php
         // 一部のIEは256バイト以上受け取ってから表示を開始する。
-        for($i = 0; $i < 256; $i++) {
-            print(" ");
-        }
-        print("\n");
-        $this->myFlush();
-
-        if(!$fp) {
-            SC_Utils_Ex::sfErrorHeader(">> " . ZIP_CSV_FILE_PATH . "の取得に失敗しました。");
-        } else {
-            print("<img src='". $img_path . "install/main_w.jpg'><br>");
-            $this->myFlush();
-
-            // CSVの件数を数える
-            $line = 0;
-            while(!feof($fp)) {
-                fgets($fp, ZIP_CSV_LINE_MAX);
-                $line++;
-            }
-
-            print("<img src='". $img_path ."install/space_w.gif'>");
-            $this->myFlush();
-
-            // ファイルポインタを戻す
-            fseek($fp, 0);
-
-            // 画像を一個表示する件数を求める。
-            $disp_line = intval($line / IMAGE_MAX);
-
-            // 既に書き込まれたデータを数える
-            $end_cnt = $objQuery->count("mtb_zip");
-            $cnt = 1;
-            $img_cnt = 0;
-            while (!feof($fp)) {
-                $arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
-
-                // すでに書き込まれたデータを飛ばす。
-                if($cnt > $end_cnt) {
-                    $sqlval['code'] = $arrCSV[0];
-                    $sqlval['old_zipcode'] = $arrCSV[1];
-                    $sqlval['zipcode'] = $arrCSV[2];
-                    $sqlval['state_kana'] = $arrCSV[3];
-                    $sqlval['city_kana'] = $arrCSV[4];
-                    $sqlval['town_kana'] = $arrCSV[5];
-                    $sqlval['state'] = $arrCSV[6];
-                    $sqlval['city'] = $arrCSV[7];
-                    $sqlval['town'] = $arrCSV[8];
-                    $sqlval['flg1'] = $arrCSV[9];
-                    $sqlval['flg2'] = $arrCSV[10];
-                    $sqlval['flg3'] = $arrCSV[11];
-                    $sqlval['flg4'] = $arrCSV[12];
-                    $sqlval['flg5'] = $arrCSV[13];
-                    $sqlval['flg6'] = $arrCSV[14];
-                    $objQuery->insert("mtb_zip", $sqlval);
+        SC_Utils_Ex::sfFlush(true);
+
+        echo "<img src='" . $img_path . "admin/basis/zip_install_progress.gif'><br />";
+        echo "<img src='" . $img_path . "install/space_w.gif'>";
+        SC_Utils_Ex::sfFlush();
+
+        // 画像を一個表示する件数を求める。
+        $line_all = $this->countZipCsv();
+        $disp_line = intval($line_all / IMAGE_MAX);
+
+        /** 現在行(CSV形式。空行は除く。) */
+        $cntCurrentLine = 0;
+        /** 挿入した行数 */
+        $cntInsert = 0;
+        $img_cnt = 0;
+        $safe_mode = (boolean)ini_get('safe_mode');
+        $max_execution_time
+            = is_numeric(ini_get('max_execution_time'))
+            ? intval(ini_get('max_execution_time'))
+            : intval(get_cfg_var('max_execution_time'))
+        ;
+
+        $fp = $this->openZipCsv();
+        while (!feof($fp)) {
+            $arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+            if (empty($arrCSV)) continue;
+            $cntCurrentLine++;
+            if ($cntCurrentLine >= $start) {
+                $sqlval = array();
+                // $sqlval['code'] = $arrCSV[0];
+                // $sqlval['old_zipcode'] = $arrCSV[1];
+                $sqlval['zipcode'] = $arrCSV[2];
+                // $sqlval['state_kana'] = $arrCSV[3];
+                // $sqlval['city_kana'] = $arrCSV[4];
+                // $sqlval['town_kana'] = $arrCSV[5];
+                $sqlval['state'] = $arrCSV[6];
+                $sqlval['city'] = $arrCSV[7];
+                $sqlval['town'] = $arrCSV[8];
+                // $sqlval['flg1'] = $arrCSV[9];
+                // $sqlval['flg2'] = $arrCSV[10];
+                // $sqlval['flg3'] = $arrCSV[11];
+                // $sqlval['flg4'] = $arrCSV[12];
+                // $sqlval['flg5'] = $arrCSV[13];
+                // $sqlval['flg6'] = $arrCSV[14];
+                $objQuery->insert("mtb_zip", $sqlval);
+                $cntInsert++;
+            }
+
+            // $disp_line件ごとに進捗表示する
+            if($cntCurrentLine % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
+                print("<img src='". $img_path ."install/graph_1_w.gif'>");
+                SC_Utils_Ex::sfFlush();
+                $img_cnt++;
+            }
+            // 暴走スレッドが残留する確率を軽減したタイムアウト防止のロジック
+            // TODO 動作が安定していれば、SC_Utils 辺りに移動したい。
+            if (!$safe_mode) {
+                // タイムアウトをリセット
+                set_time_limit($max_execution_time);
+            }
+        }
+        fclose($fp);
+
+        echo "<img src='". $img_path ."install/space_w.gif'>";
+        echo "</div>\n";
+        
+        ?>
+        <script type="text/javascript" language="javascript">
+            <!--
+                // 完了画面
+                function complete() {
+                    document.open("text/html","replace");
+                    document.clear();
+                    document.write("<p>完了しました。<br />");
+                    document.write("<?php echo $cntInsert ?> 件を追加しました。</p>");
+                    document.write("<p><a href='?' target='_top'>戻る</a></p>");
+                    document.close();
                 }
-
-                $cnt++;
-                // $disp_line件ごとに進捗表示する
-                if($cnt % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
-                    print("<img src='". $img_path ."install/graph_1_w.gif'>");
-                    $this->myFlush();
-                    $img_cnt++;
-                }
-            }
-            fclose($fp);
-
-            print("<img src='". $img_path ."install/space_w.gif'><br>\n");
-            print("<table width='700' height='50' border='0' cellpadding='0' cellspacing='0' bgcolor='#494E5F'>\n");
-            print("<tr>\n");
-            print("<td align='center'><a href='javascript:window.close()'><img src='". $img_path ."install/close.gif' alt='CLOSE' width='85' height='22' border='0' /></a></td>\n");
-            print("</tr>\n");
-            print("</table>\n");
-        }
-    }
-
-    /**
-     * デストラクタ.
-     *
-     * @return void
-     */
-    function destroy() {
-        parent::destroy();
-    }
-
-    /**
-     * 出力バッファをフラッシュし, バッファリングを開始する.
-     *
-     * @return void
-     */
-    function myFlush() {
-        flush();
-        ob_end_flush();
-        ob_start();
+                // コンテンツを削除するため、タイムアウトで呼び出し。
+                setTimeout("complete()", 0);
+            // -->
+        </script>
+        </body>
+        </html>
+        <?php
+    }
+
+    function openZipCsv() {
+        // http://www.post.japanpost.jp/zipcode/dl/kogaki/lzh/ken_all.lzh
+        $this->convertZipCsv();
+        $fp = fopen(ZIP_CSV_UTF8_FILE_PATH, "r");
+        if (!$fp) {
+            SC_Utils_Ex::sfDispException(ZIP_CSV_UTF8_FILE_PATH . ' の読み込みに失敗しました。');
+        }
+        return $fp;
+    }
+
+    function convertZipCsv() {
+        if (file_exists(ZIP_CSV_UTF8_FILE_PATH)) return;
+
+        $fpr = fopen(ZIP_CSV_FILE_PATH, "r");
+        if (!$fpr) {
+            SC_Utils_Ex::sfDispException(ZIP_CSV_FILE_PATH . ' の読み込みに失敗しました。');
+        }
+
+        $fpw = fopen(ZIP_CSV_UTF8_FILE_PATH, "w");
+        if (!$fpw) {
+            SC_Utils_Ex::sfDispException(ZIP_CSV_UTF8_FILE_PATH . ' を開けません。');
+        }
+
+        while (!feof($fpr)) {
+            fwrite($fpw, mb_convert_encoding(fgets($fpr, ZIP_CSV_LINE_MAX), CHAR_CODE, 'sjis-win'));
+        }
+
+        fclose($fpw);
+        fclose($fpr);
+    }
+
+    function countMtbZip() {
+        $objQuery = new SC_Query();
+        return $objQuery->count('mtb_zip');
+    }
+
+    function countZipCsv() {
+        $line = 0;
+        $fp = $this->openZipCsv();
+
+        // CSVの行数を数える
+        while (!feof($fp)) {
+            /*
+            // 正確にカウントする
+            $tmp = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+            */
+            // 推測でカウントする
+            $tmp = fgets($fp, ZIP_CSV_LINE_MAX);
+            if (empty($tmp)) continue;
+            $line++;
+        }
+        fclose($fp);
+
+        return $line;
     }
 }
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment_Input.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment_Input.php	(revision 17726)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment_Input.php	(revision 18609)
@@ -166,6 +166,6 @@
         $this->objFormParam->addParam("支払方法", "payment_method", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("手数料", "charge", PRICE_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("利用条件(〜円以上)", "rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("利用条件(〜円以下)", "upper_rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("利用条件(～円以上)", "rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("利用条件(～円以下)", "upper_rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("配送サービス", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("固定", "fix");
@@ -234,5 +234,5 @@
 
         // 利用条件チェック
-        $objErr->doFunc(array("利用条件(〜円以上)", "利用条件(〜円以下)", "rule", "upper_rule"), array("GREATER_CHECK"));
+        $objErr->doFunc(array("利用条件(～円以上)", "利用条件(～円以下)", "rule", "upper_rule"), array("GREATER_CHECK"));
 
         return $objErr->arrErr;
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 18609)
@@ -174,5 +174,4 @@
         $arrCol = $this->lfGetCol();
         foreach($arrCol as $val) {
-            //$sqlval[$val] = $array[$val];
             //配列の場合は、パイプ区切りの文字列に変換
             if(is_array($array[$val])) {
@@ -252,6 +251,6 @@
         // 住所チェック
         $objErr->doFunc(array("都道府県", "pref"), array("EXIST_CHECK"));
-        $objErr->doFunc(array("住所1", "addr01", MTEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("住所2", "addr02", MTEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("住所1", "addr01", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("住所2", "addr02", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
         // メールチェック
         $objErr->doFunc(array('商品注文受付メールアドレス', "email01", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery_Input.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery_Input.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery_Input.php	(revision 18609)
@@ -56,4 +56,5 @@
         $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
         $this->tpl_subtitle = '配送業者設定';
+        $this->mode = isset($_POST['mode']) ? $_POST['mode'] : '';
     }
 
@@ -76,27 +77,25 @@
         // パラメータ情報の初期化
         $this->lfInitParam();
-        // POST値の取得
+        // POST値をパラメータとする
         $this->objFormParam->setParam($_POST);
-
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
-        switch($_POST['mode']) {
-        case 'edit':
-            // 入力値の変換
-            $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError();
-            if(count($this->arrErr) == 0) {
-                $this->tpl_deliv_id = $this->lfRegistData();
-                $this->tpl_onload = "window.alert('配送業者設定が完了しました。');";
-            }
-            break;
-        case 'pre_edit':
-            if($_POST['deliv_id'] != "") {
-                $this->lfGetDelivData($_POST['deliv_id']);
-                $this->tpl_deliv_id = $_POST['deliv_id'];
-            }
-            break;
-        default:
-            break;
+        // 入力値の変換
+        $this->objFormParam->convParam();
+        $this->arrErr = $this->lfCheckError();
+
+        switch ($this->mode) {
+            case 'edit':
+                if (count($this->arrErr) == 0) {
+                    $this->objFormParam->setValue('deliv_id', $this->lfRegistData());
+                    $this->tpl_onload = "window.alert('配送業者設定が完了しました。');";
+                }
+                break;
+            case 'pre_edit':
+                if (count($this->arrErr) > 0) {
+                    SC_Utils_Ex::sfDispException();
+                }
+                $this->lfGetDelivData($this->objFormParam->getValue('deliv_id'));
+                break;
+            default:
+                break;
         }
 
@@ -116,17 +115,34 @@
 
     /* パラメータ情報の初期化 */
-    function lfInitParam() {
-        $this->objFormParam->addParam("配送業者名", "name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("名称", "service_name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("伝票No.確認URL", "confirm_url", STEXT_LEN, "n", array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
-
-        for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
-            $this->objFormParam->addParam("お届け時間$cnt", "deliv_time$cnt", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
-        }
-
-        if(INPUT_DELIV_FEE) {
-            for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
-                $this->objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-            }
+    function lfInitParam($mode = null) {
+
+        if (is_null($mode)) $mode = $this->mode;
+
+        $this->objFormParam->initParam();
+
+        switch ($mode) {
+            case 'edit':
+                $this->objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                $this->objFormParam->addParam("配送業者名", "name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $this->objFormParam->addParam("名称", "service_name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+                $this->objFormParam->addParam("伝票No.確認URL", "confirm_url", STEXT_LEN, "n", array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
+
+                for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+                    $this->objFormParam->addParam("お届け時間$cnt", "deliv_time$cnt", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+                }
+
+                if(INPUT_DELIV_FEE) {
+                    for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+                        $this->objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+                    }
+                }
+                break;
+
+            case 'pre_edit':
+                $this->objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
+                break;
+
+            default:
+                break;
         }
     }
@@ -163,5 +179,5 @@
                 $sqlval = array();
                 $keyname = "deliv_time".$cnt;
-                $arrval = array($deliv_id, ($cnt * $deliv_id));
+                $arrval = array($deliv_id, $cnt);
                 // 既存データの有無を確認
                 $curData = $objQuery->select("*", $table, $where, $arrval);
@@ -177,5 +193,5 @@
                     else {
                         $sqlval['deliv_id'] = $deliv_id;
-                        $sqlval['time_id'] = ($cnt * $deliv_id);
+                        $sqlval['time_id'] = $cnt;
                         $objQuery->insert($table, $sqlval);
                     }
@@ -221,5 +237,5 @@
                 if($arrRet[$keyname] != "") {
                     $sqlval['deliv_id'] = $deliv_id;
-                    $sqlval['time_id'] = ($cnt * $deliv_id);
+                    $sqlval['time_id'] = $cnt;
                     $sqlval['deliv_time'] = $arrRet[$keyname];
                     // INSERTの実行
@@ -251,4 +267,8 @@
     function lfGetDelivData($deliv_id) {
         $objQuery = new SC_Query();
+
+        // パラメータ情報の初期化
+        $this->lfInitParam('edit');
+
         // 配送業者一覧の取得
         $col = "deliv_id, name, service_name, confirm_url";
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php	(revision 18609)
@@ -75,16 +75,13 @@
             // ランク付きレコードの削除
             $objDb->sfDeleteRankRecord("dtb_deliv", "deliv_id", $_POST['deliv_id']);
-            // 再表示
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         case 'up':
             $objDb->sfRankUp("dtb_deliv", "deliv_id", $_POST['deliv_id']);
-            // 再表示
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         case 'down':
             $objDb->sfRankDown("dtb_deliv", "deliv_id", $_POST['deliv_id']);
-            // 再表示
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         default:
Index: tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php	(revision 18609)
@@ -137,6 +137,6 @@
         $this->objFormParam->addParam("郵便番号2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
         $this->objFormParam->addParam("都道府県", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("住所1", "law_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("住所2", "law_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所1", "law_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "law_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("電話番号1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("電話番号2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
Index: tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 18609)
@@ -152,4 +152,5 @@
                                                 "header" => "更新日")
                                     );
+        $this->httpCacheControl('nocache');
     }
 
@@ -212,15 +213,8 @@
             }
         }
-        //if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
         // 登録メール再送
         if ($_POST['mode'] == "resend_mail") {
-            $arrRet = $objQuery->select("name01, name02, secret_key, email", "dtb_customer","customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
+            $arrRet = $objQuery->select("name01, name02, secret_key, email, email_mobile", "dtb_customer","customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
             if( is_array($arrRet) === true && count($arrRet) > 0 ){
-
-                $CONF = $objDb->sf_getBasisData();
-                $this->CONF = $CONF;
-                $objMailText = new SC_SiteView();
-                $objMailText->assignobj($this);
-                $mailHelper = new SC_Helper_Mail_Ex();
 
                 $this->name01 = $arrRet[0]['name01'];
@@ -228,5 +222,21 @@
                 $this->uniqid = $arrRet[0]['secret_key'];
 
-                $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
+                $CONF = $objDb->sf_getBasisData();
+                $this->CONF = $CONF;
+                /**
+                 * 携帯メールアドレスが登録されていれば携帯サイトから仮会員登録したものと判定する。
+                 * TODO: とりあえずの簡易的な判定なので、将来的には判定ルーチンを修正した方が良い。
+                 */
+                if (!empty($arrRet[0]['email_mobile'])) {
+                    $objMailText = new SC_MobileView(false);
+                    $this->to_name01 = $arrRet[0]['name01'];
+                    $this->to_name02 = $arrRet[0]['name02'];
+                } else {
+                    $objMailText = new SC_SiteView(false);
+                }
+                $objMailText->assignobj($this);
+                $mailHelper = new SC_Helper_Mail_Ex();
+
+                $subject = $mailHelper->sfMakesubject('会員登録のご確認');
                 $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
 
@@ -249,4 +259,5 @@
 
         }
+
         if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "resend_mail") {
 
@@ -461,76 +472,4 @@
         return $objErr->arrErr;
     }
-
-    function lfSetWhere($arrForm){
-        foreach ($arrForm as $key => $val) {
-
-            $val = sfManualEscape($val);
-
-            if($val == "") continue;
-
-            switch ($key) {
-            case 'product_id':
-                $where .= " AND product_id = ?";
-                $arrval[] = $val;
-                break;
-            case 'product_class_id':
-                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
-                $arrval[] = $val;
-                break;
-            case 'name':
-                $where .= " AND name ILIKE ?";
-                $arrval[] = "%$val%";
-                break;
-            case 'category_id':
-                list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
-                if($tmp_where != "") {
-                    $where.= " AND $tmp_where";
-                    $arrval = array_merge($arrval, $tmp_arrval);
-                }
-                break;
-            case 'product_code':
-                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
-                $arrval[] = "%$val%";
-                break;
-            case 'startyear':
-                $date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
-                $where.= " AND update_date >= ?";
-                $arrval[] = $date;
-                break;
-            case 'endyear':
-                $date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
-                $where.= " AND update_date <= ?";
-                $arrval[] = $date;
-                break;
-            case 'product_flag':
-                global $arrSTATUS;
-                $product_flag = sfSearchCheckBoxes($val);
-                if($product_flag != "") {
-                    $where.= " AND product_flag LIKE ?";
-                    $arrval[] = $product_flag;
-                }
-                break;
-            case 'status':
-                $tmp_where = "";
-                foreach ($val as $element){
-                    if ($element != ""){
-                        if ($tmp_where == ""){
-                            $tmp_where.="AND (status LIKE ? ";
-                        }else{
-                            $tmp_where.="OR status LIKE ? ";
-                        }
-                        $arrval[]=$element;
-                    }
-                }
-                if ($tmp_where != ""){
-                    $tmp_where.=")";
-                    $where.= "$tmp_where";
-                }
-                break;
-            default:
-                break;
-            }
-        }
-    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php	(revision 18609)
@@ -294,5 +294,5 @@
             $result = $this->objConn->getAll($sql, array($checkMail, $array["customer_id"]));
             if (count($result) > 0) {
-                $objErr->arrErr["email"] .= "※ すでに登録されているメールアドレスです。";
+                $objErr->arrErr["email"] .= "※ すでに登録されているメールアドレスです。<br />";
             }
         }
@@ -306,5 +306,5 @@
             $result = $this->objConn->getAll($sql, array($checkMail, $array["customer_id"]));
             if (count($result) > 0) {
-                $objErr->arrErr["email_mobile"] .= "※ すでに登録されているメールアドレス(モバイル)です。";
+                $objErr->arrErr["email_mobile"] .= "※ すでに登録されているメールアドレス(モバイル)です。<br />";
             }
         }
Index: tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php	(revision 18609)
@@ -47,4 +47,5 @@
         parent::init();
         $this->tpl_mainpage = 'customer/search_customer.tpl';
+        $this->httpCacheControl('nocache');
     }
 
@@ -76,7 +77,6 @@
             // エラーチェック
             $this->arrErr = $this->lfCheckError();
-            if( is_array($this->arrErr) === true && 0 < count($this->arrErr) ){
-                $is_select = false;
-            }else{
+            $is_select = empty($this->arrErr);
+            if ($is_select) {
                 $where = "del_flg = 0";
 
@@ -111,6 +111,4 @@
                     }
                 }
-
-                $is_select = true;
             }
 
Index: tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail_Sendmail.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail_Sendmail.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail_Sendmail.php	(revision 18609)
@@ -133,5 +133,5 @@
                                                ,$mailBody
                                                ,$objSite->data["email03"]                  //　送信元メールアドレス
-                                               ,$objSite->data["company_name"]             //　送信元名
+                                               ,$objSite->data["shop_name"]                //　送信元名
                                                ,$objSite->data["email03"]                  //　reply_to
                                                ,$objSite->data["email04"]                  //　return_path
Index: tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/admin/mail/LC_Page_Admin_Mail.php	(revision 18609)
@@ -138,4 +138,6 @@
         if (!isset($_POST['buy_product_code'])) $_POST['buy_product_code'] = "";
         if (!isset($_GET['mode'])) $_GET['mode'] = "";
+        
+        $this->httpCacheControl('nocache');
     }
 
@@ -202,5 +204,5 @@
             $this->list_data = $list_data;
             $this->arrCampaignList = $this->lfGetCampaignList($objQuery);
-
+            
             $objView->assignobj($this);
             $objView->display($tpl_path);
@@ -226,5 +228,5 @@
 
             //-- 検索開始
-            if (!is_array($this->arrErr)) {
+            if (empty($this->arrErr)) {
                 $this->list_data['name'] = isset($this->list_data['name'])
                     ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : "";
@@ -273,5 +275,5 @@
             $this->arrErr = $this->lfErrorCheck($this->list_data);
             //-- エラーなし
-            if (!is_array($this->arrErr)) {
+            if (empty($this->arrErr)) {
                 //-- 現在時刻の取得
                 $this->arrNowDate = $this->lfGetNowDate();
@@ -298,5 +300,5 @@
 
             //-- 検索開始
-            if ( ! is_array($this->arrErr)) {
+            if (empty($this->arrErr)) {
                 $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : "";
                 $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成
@@ -348,5 +350,5 @@
 
             //-- 検索開始
-            if ( ! is_array($this->arrErr)) {
+            if (empty($this->arrErr)) {
                 $this->list_data['name'] =
                     isset($this->list_data['name'])
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php	(revision 18609)
@@ -45,8 +45,8 @@
         parent::init();
         $this->tpl_mainpage = 'products/class.tpl';
-		$this->tpl_subnavi = 'products/subnavi.tpl';
-		$this->tpl_subno = 'class';
-		$this->tpl_subtitle = '規格登録';
-		$this->tpl_mainno = 'products';
+        $this->tpl_subnavi = 'products/subnavi.tpl';
+        $this->tpl_subno = 'class';
+        $this->tpl_subtitle = '規格登録';
+        $this->tpl_mainno = 'products';
     }
 
@@ -80,7 +80,7 @@
             if(count($this->arrErr) <= 0) {
                 if($_POST['class_id'] == "") {
-                    $this->lfInsertClass($this->arrForm);	// 新規作成
+                    $this->lfInsertClass($this->arrForm); // 新規作成
                 } else {
-                    $this->lfUpdateClass($this->arrForm);	// 既存編集
+                    $this->lfUpdateClass($this->arrForm); // 既存編集
                 }
                 // 再表示
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * 商品登録(規格)のページクラス.
+ * 商品登録(商品規格)のページクラス.
  *
  * @package Page
@@ -48,5 +48,5 @@
         $this->tpl_mainno = 'products';
         $this->tpl_subno = 'product';
-        $this->tpl_subtitle = '商品登録';
+        $this->tpl_subtitle = '商品登録(商品規格)';
 
         $masterData = new SC_DB_MasterData_Ex();
@@ -84,7 +84,8 @@
 
         switch($_POST['mode']) {
-            // 規格削除要求
+        // 規格削除要求
         case 'delete':
             $objQuery = new SC_Query();
+            $objDb = new SC_Helper_DB_Ex();
 
             $objQuery->setLimitOffset(1);
@@ -113,9 +114,15 @@
                 $objQuery->commit();
             }
-
+            
+	        // 在庫無し商品の非表示対応
+	        if (NOSTOCK_HIDDEN === true) {
+	            // 件数カウントバッチ実行
+	            $objDb->sfCategory_Count($objQuery);
+	        }
+            
             $this->lfProductClassPage();   // 規格登録ページ
             break;
 
-            // 編集要求
+        // 編集要求
         case 'pre_edit':
             $objQuery = new SC_Query();
@@ -129,5 +136,6 @@
             $this->lfProductClassPage();   // 規格登録ページ
             break;
-            // 規格組み合わせ表示
+            
+        // 規格組み合わせ表示
         case 'disp':
             $this->arrForm['select_class_id1'] = $_POST['select_class_id1'];
@@ -141,5 +149,6 @@
             $this->lfProductClassPage();   // 規格登録ページ
             break;
-            // 規格登録要求
+            
+        // 規格登録要求
         case 'edit':
             // 入力値の変換
@@ -158,5 +167,6 @@
             }
             break;
-            // 確認ページからの戻り
+            
+        // 確認ページからの戻り
         case 'confirm_return':
             // フォームパラメータの引き継ぎ
@@ -169,4 +179,5 @@
             $this->lfProductClassPage();   // 規格登録ページ
             break;
+            
         case 'complete':
             // 完了ページ設定
@@ -175,4 +186,5 @@
             $this->lfInsertProductClass($_POST, $_POST['product_id']);
             break;
+            
         default:
             $this->lfProductClassPage();   // 規格登録ページ
@@ -204,5 +216,5 @@
         // 規格分類が登録されていない規格は表示しないようにする。
         $arrClassCatCount = SC_Utils_Ex::sfGetClassCatCount();
-        if( count($arrClass) > 0 ){
+        if (count($arrClass) > 0) {
             foreach($arrClass as $key => $val) {
                 if($arrClassCatCount[$key] > 0) {
@@ -216,5 +228,5 @@
         $this->arrForm['product_name'] = $product_name;
     }
-
+    
     /**
      * デフォルトの表示
@@ -260,5 +272,5 @@
             $sql.= "WHERE class_id1 = ? AND class_id2 = 0 ORDER BY rank1 DESC;";
             $arrRet = $objQuery->getall($sql, array($class_id1));
-
+            
         }
 
@@ -334,4 +346,5 @@
     function lfInsertProductClass($arrList, $product_id) {
         $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
 
         $objQuery->begin();
@@ -354,5 +367,5 @@
                 $sqlval['product_code'] = $arrList["product_code:".$cnt];
                 $sqlval['stock'] = $arrList["stock:".$cnt];
-                $sqlval['stock_unlimited'] = $arrList["stock_unlimited:".$cnt];
+                $sqlval['stock_unlimited'] = ($arrList["stock_unlimited:".$cnt]) ? '1' : '0';
                 $sqlval['price01'] = $arrList['price01:'.$cnt];
                 $sqlval['price02'] = $arrList['price02:'.$cnt];
@@ -365,5 +378,8 @@
             $cnt++;
         }
-
+        
+        // 件数カウントバッチ実行
+        $objDb->sfCategory_Count($objQuery);
+        
         $objQuery->commit();
     }
@@ -414,6 +430,6 @@
             if($array["check:".$no] == 1) {
                 $objErr->doFunc(array("商品コード", "product_code:".$no, STEXT_LEN), array("MAX_LENGTH_CHECK"));
-                $objErr->doFunc(array(NORMAL_PRICE_TITLE, "price01:".$no, PRICE_LEN), array("ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-                $objErr->doFunc(array(SALE_PRICE_TITLE, "price02:".$no, PRICE_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objErr->doFunc(array(NORMAL_PRICE_TITLE, "price01:".$no, PRICE_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+                $objErr->doFunc(array(SALE_PRICE_TITLE, "price02:".$no, PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
 
                 if($array["stock_unlimited:".$no] != '1') {
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ReviewEdit.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ReviewEdit.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ReviewEdit.php	(revision 18609)
@@ -142,5 +142,5 @@
         $objErr->doFunc(array("コメント", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("投稿者名", "reviewer_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("ホームページアドレス", "reviewer_url", URL_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("投稿者URL", "reviewer_url", URL_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("性別", "sex", STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         return $objErr->arrErr;
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php	(revision 18609)
@@ -57,5 +57,5 @@
      */
     function process() {
-        $conn = new SC_DBConn();
+        $objQuery = new SC_Query();
         $objView = new SC_AdminView();
         $objSess = new SC_Session();
@@ -93,4 +93,27 @@
             $this->tpl_pageno = "";
             break;
+            
+        case 'renumber':
+            $sql = <<< __EOS__
+                UPDATE dtb_product_categories
+                SET
+                    rank =
+                        (
+                            SELECT COUNT(*)
+                            FROM dtb_product_categories t_in
+                            WHERE t_in.category_id = dtb_product_categories.category_id
+                                AND (
+                                    t_in.rank < dtb_product_categories.rank
+                                    OR (
+                                        t_in.rank = dtb_product_categories.rank
+                                        AND t_in.product_id < dtb_product_categories.product_id
+                                    )
+                                )
+                        ) + 1
+                WHERE dtb_product_categories.category_id = ?
+__EOS__;
+            $objQuery->query($sql, array($_POST['parent_category_id']));
+            break;
+        
         default:
             break;
@@ -117,8 +140,7 @@
     function lfGetProduct($category_id) {
         $objQuery = new SC_Query();
-        $col = "T2.product_id, name, main_list_image, T2.rank, product_code";
-        $table = "vw_products_nonclass AS noncls "
-            . " LEFT JOIN dtb_product_categories AS T2 USING (product_id)";
-        $where = "del_flg = 0 AND T2.category_id = ?";
+        $col = "product_id, name, main_list_image, product_code_min, product_code_max, status";
+        $table = "vw_products_allclass AS allcls";
+        $where = "del_flg = 0 AND category_id = ?";
 
         // 行数の取得
@@ -130,12 +152,12 @@
         $startno = $objNavi->start_row;
         $this->tpl_start_row = $objNavi->start_row;
-        $this->tpl_strnavi = $objNavi->strnavi;		// Navi表示文字列
-        $this->tpl_pagemax = $objNavi->max_page;		// ページ最大数（「上へ下へ」表示判定用）
-        $this->tpl_disppage = $objNavi->now_page;	// 表示ページ番号（「上へ下へ」表示判定用）
+        $this->tpl_strnavi = $objNavi->strnavi;     // Navi表示文字列
+        $this->tpl_pagemax = $objNavi->max_page;    // ページ最大数（「上へ下へ」表示判定用）
+        $this->tpl_disppage = $objNavi->now_page;   // 表示ページ番号（「上へ下へ」表示判定用）
 
         // 取得範囲の指定(開始行番号、行数のセット)
-        if(DB_TYPE != "mysql") $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+        $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
 
-        $objQuery->setorder("rank DESC");
+        $objQuery->setorder("product_rank DESC, product_id DESC");
 
         $arrRet = $objQuery->select($col, $table, $where, array($category_id));
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 18609)
@@ -173,4 +173,57 @@
             }
             $objQuery->commit();
+            break;
+        case 'moveByDnD':
+            // DnDしたカテゴリと移動先のセットを分解する
+            $keys = explode("-", $_POST['keySet']);
+            if ($keys[0] && $keys[1]) {
+                $objQuery = new SC_Query();
+                $objQuery->begin();
+        
+                // 移動したデータのrank、level、parent_category_idを取得
+                $rank   = $objQuery->get("dtb_category", "rank", "category_id = ?", array($keys[0]));
+                $level  = $objQuery->get("dtb_category", "level", "category_id = ?", array($keys[0]));
+                $parent = $objQuery->get("dtb_category", "parent_category_id", "category_id = ?", array($keys[0]));
+
+                // 同一level内のrank配列を作成
+                $objQuery->setoption("ORDER BY rank DESC");
+                if ($level == 1) {
+                    // 第1階層の時
+                    $arrRet = $objQuery->select("rank", "dtb_category", "level = ?", array($level));
+                } else {
+                    // 第2階層以下の時
+                    $arrRet = $objQuery->select("rank", "dtb_category", "level = ? AND parent_category_id = ?", array($level, $parent));
+                }
+                for ($i = 0; $i < sizeof($arrRet); $i++) {
+                    $rankAry[$i + 1] = $arrRet[$i]['rank'];
+                }
+
+                // 移動したデータのグループ内データ数
+                $my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0]);
+                if ($rankAry[$keys[1]] > $rank) {
+                    // データが今の位置より上がった時
+                    $up_count = $rankAry[$keys[1]] - $rank;
+                    $decAry   = $objQuery->select("category_id", "dtb_category", "level = ? AND rank > ? AND rank <= ?", array($level, $rank, $rankAry[$keys[1]]));
+                    foreach($decAry as $value){
+                        // 上のグループから減算
+                        $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"], $my_count);
+                    }
+                    // 自分のグループに加算
+                    $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0], $up_count);
+                } else if($rankAry[$keys[1]] < $rank) {
+                    // データが今の位置より下がった時
+                    $down_count = 0;
+                    $incAry     = $objQuery->select("category_id", "dtb_category", "level = ? AND rank < ? AND rank >= ?", array($level, $rank, $rankAry[$keys[1]]));
+                    foreach ($incAry as $value) {
+                        // 下のグループに加算
+                        $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"], $my_count);
+                        // 合計減算値
+                        $down_count += $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"]);
+                    }
+                    // 自分のグループから減算
+                    $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0], $down_count);
+                }
+                $objQuery->commit();
+            }
             break;
         case 'tree':
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 18609)
@@ -50,4 +50,5 @@
         $this->tpl_mainno = 'products';
         $this->tpl_subno = 'upload_csv_category';
+        $this->tpl_subtitle = 'カテゴリ登録CSV';
     }
 
@@ -123,4 +124,5 @@
 
                     echo "■　CSV登録進捗状況 <br/><br/>\n";
+
                     while (!feof($fp) && !$err) {
                         $arrCSV = fgetcsv($fp, CSV_LINE_MAX);
@@ -153,5 +155,5 @@
                             $this->objFormParam->convParam();
                             // <br>なしでエラー取得する。
-                            $arrCSVErr = $this->lfCheckError();
+                            $arrCSVErr = $this->lfCheckError($arrCSV);
                         }
 
@@ -166,5 +168,5 @@
 
                         if (!$err) {
-                            $this->lfRegistProduct($objQuery, $rec_count, $line);
+                            $this->lfRegistProduct($objQuery, $line,$arrCSV);
                             $regist++;
                         }
@@ -172,5 +174,5 @@
 
                         if (!$err) echo $line." / ".$rec_count. "行目　（カテゴリID：".$arrParam['category_id']." / カテゴリ名：".$arrParam['category_name'].")\n<br />";
-                        flush();
+                        SC_Utils_Ex::sfFlush();
                     }
                     fclose($fp);
@@ -181,4 +183,5 @@
                         // カテゴリ件数カウント関数の実行
                         $objDb->sfCategory_Count($objQuery);
+                        $objDb->sfMaker_Count($objQuery);
                     } else {
                         $objQuery->rollback();
@@ -190,9 +193,7 @@
                 }
                 echo "<br/><a href=\"javascript:window.close()\">→閉じる</a>";
-                flush();
                 exit;
+            default:
                 break;
-        default:
-            break;
         }
 
@@ -230,41 +231,31 @@
         $this->objFormParam->addParam("親カテゴリID","parent_category_id",INT_LEN,"n",array("MAX_LENGTH_CHECK","NUM_CHECK"));
     }
-
+    
     /**
      * カテゴリ登録を行う.
      *
      * @param SC_Query $objQuery SC_Queryインスタンス
-     * @param string|integer $rec_count 処理総数|integer $line 処理中の行数
-     * @return void
-     */
-    function lfRegistProduct($objQuery, $rec_count, $line = "") {
+     * @param string|integer $line 処理中の行数
+     * @return void
+     */
+    function lfRegistProduct($objQuery, $line = "",$arrCSV) {
+        
         $objDb = new SC_Helper_DB_Ex();
-        $arrRet = $this->objFormParam->getHashArray();
-
-        //カテゴリID
-        if ($arrRet['category_id'] == 0) {
-            $category_id = $objQuery->max("dtb_category", "category_id") + 1;
-            $sqlval['category_id'] = $category_id;
-            $update = false;
-        } else {
-            $sqlval['category_id'] = $arrRet['category_id'];
-            $update = true;
-        }
-
-        // カテゴリ名
-        $sqlval['category_name'] = $arrRet['category_name'];
-        //表示ランク（上から順に表示順を自動割り当て）
-        $sqlval['rank'] = ($rec_count + 1) - $line ;
+        $sqlval['category_id'] = $arrCSV[0];
+        $sqlval['category_name'] = $arrCSV[1];
+        $sqlval['parent_category_id'] = strlen($arrCSV[2]) ? $arrCSV[2] : 0;
+        
+        //存在確認
+        $count = $objQuery->count("dtb_category","category_id = ?",array($sqlval['category_id']));
+        $update = $count != 0;
 
         // 親カテゴリID、レベル
-        if ($arrRet['parent_category_id'] == 0) {
-            $sqlval['parent_category_id'] = "0";
+        if ($sqlval['parent_category_id'] == 0) {
             $sqlval['level'] = 1;
         } else {
-            $sqlval['parent_category_id'] = $arrRet['parent_category_id'];
             $parent_level = $objQuery->get("dtb_category", "level", "category_id = ?", array($sqlval['parent_category_id']));
             $sqlval['level'] = $parent_level + 1;
         }
-
+        
         // その他
         $time = date("Y-m-d H:i:s");
@@ -275,15 +266,29 @@
         $sqlval['update_date'] = $time;
         $sqlval['creator_id'] = $_SESSION['member_id'];
-
+        
         // 更新
         if ($update) {
-            echo "UPDATE　";
+            echo "更新　";
             $where = "category_id = ?";
             $objQuery->update("dtb_category", $sqlval, $where, array($sqlval['category_id']));
-
+        
         // 新規登録
         } else {
-            echo "INSERT　";
+            echo "登録　";
             $sqlval['create_date'] = $time;
+            // ランク
+            if ($sqlval['parent_category_id'] == 0) {
+                // ROOT階層で最大のランクを取得する。
+                $where = "parent_category_id = ?";
+                $sqlval['rank'] = $objQuery->max("dtb_category", "rank", $where, array($sqlval['parent_category_id'])) + 1;
+            } else {
+                // 親のランクを自分のランクとする。
+                $where = "category_id = ?";
+                $sqlval['rank'] = $objQuery->get("dtb_category", "rank", $where, array($sqlval['parent_category_id']));
+                // 追加レコードのランク以上のレコードを一つあげる。
+                $sqlup = "UPDATE dtb_category SET rank = rank + 1 WHERE rank >= ?";
+                $objQuery->exec($sqlup, array($sqlval['rank']));
+                
+            }
             $objQuery->insert("dtb_category", $sqlval);
         }
@@ -295,10 +300,15 @@
      * @return void
      */
-    function lfCheckError() {
-        $arrRet =  $this->objFormParam->getHashArray();
+    function lfCheckError($arrCSV) {
+//        $arrRet =  $this->objFormParam->getHashArray();
+        $arrRet['category_id'] = $arrCSV[0];
+        $arrRet['category_name'] = $arrCSV[1];
+        $arrRet['parent_category_id'] = $arrCSV[2];
+        
         $objQuery = new SC_Query();
+        
         $objErr = new SC_CheckError($arrRet);
         $objErr->arrErr = $this->objFormParam->checkError(false);
-
+        
         // 親カテゴリID設定
         if ($arrRet['parent_category_id'] == 0) {
@@ -307,5 +317,5 @@
             $parent_category_id = $arrRet['parent_category_id'];
         }
-
+        
         // 存在する親カテゴリIDかチェック
         if (count($objErr->arrErr) == 0) {
@@ -317,5 +327,5 @@
             }
         }
-
+        
         // 階層チェック
         if (!isset($objErr->arrErr['category_name']) && !isset($objErr->arrErr['parent_category_id'])) {
@@ -332,7 +342,21 @@
             if (empty($arrCat)) {
                 $arrCat = array(array("category_id" => "", "category_name" => ""));
+            }
             // 編集中のレコード以外に同じ名称が存在する場合
-            }elseif ($arrCat[0]['category_id'] != $arrRet['category_id'] && $arrCat[0]['category_name'] == $arrRet['category_name']) {
-                $objErr->arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。\n";
+            if ($arrCat[0]['category_id'] != $arrRet['category_id'] && $arrCat[0]['category_name'] == $arrRet['category_name']) {
+                echo $arrCat[0]['category_id'];
+                echo "#######--------- line is ".__LINE__." on ".__FILE__."--------########<br/>";
+                        
+                echo $arrRet['category_id'];
+                echo "#######--------- line is ".__LINE__." on ".__FILE__."--------########<br/>";
+                        
+                echo  $arrCat[0]['category_name'] ;
+                echo "#######--------- line is ".__LINE__." on ".__FILE__."--------########<br/>";
+                        echo  $arrRet['category_name'];
+                        echo "#######--------- line is ".__LINE__." on ".__FILE__."--------########<br/>";
+                                
+                
+                $objErr->arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。</br>";
+                
             }
         }
@@ -343,6 +367,6 @@
      * CSVのカウント数を得る.
      *
-     * @param resource $fp fopenを使用して作成したファイルポインタ
-     * @return integer CSV のカウント数
+     * @param string $fp fopenを使用して作成したファイルポインタ
+     * @return mixed CSV のカウント数; $file_name が無効な場合は false
      */
     function lfCSVRecordCount($fp) {
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 18609)
@@ -0,0 +1,197 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * メーカー管理 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id: LC_Page_Admin_Products_Maker.php 16741 2007-11-08 00:43:24Z adachi $
+ */
+class LC_Page_Admin_Products_Maker extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'products/maker.tpl';
+        $this->tpl_subnavi = 'products/subnavi.tpl';
+        $this->tpl_subno = 'maker';
+        $this->tpl_subtitle = 'メーカー管理';
+        $this->tpl_mainno = 'products';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $conn = new SC_DBConn();
+        $objView = new SC_AdminView();
+        $objSess = new SC_Session();
+        $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+
+        // 要求判定
+        switch($_POST['mode']) {
+        // 編集処理
+        case 'edit':
+            // POST値の引き継ぎ
+            $this->arrForm = $_POST;
+            // 入力文字の変換
+            $this->arrForm = $this->lfConvertParam($this->arrForm);
+
+            // エラーチェック
+            $this->arrErr = $this->lfErrorCheck();
+            if(count($this->arrErr) <= 0) {
+                if($_POST['maker_id'] == "") {
+                    $this->lfInsertClass($this->arrForm);	// 新規作成
+                } else {
+                    $this->lfUpdateClass($this->arrForm);	// 既存編集
+                }
+                // 再表示
+                $this->reload();
+            } else {
+                // POSTデータを引き継ぐ
+                $this->tpl_maker_id = $_POST['maker_id'];
+            }
+            break;
+        // 削除
+        case 'delete':
+            $objDb->sfDeleteRankRecord("dtb_maker", "maker_id", $_POST['maker_id'], "", true);
+            // 再表示
+            $this->reload();
+            break;
+        // 編集前処理
+        case 'pre_edit':
+            // 編集項目をDBより取得する。
+            $where = "maker_id = ?";
+            $arrRet = $objQuery->select("name", "dtb_maker", $where, array($_POST['maker_id']));
+            // 入力項目にカテゴリ名を入力する。
+            $this->arrForm['name'] = $arrRet[0]['name'];
+            // POSTデータを引き継ぐ
+            $this->tpl_maker_id = $_POST['maker_id'];
+        break;
+        case 'down':
+            $objDb->sfRankDown("dtb_maker", "maker_id", $_POST['maker_id']);
+            // 再表示
+            $this->reload();
+            break;
+        case 'up':
+            $objDb->sfRankUp("dtb_maker", "maker_id", $_POST['maker_id']);
+            // 再表示
+            $this->reload();
+            break;
+        default:
+            break;
+        }
+
+        // 規格の読込
+        $where = "del_flg <> 1";
+        $objQuery->setorder("rank DESC");
+        $this->arrMaker = $objQuery->select("maker_id, name", "dtb_maker", $where);
+
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* DBへの挿入 */
+    function lfInsertClass($arrData) {
+        $objQuery = new SC_Query();
+        // INSERTする値を作成する。
+        $sqlval['name'] = $arrData['name'];
+        $sqlval['rank'] = $objQuery->max("dtb_maker", "rank") + 1;
+        $sqlval['creator_id'] = $_SESSION['member_id'];
+        $sqlval['update_date'] = "Now()";
+        $sqlval['create_date'] = "Now()";
+        // INSERTの実行
+        $ret = $objQuery->insert("dtb_maker", $sqlval);
+        return $ret;
+    }
+
+    /* DBへの更新 */
+    function lfUpdateClass($arrData) {
+        $objQuery = new SC_Query();
+        // UPDATEする値を作成する。
+        $sqlval['name'] = $arrData['name'];
+        $sqlval['update_date'] = "Now()";
+        $where = "maker_id = ?";
+        // UPDATEの実行
+        $ret = $objQuery->update("dtb_maker", $sqlval, $where, array($_POST['maker_id']));
+        return $ret;
+    }
+
+    /* 取得文字列の変換 */
+    function lfConvertParam($array) {
+        // 文字変換
+        $arrConvList['name'] = "KVa";
+
+        foreach ($arrConvList as $key => $val) {
+            // POSTされてきた値のみ変換する。
+            if(isset($array[$key])) {
+                $array[$key] = mb_convert_kana($array[$key] ,$val);
+            }
+        }
+        return $array;
+    }
+
+    /* 入力エラーチェック */
+    function lfErrorCheck() {
+        $objErr = new SC_CheckError();
+        $objErr->doFunc(array("メーカー名", "name", SMTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        if(!isset($objErr->arrErr['name'])) {
+            $objQuery = new SC_Query();
+            $arrRet = $objQuery->select("maker_id, name", "dtb_maker", "del_flg = 0 AND name = ?", array($_POST['name']));
+            // 編集中のレコード以外に同じ名称が存在する場合
+            if ($arrRet[0]['maker_id'] != $_POST['maker_id'] && $arrRet[0]['name'] == $_POST['name']) {
+                $objErr->arrErr['name'] = "※ 既に同じ内容の登録が存在します。<br>";
+            }
+        }
+        return $objErr->arrErr;
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products.php	(revision 18609)
@@ -56,6 +56,4 @@
         $this->arrSTATUS = $masterData->getMasterData("mtb_status");
         $this->arrPRODUCTSTATUS_COLOR = $masterData->getMasterData("mtb_product_status_color");
-
-        $this->allowClientCache();
     }
 
@@ -138,6 +136,10 @@
             $objQuery->delete("dtb_products_class", "product_id = ?", array($_POST['product_id']));
 
+            // お気に入り商品削除
+            $objQuery->delete("dtb_customer_favorite_products", "product_id = ?", array($_POST['product_id']));
+
             // 件数カウントバッチ実行
             $objDb->sfCategory_Count($objQuery);
+            $objDb->sfMaker_Count($objQuery);
         }
 
@@ -251,5 +253,5 @@
                         // CSVを送信する。正常終了の場合、終了。
                         $objCSV->sfDownloadProductsCsv($where, $arrval, $order) && exit;
-
+                        
                         break;
                     case 'delete_all':
@@ -259,4 +261,8 @@
                         $objQuery->update("dtb_products", $sqlval, $where, $arrval);
                         $objQuery->delete("dtb_customer_favorite_products", $where, $arrval);
+
+                        // 件数カウントバッチ実行
+                        $objDb->sfCategory_Count($objQuery);
+
                         break;
                     default:
@@ -299,9 +305,9 @@
                         // 検索結果の取得
                         $this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
-
+                        
                         // 各商品ごとのカテゴリIDを取得
                         if (count($this->arrProducts) > 0) {
                             foreach ($this->arrProducts as $key => $val) {
-                                $this->arrProducts[$key]["categories"] = $objDb->sfGetCategoryId($val["product_id"]);
+                                $this->arrProducts[$key]["categories"] = $objDb->sfGetCategoryId($val["product_id"], 0, true);
                                 $objDb->g_category_on = false;
                             }
@@ -333,9 +339,9 @@
         global $objPage;
         /*
-         * 文字列の変換
-         * K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
-         * C :  「全角ひら仮名」を「全角かた仮名」に変換
-         * V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
-         * n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         *  文字列の変換
+         *  K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *  n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
          */
         $arrConvList['search_name'] = "KVa";
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * 商品登録 のページクラス.
+ * 商品登録 のページクラス
  *
  * @package Page
@@ -70,4 +70,5 @@
         $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date");
         $this->arrAllowedTag = $masterData->getMasterData("mtb_allowed_tag");
+        $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList("dtb_maker", "maker_id", "name");
         $this->tpl_nonclass = true;
     }
@@ -97,5 +98,5 @@
 
         // 規格の有り無し判定
-        $this->tpl_nonclass = $this->lfCheckNonClass($_POST['product_id']);
+        $this->tpl_nonclass = !$objDb->sfHasProductClass($_POST['product_id']);
 
         // 検索パラメータの引き継ぎ
@@ -112,17 +113,27 @@
 
         switch($_POST['mode']) {
-        // 検索画面からの編集
-        case 'pre_edit':
-        case 'copy' :
-            // 編集時
-            if(SC_Utils_Ex::sfIsInt($_POST['product_id'])){
+            // 検索画面からの編集
+            case 'pre_edit':
+            case 'copy' :
+                if (!SC_Utils_Ex::sfIsInt($_POST['product_id'])) {
+                    SC_Utils_Ex::sfDispException();
+                }
+
                 // DBから商品情報の読込
-                $arrForm = $this->lfGetProduct($_POST['product_id']);
+                $this->arrForm = $this->lfGetProduct($_POST['product_id']);
                 // DBデータから画像ファイル名の読込
-                $this->objUpFile->setDBFileList($arrForm);
+                $this->objUpFile->setDBFileList($this->arrForm);
+
+                // 商品ステータスの変換
+                $arrRet = SC_Utils_Ex::sfSplitCBValue($this->arrForm['product_flag'], "product_flag");
+                $this->arrForm = array_merge($this->arrForm, $arrRet);
+                // DBから関連商品の読み込み
+                $this->lfPreGetRecommendProducts($_POST['product_id']);
+
+                $this->lfProductPage();     // 商品登録ページ
 
                 if($_POST['mode'] == "copy"){
-                    $arrForm["copy_product_id"] = $arrForm["product_id"];
-                    $arrForm["product_id"] = "";
+                    $this->arrForm["copy_product_id"] = $this->arrForm["product_id"];
+                    $this->arrForm["product_id"] = "";
                     // 画像ファイルのコピー
                     $arrKey = $this->objUpFile->keyname;
@@ -133,80 +144,69 @@
                     }
                 }
-                $this->arrForm = $arrForm;
-
-                // 商品ステータスの変換
-                $arrRet = SC_Utils_Ex::sfSplitCBValue($this->arrForm['product_flag'], "product_flag");
-                $this->arrForm = array_merge($this->arrForm, $arrRet);
-                // DBからおすすめ商品の読み込み
-                $this->arrRecommend = $this->lfPreGetRecommendProducts($_POST['product_id']);
-
-                $this->lfProductPage();		// 商品登録ページ
-            }
-            break;
-        // 商品登録・編集
-        case 'edit':
-            if($_POST['product_id'] == "" and SC_Utils_Ex::sfIsInt($_POST['copy_product_id'])){
-                $this->tpl_nonclass = $this->lfCheckNonClass($_POST['copy_product_id']);
-            }
-
-            // 入力値の変換
-            $this->arrForm = $this->lfConvertParam($this->arrForm);
-            // エラーチェック
-            $this->arrErr = $this->lfErrorCheck($this->arrForm);
-            // ファイル存在チェック
-            $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS());
-            // エラーなしの場合
-            if(count($this->arrErr) == 0) {
-                $this->lfProductConfirmPage(); // 確認ページ
-            } else {
-                $this->lfProductPage();		// 商品登録ページ
-            }
-            break;
-        // 確認ページから完了ページへ
-        case 'complete':
-            $this->tpl_mainpage = 'products/complete.tpl';
-
-            $this->arrForm['product_id'] = $this->lfRegistProduct($_POST);		// データ登録
-
-            // 件数カウントバッチ実行
-            $objDb->sfCategory_Count($objQuery);
-            // 一時ファイルを本番ディレクトリに移動する
-            $this->objUpFile->moveTempFile();
-
-            break;
-        // 画像のアップロード
-        case 'upload_image':
-            // ファイル存在チェック
-            $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS($_POST['image_key']));
-            // 画像保存処理
-            $this->arrErr[$_POST['image_key']] = $this->objUpFile->makeTempFile($_POST['image_key'],IMAGE_RENAME);
-
-            // 中、小画像生成
-            $this->lfSetScaleImage();
-
-            $this->lfProductPage(); // 商品登録ページ
-            break;
-        // 画像の削除
-        case 'delete_image':
-            $this->objUpFile->deleteFile($_POST['image_key']);
-            $this->lfProductPage(); // 商品登録ページ
-            break;
-        // 確認ページからの戻り
-        case 'confirm_return':
-            $this->lfProductPage();		// 商品登録ページ
-            break;
-        // おすすめ商品選択
-        case 'recommend_select' :
-            $this->lfProductPage();		// 商品登録ページ
-            break;
-        default:
-            $this->lfProductPage();		// 商品登録ページ
-            break;
-        }
-
-        if($_POST['mode'] != 'pre_edit') {
-            // おすすめ商品の読み込み
-            $this->arrRecommend = $this->lfGetRecommendProducts();
-        }
+                break;
+            // 商品登録・編集
+            case 'edit':
+                if($_POST['product_id'] == "" and SC_Utils_Ex::sfIsInt($_POST['copy_product_id'])){
+                    $this->tpl_nonclass = !$objDb->sfHasProductClass($_POST['copy_product_id']);
+                }
+
+                // 入力値の変換
+                $this->arrForm = $this->lfConvertParam($this->arrForm);
+                // エラーチェック
+                $this->arrErr = $this->lfErrorCheck($this->arrForm);
+                // ファイル存在チェック
+                $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS());
+                // エラーなしの場合
+                if(count($this->arrErr) == 0) {
+                    $this->lfProductConfirmPage(); // 確認ページ
+                } else {
+                    $this->lfProductPage();     // 商品登録ページ
+                }
+                break;
+            // 確認ページから完了ページへ
+            case 'complete':
+                $this->tpl_mainpage = 'products/complete.tpl';
+
+                $this->arrForm['product_id'] = $this->lfRegistProduct($_POST);      // データ登録
+
+                // 件数カウントバッチ実行
+                $objDb->sfCategory_Count($objQuery);
+                $objDb->sfMaker_Count($objQuery);
+                // 一時ファイルを本番ディレクトリに移動する
+                $this->objUpFile->moveTempFile();
+
+                break;
+            // 画像のアップロード
+            case 'upload_image':
+                // ファイル存在チェック
+                $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS($_POST['image_key']));
+                // 画像保存処理
+                $this->arrErr[$_POST['image_key']] = $this->objUpFile->makeTempFile($_POST['image_key'],IMAGE_RENAME);
+
+                // 中、小画像生成
+                $this->lfSetScaleImage();
+
+                $this->lfProductPage(); // 商品登録ページ
+                break;
+            // 画像の削除
+            case 'delete_image':
+                $this->objUpFile->deleteFile($_POST['image_key']);
+                $this->lfProductPage(); // 商品登録ページ
+                break;
+            // 確認ページからの戻り
+            case 'confirm_return':
+                $this->lfProductPage();     // 商品登録ページ
+                break;
+            // 関連商品選択
+            case 'recommend_select' :
+                $this->lfProductPage();     // 商品登録ページ
+                break;
+            default:
+                $this->lfProductPage();     // 商品登録ページ
+                break;
+        }
+
+        // 関連商品の読み込み
+        $this->arrRecommend = $this->lfGetRecommendProducts();
 
         // 基本情報を渡す
@@ -216,16 +216,16 @@
         $sub_find = false;
         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
-            if(	(isset($this->arrForm['sub_title'.$cnt])
-                 && !empty($this->arrForm['sub_title'.$cnt])) ||
-                (isset($this->arrForm['sub_comment'.$cnt])
-                 && !empty($this->arrForm['sub_comment'.$cnt])) ||
-                (isset($this->arrForm['sub_image'.$cnt])
-                 && !empty($this->arrForm['sub_image'.$cnt])) ||
-                (isset($this->arrForm['sub_large_image'.$cnt])
-                 && !empty($this->arrForm['sub_large_image'.$cnt])) ||
-                (isset($this->arrForm['sub_image'.$cnt])
-                 && is_array($this->arrFile['sub_image'.$cnt])) ||
-                (isset($this->arrForm['sub_large_image'.$cnt])
-                 && is_array($this->arrFile['sub_large_image'.$cnt]))) {
+            if( (isset($this->arrForm['sub_title'.$cnt])
+            && !empty($this->arrForm['sub_title'.$cnt])) ||
+            (isset($this->arrForm['sub_comment'.$cnt])
+            && !empty($this->arrForm['sub_comment'.$cnt])) ||
+            (isset($this->arrForm['sub_image'.$cnt])
+            && !empty($this->arrForm['sub_image'.$cnt])) ||
+            (isset($this->arrForm['sub_large_image'.$cnt])
+            && !empty($this->arrForm['sub_large_image'.$cnt])) ||
+            (isset($this->arrForm['sub_image'.$cnt])
+            && is_array($this->arrFile['sub_image'.$cnt])) ||
+            (isset($this->arrForm['sub_large_image'.$cnt])
+            && is_array($this->arrFile['sub_large_image'.$cnt]))) {
                 $sub_find = true;
                 break;
@@ -247,5 +247,9 @@
     }
 
-    /* おすすめ商品の読み込み */
+    /**
+     * 関連商品の名称などを商品マスタから読み込み、一つの配列にまとめて返す
+     *
+     * @return array 関連商品の情報を格納した2次元配列
+     */
     function lfGetRecommendProducts() {
         $objQuery = new SC_Query();
@@ -256,10 +260,10 @@
             $commentkey = "recommend_comment" . $i;
 
-            if (!isset($_POST[$delkey])) $_POST[$delkey] = null;
-
-            if((isset($_POST[$keyname]) && !empty($_POST[$keyname])) && $_POST[$delkey] != 1) {
-                $arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($_POST[$keyname]));
+            if (!isset($this->arrForm[$delkey])) $this->arrForm[$delkey] = null;
+
+            if((isset($this->arrForm[$keyname]) && !empty($this->arrForm[$keyname])) && $this->arrForm[$delkey] != 1) {
+                $arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($this->arrForm[$keyname]));
                 $arrRecommend[$i] = $arrRet[0];
-                $arrRecommend[$i]['product_id'] = $_POST[$keyname];
+                $arrRecommend[$i]['product_id'] = $this->arrForm[$keyname];
                 $arrRecommend[$i]['comment'] = $this->arrForm[$commentkey];
             }
@@ -268,7 +272,7 @@
     }
 
-    /* おすすめ商品の登録 */
+    /* 関連商品の登録 */
     function lfInsertRecommendProducts($objQuery, $arrList, $product_id) {
-        // 一旦オススメ商品をすべて削除する
+        // 一旦関連商品をすべて削除する
         $objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id));
         $sqlval['product_id'] = $product_id;
@@ -294,21 +298,21 @@
     }
 
-    /* 登録済みおすすめ商品の読み込み */
+    /**
+     * 指定商品の関連商品をDBから読み込む
+     *
+     * @param string $product_id 商品ID
+     * @return void
+     */
     function lfPreGetRecommendProducts($product_id) {
-        $arrRecommend = array();
         $objQuery = new SC_Query();
         $objQuery->setorder("rank DESC");
         $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
-        $max = count($arrRet);
         $no = 1;
 
-        for($i = 0; $i < $max; $i++) {
-            $arrProductInfo = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($arrRet[$i]['recommend_product_id']));
-            $arrRecommend[$no] = $arrProductInfo[0];
-            $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
-            $arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
+        foreach ($arrRet as $ret) {
+            $this->arrForm['recommend_id' . $no] = $ret['recommend_product_id'];
+            $this->arrForm['recommend_comment' . $no] = $ret['comment'];
             $no++;
         }
-        return $arrRecommend;
     }
 
@@ -316,4 +320,6 @@
     function lfGetProduct($product_id) {
         $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
+
         $col = "*";
         $table = "vw_products_nonclass AS noncls ";
@@ -326,7 +332,7 @@
                                                       "category_id",
                                                       "product_id = ?",
-                                                      array($product_id));
+        array($product_id));
         //編集時に規格IDが変わってしまうのを防ぐために規格が登録されていなければ規格IDを取得する
-        if( $this->lfCheckNonClass($_POST['product_id']) ){
+        if (!$objDb->sfHasProductClass($_POST['product_id'])) {
             $arrRet[0]['product_class_id'] = SC_Utils::sfGetProductClassId($product_id,"0","0");
         }
@@ -368,11 +374,11 @@
         }
 
-        $this->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "'); fnMoveSelect('category_id_unselect', 'category_id');" . $anchor_hash;
+        $this->tpl_onload = "fnCheckStockLimit('" . DISABLED_RGB . "'); fnMoveSelect('category_id_unselect', 'category_id');" . $anchor_hash;
     }
 
     /* ファイル情報の初期化 */
     function lfInitFile() {
-        $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg', 'gif', 'png'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
-        $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
+        $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg', 'gif', 'png'),IMAGE_SIZE, false, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+        $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
         $this->objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT);
         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
@@ -395,5 +401,5 @@
                             "deliv_fee", "comment1", "comment2", "comment3",
                             "comment4", "comment5", "comment6", "main_list_comment",
-                            "sale_limit", "sale_unlimited", "deliv_date_id", "note");
+                            "sale_limit", "deliv_date_id", "maker_id", "note");
         $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
 
@@ -414,6 +420,6 @@
         $sqlval['main_list_comment'] = $arrList['main_list_comment'];
         $sqlval['sale_limit'] = $arrList['sale_limit'];
-        $sqlval['sale_unlimited'] = $arrList['sale_unlimited'];
         $sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
+        $sqlval['maker_id'] = $arrList['maker_id'];
         $sqlval['note'] = $arrList['note'];
         $sqlval['update_date'] = "Now()";
@@ -429,5 +435,6 @@
         }
 
-        if($arrList['product_id'] == "") {
+        // 新規登録(複製時を含む)
+        if ($arrList['product_id'] == "") {
             // product_id 取得（PostgreSQLの場合）
             if(DB_TYPE=='pgsql'){
@@ -445,19 +452,20 @@
             }
 
+            $arrList['product_id'] = $product_id;
+
             // カテゴリを更新
             $objDb->updateProductCategories($arrList['category_id'], $product_id);
 
-            // コピー商品の場合には規格もコピーする
+            // 複製商品の場合には規格も複製する
             if($_POST["copy_product_id"] != "" and SC_Utils_Ex::sfIsInt($_POST["copy_product_id"])){
 
                 if($this->tpl_nonclass)
                 {
-                    //規格なしの場合、コピーは価格等の入力が発生しているため、その内容で追加登録を行う
-                    $arrList['product_id'] = $product_id;
+                    //規格なしの場合、複製は価格等の入力が発生しているため、その内容で追加登録を行う
                     $this->lfCopyProductClass($arrList, $objQuery);
                 }
                 else
                 {
-                    //規格がある場合のコピーは複製元の内容で追加登録を行う
+                    //規格がある場合の複製は複製元の内容で追加登録を行う
                     // dtb_products_class のカラムを取得
                     $dbFactory = SC_DB_DBFactory_Ex::getInstance();
@@ -465,7 +473,7 @@
                     $arrColList_tmp = array_flip($arrColList);
 
-                    // コピーしない列
-                    unset($arrColList[$arrColList_tmp["product_class_id"]]);    //規格ID
-                    unset($arrColList[$arrColList_tmp["product_id"]]);            //商品ID
+                    // 複製しない列
+                    unset($arrColList[$arrColList_tmp["product_class_id"]]);     //規格ID
+                    unset($arrColList[$arrColList_tmp["product_id"]]);           //商品ID
                     unset($arrColList[$arrColList_tmp["create_date"]]);
 
@@ -475,5 +483,7 @@
                 }
             }
-        } else {
+        }
+        // 更新
+        else {
             $product_id = $arrList['product_id'];
             // 削除要求のあった既存ファイルの削除
@@ -492,8 +502,8 @@
         if( $_POST["copy_product_id"] == "" ){
             // 規格登録
-            SC_Utils_Ex::sfInsertProductClass($objQuery, $arrList, $product_id , $arrList['product_class_id'] );
-        }
-
-        // おすすめ商品登録
+            $this->lfInsertDummyProductClass($arrList);
+        }
+
+        // 関連商品登録
         $this->lfInsertRecommendProducts($objQuery, $arrList, $product_id);
 
@@ -506,9 +516,9 @@
     function lfConvertParam($array) {
         /*
-         *	文字列の変換
-         *	K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
-         *	C :  「全角ひら仮名」を「全角かた仮名」に変換
-         *	V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
-         *	n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         *  文字列の変換
+         *  K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *  n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
          */
 
@@ -517,5 +527,4 @@
         $arrConvList['main_list_comment'] = "KVa";
         $arrConvList['main_comment'] = "KVa";
-        $arrConvList['note'] = "KVa";
         $arrConvList['price01'] = "n";
         $arrConvList['price02'] = "n";
@@ -535,5 +544,5 @@
         }
 
-        // おすすめ商品
+        // 関連商品
         for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
             $arrConvList["recommend_comment$cnt"] = "KVa";
@@ -549,5 +558,6 @@
 
         if (!isset($array['product_flag'])) $array['product_flag'] = "";
-        $array['product_flag'] = SC_Utils_Ex::sfMergeCheckBoxes($array['product_flag'], count($this->arrSTATUS));
+        $max = max(array_keys($this->arrSTATUS));
+        $array['product_flag'] = SC_Utils_Ex::sfMergeCheckBoxes($array['product_flag'], $max);
 
         return $array;
@@ -568,18 +578,17 @@
         $objErr->doFunc(array("メーカーURL", "comment1", URL_LEN), array("SPTAB_CHECK", "URL_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("発送日目安", "deliv_date_id", INT_LEN), array("NUM_CHECK"));
+        $objErr->doFunc(array("メーカー", 'maker_id', INT_LEN), array("NUM_CHECK"));
 
         if($this->tpl_nonclass) {
             $objErr->doFunc(array("商品コード", "product_code", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
-            $objErr->doFunc(array("通常価格", "price01", PRICE_LEN), array("ZERO_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-            $objErr->doFunc(array("商品価格", "price02", PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "ZERO_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-
-            if(!isset($array['stock_unlinited']) && $array['stock_unlimited'] != "1") {
+            $objErr->doFunc(array(NORMAL_PRICE_TITLE, "price01", PRICE_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+            $objErr->doFunc(array(SALE_PRICE_TITLE, "price02", PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+
+            if(!isset($array['stock_unlimited']) && $array['stock_unlimited'] != "1") {
                 $objErr->doFunc(array("在庫数", "stock", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
             }
         }
 
-        if(!isset($array['sale_unlimited']) && $array['sale_unlimited'] != "1") {
-            $objErr->doFunc(array("購入制限", "sale_limit", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-        }
+        $objErr->doFunc(array("購入制限", "sale_limit", AMOUNT_LEN), array("SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
 
         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
@@ -594,7 +603,7 @@
 
             if(isset($_POST["recommend_id$cnt"])
-               && $_POST["recommend_id$cnt"] != ""
-               && $_POST["recommend_delete$cnt"] != 1) {
-                $objErr->doFunc(array("おすすめ商品コメント$cnt", "recommend_comment$cnt", LTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+            && $_POST["recommend_id$cnt"] != ""
+            && $_POST["recommend_delete$cnt"] != 1) {
+                $objErr->doFunc(array("関連商品コメント$cnt", "recommend_comment$cnt", LTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
             }
         }
@@ -614,5 +623,5 @@
             if (!empty($objCheckCategory->arrErr)) {
                 $objErr->arrErr = array_merge($objErr->arrErr,
-                                              $objCheckCategory->arrErr);
+                $objCheckCategory->arrErr);
             }
         }
@@ -640,17 +649,4 @@
         // Form用配列を渡す。
         $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
-    }
-
-    /* 規格あり判定用(規格が登録されていない場合:TRUE) */
-    function lfCheckNonClass($product_id) {
-        if(SC_Utils_Ex::sfIsInt($product_id)) {
-            $objQuery  = new SC_Query();
-            $where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
-            $count = $objQuery->count("dtb_products_class", $where, array($product_id));
-            if($count > 0) {
-                return false;
-            }
-        }
-        return true;
     }
 
@@ -689,16 +685,12 @@
 
         if(file_exists($from_path)){
-            // 元画像サイズを取得
-            list($from_w, $from_h) = getimagesize($from_path);
-
             // 生成先の画像サイズを取得
             $to_w = $this->objUpFile->width[$arrImageKey[$to_key]];
             $to_h = $this->objUpFile->height[$arrImageKey[$to_key]];
 
-
             if($forced) $this->objUpFile->save_file[$arrImageKey[$to_key]] = "";
 
             if(empty($this->objUpFile->temp_file[$arrImageKey[$to_key]]) &&
-               empty($this->objUpFile->save_file[$arrImageKey[$to_key]])) {
+            empty($this->objUpFile->save_file[$arrImageKey[$to_key]])) {
 
                 // リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける
@@ -712,5 +704,7 @@
     }
 
-    // リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける
+    /**
+     * リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける
+     */
     function lfGetAddSuffix($to_key){
         if( IMAGE_RENAME === true ){ return ; }
@@ -734,11 +728,11 @@
 
     /**
-    * dtb_products_classの複製
-    * 複製後、価格や商品コードを更新する
-    *
-    * @param array $arrList
-    * @param array $objQuery
-    * @return bool
-    */
+     * dtb_products_classの複製
+     * 複製後、価格や商品コードを更新する
+     *
+     * @param array $arrList
+     * @param array $objQuery
+     * @return bool
+     */
     function lfCopyProductClass($arrList,$objQuery)
     {
@@ -752,5 +746,5 @@
         $objQuery->begin();
         $err_flag = false;
-        //非編集項目はコピー、編集項目は上書きして登録
+        //非編集項目は複製、編集項目は上書きして登録
         foreach($arrProductClass as $records)
         {
@@ -772,5 +766,5 @@
                 $err_flag = true;
                 continue;
-	        }
+            }
         }
         //トランザクション終了
@@ -785,4 +779,40 @@
         return !$err_flag;
     }
+
+    /**
+     * 規格を設定していない商品を商品規格テーブルに登録
+     *
+     * @param array $arrList
+     * @return void
+     */
+    function lfInsertDummyProductClass($arrList) {
+        $objQuery  = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
+
+        $product_id = $arrList['product_id'];
+        // 規格登録してある商品の場合、処理しない
+        if ($objDb->sfHasProductClass($product_id)) return;
+
+        // 既存規格の削除
+        $where = 'product_id = ?';
+        $objQuery->delete('dtb_products_class', $where, array($product_id));
+
+        // 配列の添字を定義
+        $checkArray = array('product_class_id', 'product_id', 'product_code', 'stock', 'stock_unlimited', 'price01', 'price02');
+        $sqlval = SC_Utils_Ex::sfArrayIntersectKeys($arrList, $checkArray);
+        $sqlval = SC_Utils_Ex::arrayDefineIndexes($sqlval, $checkArray);
+
+        if (strlen($sqlval['product_class_id']) == 0) {
+            unset($sqlval['product_class_id']);
+        }
+        $sqlval['classcategory_id1'] = '0';
+        $sqlval['classcategory_id2'] = '0';
+        $sqlval['stock_unlimited'] = $sqlval['stock_unlimited'] ? '1' : '0';
+        $sqlval['creator_id'] = strlen($_SESSION['member_id']) >= 1 ? $_SESSION['member_id'] : '0';
+        $sqlval['create_date'] = 'now()';
+
+        // INSERTの実行
+        $objQuery->insert('dtb_products_class', $sqlval);
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php	(revision 17202)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php	(revision 18609)
@@ -58,5 +58,4 @@
      */
     function process() {
-        $conn = new SC_DBConn();
         $objView = new SC_AdminView();
         $objSess = new SC_Session();
Index: tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 18609)
@@ -26,9 +26,11 @@
 
 /**
- * CSV アップロード のページクラス.
+ * 商品登録CSVのページクラス.
  *
  * @package Page
  * @author LOCKON CO.,LTD.
  * @version $Id:LC_Page_Admin_Products_UploadCSV.php 15532 2007-08-31 14:39:46Z nanasess $
+ *
+ * FIXME 同一商品IDで商品規格違いを登録できない。(更新は可能)
  */
 class LC_Page_Admin_Products_UploadCSV extends LC_Page {
@@ -54,4 +56,5 @@
         $this->tpl_mainno = 'products';
         $this->tpl_subno = 'upload_csv';
+        $this->tpl_subtitle = '商品登録CSV';
     }
 
@@ -94,9 +97,12 @@
             }
 
+            $objView->assignobj($this);
+            $objView->display('admin_popup_header.tpl');
+
             // 実行時間を制限しない
             set_time_limit(0);
 
             // 出力をバッファリングしない(==日本語自動変換もしない)
-            ob_end_clean();
+            ob_end_flush();
 
             // IEのために256バイト空文字出力
@@ -185,4 +191,5 @@
                     // 商品件数カウント関数の実行
                     $objDb->sfCategory_Count($objQuery);
+                    $objDb->sfMaker_Count($objQuery);
                 } else {
                     $objQuery->rollback();
@@ -195,4 +202,8 @@
             echo "<br/><a href=\"javascript:window.close()\">→閉じる</a>";
             flush();
+
+            $objView->assignobj($this);
+            $objView->display('admin_popup_footer.tpl');
+
             exit;
             break;
@@ -231,4 +242,11 @@
      */
     function lfInitParam() {
+        
+        // 商品ステータスの上限文字数の算出
+        $masterData = new SC_DB_MasterData_Ex();
+        $arrSTATUS = $masterData->getMasterData("mtb_status");
+        $product_flag_maxlen = max(array_keys($arrSTATUS));
+        unset($arrSTATUS);
+        unset($masterData);
 
         $this->objFormParam->addParam("商品ID", "product_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
@@ -240,5 +258,5 @@
         $this->objFormParam->addParam("商品名", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("公開フラグ(1:公開 2:非公開)", "status", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
-        $this->objFormParam->addParam("商品ステータス", "product_flag", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+        $this->objFormParam->addParam("商品ステータス", "product_flag", $product_flag_maxlen, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
         $this->objFormParam->addParam("商品コード", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam(NORMAL_PRICE_TITLE, "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
@@ -251,33 +269,33 @@
         $this->objFormParam->addParam("検索ワード", "comment3", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("備考欄(SHOP専用)", "note", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("一覧-メインコメント", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("一覧-メイン画像", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("メインコメント", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("メイン画像", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("一覧-メインコメント", "main_list_comment", MTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("一覧-メイン画像", "main_list_image", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("メインコメント", "main_comment", LLTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("メイン画像", "main_image", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("メイン拡大画像", "main_large_image", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("カラー比較画像", "file1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("商品詳細ファイル", "file2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブタイトル(1)", "sub_title1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブコメント(1)", "sub_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブタイトル(1)", "sub_title1", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブコメント(1)", "sub_comment1", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ画像(1)", "sub_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ拡大画像(1)", "sub_large_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
 
-        $this->objFormParam->addParam("詳細-サブタイトル(2)", "sub_title2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブコメント(2)", "sub_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブタイトル(2)", "sub_title2", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブコメント(2)", "sub_comment2", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ画像(2)", "sub_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ拡大画像(2)", "sub_large_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
 
-        $this->objFormParam->addParam("詳細-サブタイトル(3)", "sub_title3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブコメント(3)", "sub_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブタイトル(3)", "sub_title3", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブコメント(3)", "sub_comment3", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ画像(3)", "sub_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ拡大画像(3)", "sub_large_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
 
-        $this->objFormParam->addParam("詳細-サブタイトル(4)", "sub_title4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブコメント(4)", "sub_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブタイトル(4)", "sub_title4", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブコメント(4)", "sub_comment4", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ画像(4)", "sub_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ拡大画像(4)", "sub_large_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
 
-        $this->objFormParam->addParam("詳細-サブタイトル(5)", "sub_title5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("詳細-サブコメント(5)", "sub_comment5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブタイトル(5)", "sub_title5", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("詳細-サブコメント(5)", "sub_comment5", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ画像(5)", "sub_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("詳細-サブ拡大画像(5)", "sub_large_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
@@ -286,6 +304,6 @@
 
         for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
-            $this->objFormParam->addParam("おすすめ商品($cnt)", "recommend_product_id$cnt", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
-            $this->objFormParam->addParam("詳細-サブコメント($cnt)", "recommend_comment$cnt", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+            $this->objFormParam->addParam("関連商品($cnt)", "recommend_product_id$cnt", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+            $this->objFormParam->addParam("関連商品コメント($cnt)", "recommend_comment$cnt", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         }
 
@@ -346,44 +364,36 @@
         $sqlval['creator_id'] = $_SESSION['member_id'];
 
-        if($sqlval['sale_limit'] == "") {
-            $sqlval['sale_unlimited'] = '1';
-        } else {
-            $sqlval['sale_unlimited'] = '0';
-        }
-
         if($sqlval['status'] == "") {
             $sqlval['status'] = 2;
         }
 
-        if($arrRet['product_id'] != "" && $arrRet['product_class_id'] != "") {
+        if($sqlval['product_id'] != "") {
 
             // UPDATEの実行
             $where = "product_id = ?";
             $objQuery->update("dtb_products", $sqlval, $where, array($sqlval['product_id']));
+            
+            $product_id = $sqlval['product_id'];
         } else {
-
             // 新規登録
-            // postgresqlとmysqlとで処理を分ける
-            if (DB_TYPE == "pgsql") {
-                $product_id = $objQuery->nextval("dtb_products","product_id");
-            }elseif (DB_TYPE == "mysql") {
-                $product_id = $objQuery->get_auto_increment("dtb_products");
-            }
-            $sqlval['product_id'] = $product_id;
+
+            unset($sqlval['product_id']);
             $sqlval['create_date'] = $time;
-
+            
             // INSERTの実行
             $objQuery->insert("dtb_products", $sqlval);
+            
+            $product_id = $objQuery->currval("dtb_products","product_id");
         }
 
         // カテゴリ登録
         $arrCategory_id = explode("|", $arrRet["category_id"]);
-        $objDb->updateProductCategories($arrCategory_id, $sqlval['product_id']);
+        $objDb->updateProductCategories($arrCategory_id, $product_id);
 
         // 規格登録
-        $this->lfRegistProductClass($objQuery, $arrRet, $sqlval['product_id'], $arrRet['product_class_id']);
-
-        // おすすめ商品登録
-        $objQuery->delete("dtb_recommend_products", "product_id = ?", array($sqlval['product_id']));
+        $this->lfRegistProductClass($objQuery, $arrRet, $product_id, $arrRet['product_class_id']);
+
+        // 関連商品登録
+        $objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id));
         for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
             $keyname = "recommend_product_id" . $i;
@@ -392,5 +402,5 @@
                 $arrProduct = $objQuery->select("product_id", "dtb_products", "product_id = ?", array($arrRet[$keyname]));
                 if($arrProduct[0]['product_id'] != "") {
-                    $arrval['product_id'] = $sqlval['product_id'];
+                    $arrval['product_id'] = $product_id;
                     $arrval['recommend_product_id'] = $arrProduct[0]['product_id'];
                     $arrval['comment'] = $arrRet[$comment_key];
Index: tmp/version-2_5-test/data/class/pages/admin/total/LC_Page_Admin_Total.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/total/LC_Page_Admin_Total.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/admin/total/LC_Page_Admin_Total.php	(revision 18609)
@@ -445,5 +445,4 @@
                 $interval = 1;
             }
-            $objGraphPie = new SC_GraphPie();
             $objGraphLine = new SC_GraphLine();
 
@@ -549,5 +548,5 @@
 
             foreach(array_keys($arrList) as $val) {
-                $arrKey[] = ereg_replace("〜", "-", $val);
+                $arrKey[] = ereg_replace("～", "-", $val);
             }
 
@@ -751,7 +750,7 @@
             if($start_age != "" || $end_age != "") {
                 if($end_age != 999) {
-                    $objPage->arrResults[$i]['age_name'] = $start_age . "〜" . $end_age . "歳";
+                    $objPage->arrResults[$i]['age_name'] = $start_age . "～" . $end_age . "歳";
                 } else {
-                    $objPage->arrResults[$i]['age_name'] = $start_age . "歳〜";
+                    $objPage->arrResults[$i]['age_name'] = $start_age . "歳～";
                 }
             } else {
@@ -1027,5 +1026,5 @@
         case 'products':
             $arrTitleCol = array(
-                                 '商品番号',
+                                 '商品コード',
                                  '商品名',
                                  '購入件数',
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Masterdata.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Masterdata.php	(revision 17345)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Masterdata.php	(revision 18609)
@@ -48,4 +48,5 @@
         $this->tpl_subno = 'masterdata';
         $this->tpl_mainno = 'system';
+        $this->tpl_subtitle = 'マスタデータ管理';
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Input.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 18609)
@@ -51,4 +51,6 @@
         $masterData = new SC_DB_MasterData_Ex();
         $this->arrAUTHORITY = $masterData->getMasterData('mtb_authority');
+        
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php	(revision 17267)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php	(revision 18609)
@@ -59,4 +59,5 @@
         $this->tpl_subno = 'parameter';
         $this->tpl_mainno = 'system';
+        $this->tpl_subtitle = 'パラメータ設定';
     }
 
@@ -134,13 +135,8 @@
 
         // DBのデータを更新
-        $masterData->updateMasterData("mtb_constants", array(), $data);
-
-        // 更新したデータを取得
-        $mtb_constants = $masterData->getDBMasterData("mtb_constants");
+        $masterData->updateMasterData('mtb_constants', array(), $data);
 
         // キャッシュを生成
-        $masterData->clearCache("mtb_constants");
-        $masterData->createCache("mtb_constants", $mtb_constants, true,
-                                 array("id", "remarks", "rank"));
+        $masterData->createCache('mtb_constants', array(), true, array('id', 'remarks'));
     }
 
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php	(revision 17505)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php	(revision 18609)
@@ -51,4 +51,5 @@
 
         $this->bkup_dir = DATA_PATH . "downloads/backup/";
+        $this->bkup_ext = '.tar.gz';
 
     }
@@ -114,5 +115,5 @@
             // 削除
         case 'delete':
-            $del_file = $this->bkup_dir.$_POST['list_name'] . ".tar.gz";
+            $del_file = $this->bkup_dir.$_POST['list_name'] . $this->bkup_ext;
             // ファイルの削除
             if(is_file($del_file)){
@@ -128,6 +129,6 @@
             // ダウンロード
         case 'download' :
-            $filename = $_POST['list_name'] . ".tar.gz";
-            $dl_file = $this->bkup_dir.$_POST['list_name'] . ".tar.gz";
+            $filename = $_POST['list_name'] . $this->bkup_ext;
+            $dl_file = $this->bkup_dir.$_POST['list_name'] . $this->bkup_ext;
 
             // ダウンロード開始
@@ -146,6 +147,6 @@
         $arrBkupList = $this->lfGetBkupData("ORDER BY create_date DESC");
         // テンプレートファイルに渡すデータをセット
-        $this->arrErr = isset($arrErr) ? $arrErr : "";
-        $this->arrForm = isset($arrForm) ? $arrForm : "";
+        $this->arrErr = isset($arrErr) ? $arrErr : array();
+        $this->arrForm = isset($arrForm) ? $arrForm : array();
         $this->arrBkupList = $arrBkupList;
 
@@ -204,11 +205,14 @@
     // バックアップファイル作成
     function lfCreateBkupData($bkup_name){
+        // 実行時間を制限しない
+        set_time_limit(0);
+        
         $objQuery = new SC_Query();
         $csv_data = "";
         $csv_autoinc = "";
-        $err = true;
+        $success = true;
 
         $bkup_dir = $this->bkup_dir;
-        if (!is_dir(dirname($bkup_dir))) $err = mkdir(dirname($bkup_dir));
+        if (!is_dir(dirname($bkup_dir))) $success = mkdir(dirname($bkup_dir));
         $bkup_dir = $bkup_dir . $bkup_name . "/";
 
@@ -262,12 +266,12 @@
         // ディレクトリが存在していなければ作成する
         if (!is_dir(dirname($csv_file))) {
-            $err = mkdir(dirname($csv_file));
-        }
-        if ($err) {
+            $success = mkdir(dirname($csv_file));
+        }
+        if ($success) {
             // dataをCSV出力
             $fp = fopen($csv_file,"w");
             if($fp) {
                 if($csv_data != ""){
-                    $err = fwrite($fp, $csv_data);
+                    $success = fwrite($fp, $csv_data);
                 }
                 fclose($fp);
@@ -278,5 +282,5 @@
             if($fp) {
                 if($csv_autoinc != ""){
-                    $err = fwrite($fp, $csv_autoinc);
+                    $success = fwrite($fp, $csv_autoinc);
                 }
                 fclose($fp);
@@ -285,10 +289,10 @@
 
         // 各種ファイルコピー
-        if ($err) {
+        if ($success) {
             /**
             // 商品画像ファイルをコピー
             // ディレクトリが存在していなければ作成する
             $image_dir = $bkup_dir . "save_image/";
-            if (!is_dir(dirname($image_dir))) $err = mkdir(dirname($image_dir));
+            if (!is_dir(dirname($image_dir))) $success = mkdir(dirname($image_dir));
             $copy_mess = "";
             $copy_mess = SC_Utils_Ex::sfCopyDir("../../upload/save_image/",$image_dir, $copy_mess);
@@ -297,5 +301,5 @@
             // ディレクトリが存在していなければ作成する
             $templates_dir = $bkup_dir . "templates/";
-            if (!is_dir(dirname($templates_dir))) $err = mkdir(dirname($templates_dir));
+            if (!is_dir(dirname($templates_dir))) $success = mkdir(dirname($templates_dir));
             $copy_mess = "";
             $copy_mess = SC_Utils_Ex::sfCopyDir("../../user_data/templates/",$templates_dir, $copy_mess);
@@ -304,5 +308,5 @@
             // ディレクトリが存在していなければ作成する
             $inc_dir = $bkup_dir . "include/";
-            if (!is_dir(dirname($inc_dir))) $err = mkdir(dirname($inc_dir));
+            if (!is_dir(dirname($inc_dir))) $success = mkdir(dirname($inc_dir));
             $copy_mess = "";
             $copy_mess = SC_Utils_Ex::sfCopyDir("../../user_data/include/",$inc_dir, $copy_mess);
@@ -311,10 +315,10 @@
             // ディレクトリが存在していなければ作成する
             $css_dir = $bkup_dir . "css/";
-            if (!is_dir(dirname($css_dir))) $err = mkdir(dirname($css_dir));
+            if (!is_dir(dirname($css_dir))) $success = mkdir(dirname($css_dir));
             $copy_mess = "";
             $copy_mess = SC_Utils_Ex::sfCopyDir("../../user_data/css/",$css_dir, $copy_mess);
             **/
             //圧縮フラグTRUEはgzip圧縮をおこなう
-            $tar = new Archive_Tar($this->bkup_dir . $bkup_name.".tar.gz", TRUE);
+            $tar = new Archive_Tar($this->bkup_dir . $bkup_name . $this->bkup_ext, TRUE);
 
             //bkupフォルダに移動する
@@ -328,5 +332,5 @@
         }
 
-        if (!$err) {
+        if (!$success) {
             $arrErr['bkup_name'] = "バックアップに失敗しました。";
             // バックアップデータの削除
@@ -465,7 +469,10 @@
     // バックアップファイルをリストアする
     function lfRestore($bkup_name){
+        // 実行時間を制限しない
+        set_time_limit(0);
+        
         $objQuery = new SC_Query("", false);
         $csv_data = "";
-        $err = true;
+        $success = true;
 
         $bkup_dir = $this->bkup_dir . $bkup_name . "/";
@@ -475,11 +482,11 @@
 
         //圧縮フラグTRUEはgzip解凍をおこなう
-        $tar = new Archive_Tar($bkup_name . ".tar.gz", TRUE);
+        $tar = new Archive_Tar($bkup_name . $this->bkup_ext, TRUE);
 
         //指定されたフォルダ内に解凍する
-        $err = $tar->extract("./");
+        $success = $tar->extract("./");
 
         // 無事解凍できれば、リストアを行う
-        if ($err) {
+        if ($success) {
 
             // トランザクション開始
@@ -487,15 +494,15 @@
 
             // DBをクリア
-            $err = $this->lfDeleteAll($objQuery);
+            $success = $this->lfDeleteAll($objQuery);
 
             // INSERT実行
-            if ($err) $err = $this->lfExeInsertSQL($objQuery, $bkup_dir . "bkup_data.csv");
+            if ($success) $success = $this->lfExeInsertSQL($objQuery, $bkup_dir . "bkup_data.csv");
 
             // 自動採番の値をセット
-            if ($err) $this->lfSetAutoInc($objQuery, $bkup_dir . "autoinc_data.csv");
+            if ($success) $this->lfSetAutoInc($objQuery, $bkup_dir . "autoinc_data.csv");
 
             // 各種ファイルのコピー
             /**
-            if ($err) {
+            if ($success) {
                 // 画像のコピー
                 $image_dir = $bkup_dir . "save_image/";
@@ -523,5 +530,5 @@
 
             // リストア成功ならコミット失敗ならロールバック
-            if ($err) {
+            if ($success) {
                 $objQuery->commit();
                 $this->restore_msg = "リストア終了しました。";
@@ -656,10 +663,12 @@
         if(!in_array("dtb_bkup", $arrTableList)){
             // 存在していなければ作成
+            // MySQL でプライマリキーを設定するため bkup_name は varchar(50) とした。
             $cre_sql = "
             create table dtb_bkup
             (
-                bkup_name   text,
+                bkup_name   varchar(50),
                 bkup_memo   text,
-                create_date timestamp
+                create_date timestamp,
+                PRIMARY KEY (bkup_name)
             );
         ";
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Log.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Log.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_Log.php	(revision 18609)
@@ -0,0 +1,141 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * ログ のページクラス.
+ *
+ * @package Page
+ * @author Seasoft 塚田将久
+ * @version $Id: LC_Page_Admin_System_System.php 17576 2008-08-28 06:08:09Z Seasoft $
+ */
+class LC_Page_Admin_System_Log extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'system/log.tpl';
+        $this->tpl_subnavi  = 'system/subnavi.tpl';
+        $this->tpl_subno    = 'log';
+        $this->tpl_mainno   = 'system';
+        $this->tpl_subtitle = 'ログ表示';
+        $this->line_max     = 50;
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        SC_Utils_Ex::sfIsSuccess(new SC_Session);
+        $objView = new SC_AdminView();
+        
+        $this->lfInitParam();
+        
+        if (SC_Utils::sfIsInt($tmp = $this->objForm->getValue('line'))) {
+            $this->line_max = $tmp;
+        }
+        
+        $this->tpl_ec_log = $this->getEccubeLog();
+        
+        $objView->assignobj($this);
+        $objView->display(MAIN_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+    
+    /**
+     * パラメータの初期化
+     *
+     * @return array
+     */
+    function lfInitParam() {
+        $this->objForm = new SC_FormParam;
+        $this->objForm->addParam('line_max', 'line_max', INT_LEN, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK', 'EXIST_CHECK'));
+        $this->objForm->setParam($_POST);
+    }
+
+    /**
+     * EC-CUBE ログを取得する
+     *
+     * @return array
+     */
+    function getEccubeLog() {
+        
+        $index = 0;
+        $arrLogs = array();
+        for ($gen = 0 ; $gen <= MAX_LOG_QUANTITY; $gen++) {
+            $path = LOG_PATH;
+            if ($gen != 0) {
+                $path .= ".$gen";
+            }
+            
+            // ファイルが存在しない場合、前世代のログへ
+            if (!file_exists($path)) continue;
+            
+            $arrLogTmp = array_reverse(file($path));
+            
+            $arrBodyReverse = array();
+            foreach ($arrLogTmp as $line) {
+                $line = chop($line);
+                if (preg_match('/^(\d+\/\d+\/\d+ \d+:\d+:\d+) \[([^\]]+)\] (.*)$/', $line, $arrMatch)) {
+                    $arrLogLine = array();
+                    // 日時
+                    $arrLogLine['date'] = $arrMatch[1];
+                    // パス
+                    $arrLogLine['path'] = $arrMatch[2];
+                    // 内容
+                    $arrBodyReverse[] = $arrMatch[3];
+                    $arrLogLine['body'] = implode("\n", array_reverse($arrBodyReverse));
+                    $arrBodyReverse = array();
+                    
+                    $arrLogs[] = $arrLogLine;
+                    
+                    // 上限に達した場合、処理を抜ける
+                    if (count($arrLogs) >= $this->line_max) break 2;
+                } else {
+                    // 内容
+                    $arrBodyReverse[] = $line;
+                }
+            }
+        }
+        return $arrLogs;
+    }
+}
Index: tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_System.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_System.php	(revision 17345)
+++ tmp/version-2_5-test/data/class/pages/admin/system/LC_Page_Admin_System_System.php	(revision 18609)
@@ -48,4 +48,5 @@
         $this->tpl_subno    = 'system';
         $this->tpl_mainno   = 'system';
+        $this->tpl_subtitle = 'システム情報';
     }
 
Index: tmp/version-2_5-test/data/class/pages/cart/LC_Page_Cart.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/cart/LC_Page_Cart.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/cart/LC_Page_Cart.php	(revision 18609)
@@ -60,5 +60,5 @@
         $this->tpl_mainpage = 'cart/index.tpl';
         $this->tpl_column_num = 1;
-        $this->tpl_title = "カゴの中を見る";
+        $this->tpl_title = "現在のカゴの中";
     }
 
@@ -77,7 +77,5 @@
         $objSiteInfo = $objView->objSiteInfo;
         $objCustomer = new SC_Customer();
-        $db = new SC_Helper_DB_Ex();
-        // 基本情報の取得
-        $arrInfo = $objSiteInfo->data;
+        $objDb = new SC_Helper_DB_Ex();
 
         // 商品購入中にカート内容が変更された。
@@ -88,19 +86,16 @@
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
 
-        /*
-         * FIXME reload() を使った方が良いが無限ループしてしまう...
-         */
         switch($_POST['mode']) {
         case 'up':
             $objCartSess->upQuantity($_POST['cart_no']);
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         case 'down':
             $objCartSess->downQuantity($_POST['cart_no']);
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         case 'delete':
             $objCartSess->delProduct($_POST['cart_no']);
-            SC_Utils_Ex::sfReload();
+            $this->reload(); // PRG pattern
             break;
         case 'confirm':
@@ -111,5 +106,5 @@
             for ($i = 0; $i < $max; $i++) {
                 // 商品規格情報の取得
-                $this->arrData = $db->sfGetProductsClass($arrRet[$i]['id']);
+                $this->arrData = $objDb->sfGetProductsClass($arrRet[$i]['id']);
                 // DBに存在する商品
                 if($this->arrData != "") {
@@ -144,8 +139,9 @@
 
         // カート集計処理
-        $db->sfTotalCart($this, $objCartSess, $arrInfo);
-        $this->arrData = $db->sfTotalConfirm($this->arrData, $this, $objCartSess, $arrInfo, $objCustomer);
-
-        $this->arrInfo = $arrInfo;
+        $objDb->sfTotalCart($this, $objCartSess);
+        $this->arrData = $objDb->sfTotalConfirm($this->arrData, $this, $objCartSess, null, $objCustomer);
+
+        // 基本情報の取得
+        $this->arrInfo = $objSiteInfo->data;
 
         // ログイン判定
@@ -184,6 +180,5 @@
 
         // 買い物を続ける場合
-        if (!isset($_REQUEST['continue'])) $_REQUEST['continue'] = "";
-        if($_REQUEST['continue']) {
+        if ($_REQUEST['mode'] == 'continue') {
             $this->sendRedirect($this->getLocation(MOBILE_URL_SITE_TOP), true);
             exit;
@@ -197,13 +192,8 @@
         $objDb = new SC_Helper_DB_Ex();
 
-        // 基本情報の取得
-        $arrInfo = $objSiteInfo->data;
-
         // 商品購入中にカート内容が変更された。
         if($objCartSess->getCancelPurchase()) {
             $this->tpl_message = "商品購入中にｶｰﾄ内容が変更されましたので､お手数ですが購入手続きをやり直して下さい｡";
         }
-
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
 
         switch($_POST['mode']) {
@@ -271,8 +261,9 @@
             $arrData = array();
         }
-        $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
-        $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer);
-
-        $this->arrInfo = $arrInfo;
+        $objDb->sfTotalCart($this, $objCartSess);
+        $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
+
+        // 基本情報の取得
+        $this->arrInfo = $objSiteInfo->data;
 
         // ログイン判定
Index: tmp/version-2_5-test/data/class/pages/error/LC_Page_Error_SystemError.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/error/LC_Page_Error_SystemError.php	(revision 16931)
+++ tmp/version-2_5-test/data/class/pages/error/LC_Page_Error_SystemError.php	(revision 18609)
@@ -26,6 +26,6 @@
 
 /**
- * エラー表示のページクラス
- * SC_DbConnでエラーが発生した場合の表示ページ
+ * システムエラー表示のページクラス
+ * システムエラーや例外が発生した場合の表示ページ
  *
  * @package Page
@@ -34,4 +34,13 @@
  */
 class LC_Page_Error_SystemError extends LC_Page_Error {
+    
+    /** PEAR_Error */
+    var $pearResult;
+    
+    /** PEAR_Error がセットされていない場合用のバックトレーススタック */
+    var $backtrace;
+
+    /** デバッグ用のメッセージ配列 */
+    var $arrDebugMsg = array();
 
     // }}}
@@ -47,5 +56,5 @@
 
         $this->tpl_title = 'システムエラー';
-        $this->adminPage = $this->isAdminPage();
+        $this->adminPage = SC_Utils_Ex::sfIsAdminFunction();
 
         if ($this->adminPage) {
@@ -78,4 +87,14 @@
         $objView->assignobj($this);
         $objView->display($this->flame);
+        
+        if (DEBUG_MODE) {
+            echo '<div class="debug">';
+            echo '<div>▼▼▼ デバッグ情報ここから ▼▼▼</div>';
+            echo '<pre>';
+            print_r(htmlspecialchars($this->sfGetErrMsg(), ENT_QUOTES, CHAR_CODE));
+            echo '</pre>';
+            echo '<div>▲▲▲ デバッグ情報ここまで ▲▲▲</div>';
+            echo '</div>';
+        }
     }
 
@@ -90,10 +109,60 @@
 
     /**
-     * 管理ページかどうかを判定する.
+     * エラーメッセージを生成する
      *
-     * @return boolean
+     * @return string
      */
-    function isAdminPage() {
-        return preg_match('|/admin/|', $_SERVER['PHP_SELF']);
+    function sfGetErrMsg() {
+        $errmsg = '';
+        $errmsg .= $this->lfGetErrMsgHead();
+        $errmsg .= "\n";
+        
+        // デバッグ用のメッセージが指定されている場合
+        if (!empty($this->arrDebugMsg)) {
+            $errmsg .= implode("\n\n", $this->arrDebugMsg) . "\n";
+            $errmsg .= "\n";
+        }
+        
+        // PEAR エラーを伴う場合
+        if (!is_null($this->pearResult)) {
+            $errmsg .= $this->pearResult->message . "\n\n";
+            $errmsg .= $this->pearResult->userinfo . "\n\n";
+            $errmsg .= SC_Utils_Ex::sfBacktraceToString($this->pearResult->backtrace);
+        }
+        // (上に該当せず)バックトレーススタックが指定されている場合
+        else if (is_array($this->backtrace)) {
+            $errmsg .= SC_Utils_Ex::sfBacktraceToString($this->backtrace);
+        }
+        // (上に該当せず)バックトレースを生成できる環境(一般的には PHP 4 >= 4.3.0, PHP 5)の場合
+        else if (function_exists("debug_backtrace")) {
+            $errmsg .= SC_Utils_Ex::sfBacktraceToString(array_slice(debug_backtrace(), 2));
+        }
+        
+        return $errmsg;
+    }
+    
+    /**
+     * エラーメッセージの冒頭部を生成する
+     *
+     * @return string
+     */
+    function lfGetErrMsgHead() {
+        $errmsg = '';
+        $errmsg .= SC_Utils_Ex::sfGetUrl() . "\n";
+        $errmsg .= "\n";
+        $errmsg .= "SERVER_ADDR: " . $_SERVER['SERVER_ADDR'] . "\n";
+        $errmsg .= "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "\n";
+        $errmsg .= "USER_AGENT: " . $_SERVER['HTTP_USER_AGENT'] . "\n";
+        
+        return $errmsg;
+    }
+
+    /**
+     * デバッグ用のメッセージを追加
+     *
+     * @return void
+     */
+    function addDebugMsg($debugMsg) {
+        $this->arrDebugMsg[] = rtrim($debugMsg, "\n");
     }
 }
Index: tmp/version-2_5-test/data/class/pages/error/LC_Page_Error.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/error/LC_Page_Error.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/error/LC_Page_Error.php	(revision 18609)
@@ -87,4 +87,5 @@
             case PRODUCT_NOT_FOUND:
                 $this->tpl_error="ご指定のページはございません。";
+                $this->sendHttpStatus(404);
                 break;
             case PAGE_ERROR:
@@ -102,4 +103,5 @@
             case CATEGORY_NOT_FOUND:
                 $this->tpl_error="ご指定のカテゴリは存在しません。";
+                $this->sendHttpStatus(404);
                 break;
             case SITE_LOGIN_ERROR:
Index: tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Confirm.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Confirm.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Confirm.php	(revision 18609)
@@ -116,5 +116,5 @@
             } elseif ($_REQUEST['mode'] == 'cancel') {
                 $uniqId = $this->lfGetSecretKey($_POST["email"], $objConn);
-                $subject = $helperMail->sfMakesubject($objQuery, $objMailText, $this,'メルマガ解除のご確認');
+                $subject = $helperMail->sfMakesubject('メルマガ解除のご確認');
             }
             $objDb = new SC_Helper_DB_Ex();
@@ -147,5 +147,5 @@
             exit;
         } else {
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
 
@@ -173,5 +173,5 @@
                         array('メールアドレス', $dataName, MTEXT_LEN) ,
                         array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK",
-                              "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
+                              "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "MOBILE_EMAIL_CHECK"));
 
         // 入力エラーがなければ
@@ -252,5 +252,5 @@
 
         // NULLも購読とみなす
-        if (count($mailResult) == 0 or ($mailResult[1] != null and $mailResult[1] != 2 )) {
+        if (count($mailResult) == 0 or ($mailResult['mailmaga_flg'] != null and $mailResult['mailmaga_flg'] != 2 )) {
             return false;
         } else {
Index: tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Regist.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Regist.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Regist.php	(revision 18609)
@@ -77,5 +77,5 @@
 
         if (empty($key) or !lfExistKey($key, $objQuery))  {
-            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         } else {
             $this->lfChangeData($key, $objQuery);
Index: tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Cancel.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Cancel.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/magazine/LC_Page_Magazine_Cancel.php	(revision 18609)
@@ -77,5 +77,5 @@
 
         if (empty($key) or !$this->lfExistKey($key, $objQuery))  {
-            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         } else {
             $this->lfChangeData($key, $objQuery);
Index: tmp/version-2_5-test/data/class/pages/contact/LC_Page_Contact.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/contact/LC_Page_Contact.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/contact/LC_Page_Contact.php	(revision 18609)
@@ -38,43 +38,9 @@
 
     /**
-     * Page を初期化する.
-     *
-     * @return void
-     */
-    function init() {
-        parent::init();
-        $this->tpl_mainpage = 'contact/index.tpl';
-        $this->tpl_title = 'お問い合わせ(入力ページ)';
-        $this->tpl_page_category = 'contact';
-
-        $masterData = new SC_DB_MasterData_Ex();
-        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
-    }
-
-    /**
-     * Page のプロセス.
-     *
-     * @return void
-     */
-    function process() {
-        global $objCampaignSess;
-
-        $conn = new SC_DBConn();
-        $this->objView = new SC_SiteView();
-        $objCampaignSess = new SC_CampaignSession();
-        $objDb = new SC_Helper_DB_Ex();
-        $CONF = $objDb->sf_getBasisData();			// 店舗基本情報
-        SC_Utils_Ex::sfDomainSessionStart();
-
-        $objCustomer = new SC_Customer();
-
-        $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : "";
-
-        // レイアウトデザインを取得
-        $layout = new SC_Helper_PageLayout_Ex();
-        $layout->sfGetPageLayout($this, false, DEF_LAYOUT);
-
-        //フォーム値変換用カラム
-        $arrConvertColumn = array(
+     * フォーム値変換用カラム
+     *
+     *
+     */
+     var $arrConvertColumn = array(
                                      array(  "column" => "name01",		"convert" => "aKV" ),
                                      array(  "column" => "name02",		"convert" => "aKV" ),
@@ -87,5 +53,4 @@
                                      array(  "column" => "addr02",		"convert" => "aKV" ),
                                      array(  "column" => "email",		"convert" => "a" ),
-                                     array(  "column" => "email02",		"convert" => "a" ),
                                      array(  "column" => "tel01",		"convert" => "n" ),
                                      array(  "column" => "tel02",		"convert" => "n" ),
@@ -94,48 +59,60 @@
                                   );
 
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'contact/index.tpl';
+        $this->tpl_title = 'お問い合わせ(入力ページ)';
+        $this->tpl_page_category = 'contact';
+        $this->httpCacheControl('nocache');
+
+        $masterData = new SC_DB_MasterData_Ex();
+        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        global $objCampaignSess;
+
+        $conn = new SC_DBConn();
+        $this->objView = new SC_SiteView();
+        $objCampaignSess = new SC_CampaignSession();
+        $objDb = new SC_Helper_DB_Ex();
+        $CONF = $objDb->sf_getBasisData();			// 店舗基本情報
+        SC_Utils_Ex::sfDomainSessionStart();
+
+        $objCustomer = new SC_Customer();
+
+        $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : "";
+
+        // レイアウトデザインを取得
+        $layout = new SC_Helper_PageLayout_Ex();
+        $layout->sfGetPageLayout($this, false, DEF_LAYOUT);
+
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
 
         switch ($_POST['mode']) {
             case 'confirm':
-            // エラーチェック
-            $this->arrForm = $_POST;
-            $this->arrForm['email']   = isset($_POST['email']) ? strtolower($_POST['email']) : '';
-            $this->arrForm['email02'] = isset($_POST['email02']) ? strtolower($_POST['email02']) : '';
-            $this->arrForm = $this->lfConvertParam($this->arrForm,$arrConvertColumn);
-            $this->arrErr = $this->lfErrorCheck($this->arrForm);
-            if ( ! $this->arrErr ){
-                // エラー無しで完了画面
-                $this->tpl_mainpage = 'contact/confirm.tpl';
-                $this->tpl_title = 'お問い合わせ(確認ページ)';
-            } else {
-                foreach ($arrConvertColumn as $key) {
-                    $this->$key['column'] = $this->arrForm[$key['column']];
-                }
-            }
-            break;
+              $this->lfContactConfirm();
+              break;
 
             case 'return':
-                foreach ($arrConvertColumn as $key) {
-                    $this->$key['column'] = $_POST[$key['column']];
-                }
-            break;
+              $this->lfContactReturn();
+              break;
 
             case 'complete':
-            $this->arrForm = $_POST;
-            $this->arrForm['email'] = strtolower($_POST['email']);
-            $this->arrForm = $this->lfConvertParam($this->arrForm,$arrConvertColumn);
-            $this->arrErr = $this->lfErrorCheck($this->arrForm);
-            if(!$this->arrErr) {
-                $this->lfSendMail($CONF, $this);
-                // 完了ページへ移動する
-                $this->sendRedirect($this->getLocation("./complete.php", array(), true));
-                exit;
-            } else {
-                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
-            }
-            break;
+              $this->lfContactComplete();
+              break;
 
             default:
-            break;
+              break;
         }
 
@@ -183,4 +160,58 @@
     // }}}
     // {{{ protected functions
+
+    /**
+     * 確認画面
+     *
+     * @return void
+     */
+    function lfContactConfirm() {
+        // エラーチェック
+        $this->arrForm = $_POST;
+        $this->arrForm['email'] = strtolower($_POST['email']);
+        $this->arrForm = $this->lfConvertParam($this->arrForm,$this->arrConvertColumn);
+        $this->arrErr = $this->lfErrorCheck($this->arrForm);
+        if ( ! $this->arrErr ){
+            // エラー無しで完了画面
+            $this->tpl_mainpage = 'contact/confirm.tpl';
+            $this->tpl_title = 'お問い合わせ(確認ページ)';
+        } else {
+            foreach ($this->arrForm as $key => $val){
+                $this->$key = $val;
+            }
+        }
+    }
+
+    /**
+     * 前に戻る
+     *
+     * @return void
+     */
+    function lfContactReturn() {
+        foreach ($_POST as $key => $val){
+            $this->$key = $val;
+        }
+    }
+
+    /**
+     * 完了ページへ
+     *
+     * @return void
+     */
+    function lfContactComplete() {
+        $this->arrForm = $_POST;
+        $this->arrForm['email']   = isset($_POST['email']) ? strtolower($_POST['email']) : '';
+        $this->arrForm['email02'] = isset($_POST['email02']) ? strtolower($_POST['email02']) : '';
+        $this->arrForm = $this->lfConvertParam($this->arrForm,$this->arrConvertColumn);
+        $this->arrErr = $this->lfErrorCheck($this->arrForm);
+        if(!$this->arrErr) {
+            $this->lfSendMail($this);
+            // 完了ページへ移動する
+            $this->sendRedirect($this->getLocation("./complete.php", array(), true));
+            exit;
+        } else {
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
+        }
+    }
 
     //エラーチェック処理部
@@ -239,50 +270,19 @@
     // ------------  メール送信 ------------
 
-    function lfSendMail($CONF, &$objPage){
-
+    function lfSendMail(&$objPage){
+        $objDb = new SC_Helper_DB_Ex();
+        $CONF = $objDb->sf_getBasisData();			// 店舗基本情報
         $objQuery = new SC_Query();
-        $objMailText = new SC_SiteView();
         $objSiteInfo = $this->objView->objSiteInfo;
         $arrInfo = $objSiteInfo->data;
-        $objPage->tpl_shopname=$arrInfo['shop_name'];
+        $objPage->tpl_shopname = $arrInfo['shop_name'];
         $objPage->tpl_infoemail = $arrInfo['email02'];
-        $objMailText->assignobj($objPage);
-        $toCustomerMail = $objMailText->fetch("mail_templates/contact_mail.tpl");
-        $objMail = new SC_SendMail();
-
-        if ( $objPage->arrForm['email'] ) {
-            $fromMail_name = $objPage->arrForm['name01'] ." 様";
-            $fromMail_address = $objPage->arrForm['email'];
-        } else {
-            $fromMail_name = $CONF["shop_name"];
-            $fromMail_address = $CONF["email02"];
-        }
+
+        $fromMail_name = $objPage->arrForm['name01'] ." 様";
+        $fromMail_address = $objPage->arrForm['email'];
+
         $helperMail = new SC_Helper_Mail_Ex();
-        $subject = $helperMail->sfMakeSubject($objQuery, $objMailText, $this, "お問い合わせがありました。");
-        $objMail->setItem(
-                              $CONF["email02"]					//　宛先
-                            , $subject							//　サブジェクト
-                            , $toCustomerMail					//　本文
-                            , $fromMail_address					//　配送元アドレス
-                            , $fromMail_name					//　配送元　名前
-                            , $fromMail_address					//　reply_to
-                            , $CONF["email04"]					//　return_path
-                            , $CONF["email04"]					//  Errors_to
-                                                            );
-        $objMail->sendMail();
-
-        $subject = $helperMail->sfMakeSubject($objQuery, $objMailText, $this, "お問い合わせを受け付けました。");
-        $objMail->setItem(
-                              ''								//　宛先
-                            , $subject							//　サブジェクト
-                            , $toCustomerMail					//　本文
-                            , $CONF["email03"]					//　配送元アドレス
-                            , $CONF["shop_name"]				//　配送元　名前
-                            , $CONF["email02"]					//　reply_to
-                            , $CONF["email04"]					//　return_path
-                            , $CONF["email04"]					//  Errors_to
-                                                            );
-        $objMail->setTo($objPage->arrForm['email'], $objPage->arrForm['name01'] ." 様");
-        $objMail->sendMail();
+        $helperMail->sfSendTemplateMail($CONF["email02"], $CONF["shop_name"], "5", $objPage, $fromMail_address, $fromMail_name, $fromMail_address);
+        $helperMail->sfSendTemplateMail($objPage->arrForm['email'], $objPage->arrForm['name01'] ." 様", "5", $objPage, $CONF["email03"], $CONF["shop_name"], $CONF["email02"]);
     }
 }
Index: tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist.php	(revision 18609)
@@ -35,7 +35,4 @@
 
     // {{{ properties
-
-    /** ページ情報の配列 */
-    var $arrInfo;
 
     /** 設定情報 */
@@ -65,5 +62,4 @@
         $objDb = new SC_Helper_DB_Ex();
         $this->CONF = $objDb->sf_getBasisData();
-        $this->arrInfo = $objSiteInfo->data;
 
         // キャンペーンからの登録の場合の処理
@@ -79,5 +75,5 @@
             if ($this->arrErr) {
                 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, $this->arrErr["id"]);
-
+            
             } else {
                 $registSecretKey = $this->lfRegistData($_GET);			//本会員登録（フラグ変更）
@@ -124,5 +120,4 @@
         $objDb = new SC_Helper_DB_Ex();
         $this->CONF = $objDb->sf_getBasisData();
-        $this->arrInfo = $objSiteInfo->data;
 
         //--　本登録完了のためにメールから接続した場合
@@ -186,7 +181,5 @@
         $where = "secret_key = ? AND status = 1";
 
-        // 会員登録時の加算ポイント(購入時会員登録かつ仮会員登録専用）
-        //$arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
-        //$arrRegist['point'] = $arrRet[0]['point'] + $this->arrInfo['welcome_point'];
+        $arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
 
         $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
@@ -275,5 +268,5 @@
         $objMailText->assign("name02", $data["name02"]);
         $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
-        $subject = $objHelperMail->sfMakesubject($objQuery, $objMailText, $this, '会員登録が完了しました。');
+        $subject = $objHelperMail->sfMakesubject('会員登録が完了しました。');
         $objMail = new SC_SendMail();
 
Index: tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist_Complete.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist_Complete.php	(revision 16930)
+++ tmp/version-2_5-test/data/class/pages/regist/LC_Page_Regist_Complete.php	(revision 18609)
@@ -102,5 +102,5 @@
 
         // カートが空かどうかを確認する。
-        $objCartSess = new SC_CartSession("", false);
+        $objCartSess = new SC_CartSession();
         $this->tpl_cart_empty = count($objCartSess->getCartList()) < 1;
 
Index: tmp/version-2_5-test/data/class/pages/guide/LC_Page_Guide_Order.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/guide/LC_Page_Guide_Order.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/guide/LC_Page_Guide_Order.php	(revision 18609)
@@ -0,0 +1,104 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * ご利用方法 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id: LC_Page_Guide_Usage.php 16582 2007-10-29 03:06:29Z nanasess $
+ */
+class LC_Page_Guide_Order extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+    }
+
+    /**
+     * モバイルページを初期化する.
+     *
+     * @return void
+     */
+    function mobileInit() {
+        $this->tpl_mainpage = 'guide/order1.tpl';	// メインテンプレート
+        $this->tpl_title = '特定商取引法に基づく表記';
+
+        $masterData = new SC_DB_MasterData_Ex();
+        $this->arrPref = $masterData->getMasterData("mtb_pref",
+                                 array("pref_id", "pref_name", "rank"));
+    }
+
+    /**
+     * Page のプロセス(モバイル).
+     *
+     * @return void
+     */
+    function mobileProcess() {
+        $objDb = new SC_Helper_DB_Ex();
+
+        switch (@$_GET['page']) {
+            case '2':
+            case '3':
+                $this->tpl_mainpage = 'guide/order' . $_GET['page'] . '.tpl';
+                break;
+        }
+
+        // レイアウトデザインを取得
+        $objLayout = new SC_Helper_PageLayout_Ex();
+        $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
+        $this->arrRet = $objDb->sf_getBasisData();
+
+        $objView = new SC_MobileView();
+        $objView->assignobj($this);
+        $objView->display(SITE_FRAME);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/forgot/LC_Page_Forgot.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/forgot/LC_Page_Forgot.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/forgot/LC_Page_Forgot.php	(revision 18609)
@@ -71,5 +71,5 @@
             $objView = new SC_MobileView();
         } else {
-            $objView = new SC_SiteView();
+            $objView = new SC_SiteView(false);
         }
 
@@ -221,5 +221,5 @@
         $this->customer_name = $customer_name;
         $this->temp_password = $temp_password;
-        $objMailText = new SC_SiteView();
+        $objMailText = new SC_SiteView(false);
         $objMailText->assignobj($this);
 
@@ -251,5 +251,5 @@
         // 空メール用のトークンを作成。
         if (MOBILE_USE_KARA_MAIL) {
-            $token = $objMobile->gfPrepareKaraMail('forgot/index.php');
+            $token = $objMobile->gfPrepareKaraMail('forgot/' . DIR_INDEX_URL);
             if ($token !== false) {
                 $objPage->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'forgot_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
Index: tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_EmailMobile.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_EmailMobile.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_EmailMobile.php	(revision 18609)
@@ -62,5 +62,4 @@
         $this->tpl_mainpage = 'entry/email_mobile.tpl';
         $this->tpl_title = '携帯メール登録';
-        $this->allowClientCache();
     }
 
@@ -122,5 +121,5 @@
     function lfInitParam(&$objFormParam) {
         $objFormParam->addParam('メールアドレス', 'email_mobile', MTEXT_LEN, 'a',
-                                array('NO_SPTAB', 'EXIST_CHECK', 'MAX_LENGTH_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'MOBILE_EMAIL_CHECK'));
+                                array('NO_SPTAB', 'EXIST_CHECK', 'MAX_LENGTH_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'EMAIL_CHECK', 'MOBILE_EMAIL_CHECK'));
     }
 
Index: tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * 会員登録(入力ページ) のページクラス.
+ * 会員登録のページクラス.
  *
  * @package Page
@@ -39,4 +39,17 @@
     /**
      * Page を初期化する.
+     *
+     * 以下のプロパティの初期化を行う.
+     * - tpl_mainpage
+     * - tpl_title
+     * - year
+     * - arrPref (mtb_pref からマスタデータを取得する)
+     * - arrJob (mtb_job からマスタデータを取得する)
+     * - arrReminder (mtb_reminder からマスタデータを取得する)
+     * - arrYear
+     * - arrMonth
+     * - arrDay
+     *
+     * また, クライアント・プロキシのキャッシュ制御を "nocache" に設定する.
      *
      * @return void
@@ -52,8 +65,12 @@
         $this->arrJob = $masterData->getMasterData("mtb_job");
         $this->arrReminder = $masterData->getMasterData("mtb_reminder");
-        $this->objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
-        $this->arrYear = $this->objDate->getYear('', 1950);	//　日付プルダウン設定
-        $this->arrMonth = $this->objDate->getMonth();
-        $this->arrDay = $this->objDate->getDay();
+        
+        // 生年月日選択肢の取得
+        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+        $this->arrYear = $objDate->getYear('', 1950, '');
+        $this->arrMonth = $objDate->getMonth(true);
+        $this->arrDay = $objDate->getDay(true);
+        
+        $this->httpCacheControl('nocache');
     }
 
@@ -61,4 +78,83 @@
      * Page のプロセス.
      *
+     * <b>概要</b>
+     *
+     * 一般ユーザーが個人情報を入力し, 会員登録を行う.
+     * 会員登録完了時, ユーザーのメールアドレスと店舗管理者へ会員登録完了
+     * の通知メールを送信し, 登録完了画面へリダイレクトを行う.
+     *
+     * <b>アクター</b>
+     *
+     * - 一般ユーザー
+     *
+     * <b>基本フロー</b>
+     *
+     * 遷移の際, トランザクショントークンを使用し, 不正な遷移が発生した場合は
+     * エラーページを表示する.
+     *
+     * <ol>
+     *   <li>入力フォーム($_POST['mode'] == '')
+     *     <ul>
+     *       <li>入力チェックがエラーの場合($_POST['mode'] == 'return')</li>
+     *       <li>$_POST が空かつ, $_SERVER['HTTP_REFERER'] に "kiyaku.php"
+     *       の文字列が存在しない場合はエラーページを表示する</li>
+     *     </ul>
+     *   </li>
+     *   <li>入力確認画面($_POST['mode'] == 'confirm')</li>
+     *   <li>登録完了処理($_POST['mode'] == 'complete')</li>
+     *   <li>登録完了画面へリダイレクトを行う</li>
+     * </ol>
+     *
+     * 仮会員登録が有効な場合, 3 の登録完了画面の前に, 仮会員登録メールを送信し,
+     * ユーザーが本会員登録用 URL をクリックした時点で登録を完了する.
+     *
+     * <b>代替フロー</b>
+     *
+     * なし
+     *
+     * <b>特別な要件事項</b>
+     *
+     * - ユーザーが入力した情報は, 空文字, 改行を削除する.
+     * - メールアドレスは, すべて小文字に変換し, DBに格納する.
+     *
+     * <b>事前条件</b>
+     *
+     * アクターがシステムに訪問していること.
+     *
+     * <b>事後条件</b>
+     *
+     * アクターの会員登録が完了していること.
+     *
+     * <b>サブユースケース</b>
+     *
+     * なし
+     *
+     * <b>使用するスーパーグローバル変数</b>
+     *
+     * - $_SERVER['PHP_SELF']
+     * - $_SERVER['HTTP_REFERER']
+     * - $_SERVER["REQUEST_METHOD"]
+     * - $_POST["name01"]
+     * - $_POST["name02"]
+     * - $_POST["kana01"]
+     * - $_POST["kana02"]
+     * - $_POST["zip01"]
+     * - $_POST["zip02"]
+     * - $_POST["addr01"]
+     * - $_POST["addr02"]
+     * - $_POST["tel01"]
+     * - $_POST["tel02"]
+     * - $_POST["tel03"]
+     * - $_POST["fax01"]
+     * - $_POST["fax02"]
+     * - $_POST["fax03"]
+     * - $_POST["email"]
+     * - $_POST["email02"]
+     * - $_POST["password"]
+     * - $_POST["password02"]
+     * - $_POST["reminder_answer"]
+     * - $_POST["mode"]('return', 'confirm', 'complate')
+     *
+     * @global $objCampaignSess
      * @return void
      */
@@ -72,9 +168,7 @@
         $objDb = new SC_Helper_DB_Ex();
         $CONF = $objDb->sf_getBasisData();
-        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
 
         $ssl_url  = rtrim(SSL_URL,"/");
         $ssl_url .= $_SERVER['PHP_SELF'];
-
 
         // 規約ページからの遷移でなければエラー画面へ遷移する
@@ -84,6 +178,6 @@
 
         // レイアウトデザインを取得
-        $layout = new SC_Helper_PageLayout_Ex();
-        $layout->sfGetPageLayout($this, false, DEF_LAYOUT);
+        $objLayout = new SC_Helper_PageLayout_Ex();
+        $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
 
         //---- 登録用カラム配列
@@ -127,5 +221,5 @@
             }
 
-            //空白・改行の削除
+            // 空白・改行の削除
             $_POST["name01"] = preg_replace('/^[ 　\r\n]*(.*?)[ 　\r\n]*$/u', '$1', $_POST["name01"]);
             $_POST["name02"] = preg_replace('/^[ 　\r\n]*(.*?)[ 　\r\n]*$/u', '$1', $_POST["name02"]);
@@ -151,10 +245,6 @@
             $this->arrForm = $_POST;
 
-            //SSL用
-            $this->arrForm[ssl_url] = $ssl_url;
-
-            if($this->arrForm['year'] == '----') {
-                $this->arrForm['year'] = '';
-            }
+            // SSL用
+            $this->arrForm['ssl_url'] = $ssl_url;
 
             $this->arrForm['email'] = strtolower($this->arrForm['email']);		// emailはすべて小文字で処理
@@ -164,15 +254,15 @@
             $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
 
-            //--　入力エラーチェック
+            //-- 入力エラーチェック
             $this->arrErr = $this->lfErrorCheck($this->arrForm);
 
             if ($this->arrErr || $_POST["mode"] == "return") {		// 入力エラーのチェック
-                foreach($arrRegistColumn as $key) {
-                    $this->$key['column'] = $this->arrForm[$key['column']];
+                foreach($this->arrForm as $key => $val) {
+                    $this->$key = $val;
                 }
 
             } else {
 
-                //--　確認
+                //-- 確認
                 if ($_POST["mode"] == "confirm") {
                     foreach($this->arrForm as $key => $val) {
@@ -189,5 +279,5 @@
                 }
 
-                //--　会員登録と完了画面
+                //-- 会員登録と完了画面
                 if ($_POST["mode"] == "complete") {
                     // キャンペーンからの遷移の時用の値
@@ -204,5 +294,5 @@
                     $this->tpl_title = '会員登録(完了ページ)';
 
-                    //　完了メール送信
+                    // 完了メール送信
                     $this->name01 = $_POST['name01'];
                     $this->name02 = $_POST['name02'];
@@ -210,12 +300,13 @@
                     $objMailText->assignobj($this);
 
-                    $mailHelper = new SC_Helper_Mail_Ex();
+                    $objHelperMail = new SC_Helper_Mail_Ex();
                     $objQuery = new SC_Query();
+
                     // 仮会員が有効の場合
                     if(CUSTOMER_CONFIRM_MAIL == true) {
-                        $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
+                        $subject = $objHelperMail->sfMakeSubject('会員登録のご確認');
                         $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
                     } else {
-                        $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご完了');
+                        $subject = $objHelperMail->sfMakeSubject('会員登録のご完了');
                         $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
                         // ログイン状態にする
@@ -225,13 +316,14 @@
                     $objMail = new SC_SendMail();
                     $objMail->setItem(
-                                        ''									//　宛先
-                                        , $subject							//　サブジェクト
-                                        , $toCustomerMail					//　本文
-                                        , $CONF["email03"]					//　配送元アドレス
-                                        , $CONF["shop_name"]				//　配送元　名前
-                                        , $CONF["email03"]					//　reply_to
-                                        , $CONF["email04"]					//　return_path
-                                        , $CONF["email04"]					//  Errors_to
-                                    );
+                                          ''                    // 宛先
+                                        , $subject              // サブジェクト
+                                        , $toCustomerMail       // 本文
+                                        , $CONF["email03"]      // 配送元アドレス
+                                        , $CONF["shop_name"]    // 配送元 名前
+                                        , $CONF["email03"]      // reply_to
+                                        , $CONF["email04"]      // return_path
+                                        , $CONF["email04"]      // Errors_to
+                                        , $CONF["email01"]      // Bcc
+                    );
                     // 宛先の設定
                     $name = $_POST["name01"] . $_POST["name02"] ." 様";
@@ -247,11 +339,7 @@
         }
 
-        if($this->year == '') {
-            $this->year = '----';
-        }
-
         $this->transactionid = $this->getToken();
 
-        //----　ページ表示
+        //---- ページ表示
         $objView->assignobj($this);
         // フレームを選択(キャンペーンページから遷移なら変更)
@@ -267,5 +355,5 @@
         $this->init();
         $this->tpl_mainpage = 'entry/index.tpl';		// メインテンプレート
-        $this->tpl_title .= '会員登録(1/3)';			//　ページタイトル
+        $this->tpl_title .= '会員登録(1/3)';			// ページタイトル
     }
 
@@ -283,5 +371,4 @@
         $objView = new SC_MobileView();
         $objCustomer = new SC_Customer();
-        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
 
         // 空メール
@@ -290,5 +377,5 @@
             $this->tpl_kara_mail_from = $_POST['email'];
         } elseif (MOBILE_USE_KARA_MAIL) {
-            $token = $objMobile->gfPrepareKaraMail('entry/index.php');
+            $token = $objMobile->gfPrepareKaraMail('entry/' . DIR_INDEX_URL);
             if ($token !== false) {
                 $this->tpl_mainpage = 'entry/mail.tpl';
@@ -341,10 +428,4 @@
             //-- POSTデータの引き継ぎ
             $this->arrForm = $_POST;
-
-            if(isset($this->arrForm['year'])
-               && $this->arrForm['year'] == '----') {
-                $this->arrForm['year'] = '';
-            }
-
             $this->arrForm['email'] = strtolower($this->arrForm['email']);		// emailはすべて小文字で処理
 
@@ -367,5 +448,5 @@
             }
 
-            //--　入力エラーチェック
+            //-- 入力エラーチェック
             if ($_POST["mode"] == "set1") {
                 $this->arrErr = $this->lfErrorCheck1($this->arrForm);
@@ -382,6 +463,6 @@
             }
 
-            foreach($arrRegistColumn as $key) {
-                $this->$key['column'] = $this->arrForm[$key['column']];
+            foreach($this->arrForm as $key => $val) {
+                $this->$key = $val;
             }
 
@@ -406,5 +487,5 @@
             } else {
 
-                //--　テンプレート設定
+                //-- テンプレート設定
                 if ($_POST["mode"] == "set1") {
                     $this->tpl_mainpage = 'entry/set1.tpl';
@@ -415,14 +496,14 @@
 
                     if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") {
-                        $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
+                        $address = SC_Utils_Ex::sfGetAddress($_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") {
@@ -454,5 +535,5 @@
 
 
-                //--　仮登録と完了画面
+                //-- 仮登録と完了画面
                 if ($_POST["mode"] == "complete") {
 
@@ -463,5 +544,5 @@
                         $this->tpl_title = '会員登録(1/3)';
                         $this->arrErr = $arrErr;
-                        //----　ページ表示
+                        //---- ページ表示
                         $objView->assignobj($this);
                         $objView->display(SITE_FRAME);
@@ -475,5 +556,5 @@
                         $this->tpl_title = '会員登録(2/3)';
                         $this->arrErr = $arrErr;
-                        //----　ページ表示
+                        //---- ページ表示
                         $objView->assignobj($this);
                         $objView->display(SITE_FRAME);
@@ -487,5 +568,5 @@
                         $this->tpl_title = '会員登録(3/3)';
                         $this->arrErr = $arrErr;
-                        //----　ページ表示
+                        //---- ページ表示
                         $objView->assignobj($this);
                         $objView->display(SITE_FRAME);
@@ -501,5 +582,5 @@
                                        "id" => $this->uniqid,
                                        session_name() => session_id());
-                        $this->sendRedirect($this->getLocation(MOBILE_URL_DIR . "regist/index.php", $param));
+                        $this->sendRedirect($this->getLocation(MOBILE_URL_DIR . "regist/" . DIR_INDEX_URL, $param));
                         exit;
                     }
@@ -508,7 +589,7 @@
                     $this->tpl_title = '会員登録(完了ページ)';
 
-                    $objMobile->sfMobileSetExtSessionId('id', $this->uniqid, 'regist/index.php');
-
-                    //　仮登録完了メール送信
+                    $objMobile->sfMobileSetExtSessionId('id', $this->uniqid, 'regist/' . DIR_INDEX_URL);
+
+                    // 仮登録完了メール送信
                     $this->to_name01 = $_POST['name01'];
                     $this->to_name02 = $_POST['name02'];
@@ -522,8 +603,8 @@
                         // Moba8パラメーターを保持する場合はカラム追加
                         if (isset($_SESSION['a8'])) $this->etc_value = "&a8=". $_SESSION['a8'];
-                        $subject = $objHelperMail->sfMakeSubject($objQuery, $objMailText, $this, '会員登録のご確認');
+                        $subject = $objHelperMail->sfMakeSubject('会員登録のご確認');
                         $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
                     } else {
-                        $subject = $objHelperMail->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご完了');
+                        $subject = $objHelperMail->sfMakeSubject('会員登録のご完了');
                         $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
                         // ログイン状態にする
@@ -533,14 +614,14 @@
                     $objMail = new SC_SendMail();
                     $objMail->setItem(
-                                      ''									//　宛先
-                                      , $subject							//　サブジェクト
-                                      , $toCustomerMail					//　本文
-                                      , $CONF["email03"]					//　配送元アドレス
-                                      , $CONF["shop_name"]				//　配送元　名前
-                                      , $CONF["email03"]					//　reply_to
-                                      , $CONF["email04"]					//　return_path
-                                      , $CONF["email04"]					//  Errors_to
-                                      , $CONF["email01"]					//  Bcc
-                                      );
+                                        ''                  // 宛先
+                                      , $subject            // サブジェクト
+                                      , $toCustomerMail     // 本文
+                                      , $CONF["email03"]    // 配送元アドレス
+                                      , $CONF["shop_name"]  // 配送元 名前
+                                      , $CONF["email03"]    // reply_to
+                                      , $CONF["email04"]    // return_path
+                                      , $CONF["email04"]    // Errors_to
+                                      , $CONF["email01"]    // Bcc
+                    );
                     // 宛先の設定
                     $name = $_POST["name01"] . $_POST["name02"] ." 様";
@@ -555,5 +636,5 @@
         }
 
-        //----　ページ表示
+        //---- ページ表示
         $objView->assignobj($this);
         $objView->display(SITE_FRAME);
@@ -647,12 +728,12 @@
 
 
-    /* メルマガ会員機能は現在停止中　2007/03/07
-
-
-        //--　非会員でメルマガ登録しているかの判定
+    /* メルマガ会員機能は現在停止中 2007/03/07
+
+
+        //-- 非会員でメルマガ登録しているかの判定
         $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
         $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
 
-        //--　メルマガ仮登録実行
+        //-- メルマガ仮登録実行
         $arrRegistMail["email"] = $arrRegist["email"];
         if ($array["mailmaga_flg"] == 1) {
@@ -668,5 +749,5 @@
         if ($mailResult == 1) {
             $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
-        } else {				//　新規登録の場合
+        } else {				// 新規登録の場合
             $arrRegistMail["create_date"] = "now()";
             $objQuery->insert("dtb_customer_mail", $arrRegistMail);
@@ -678,5 +759,5 @@
     }
 
-    //----　取得文字列の変換
+    //---- 取得文字列の変換
     function lfConvertParam($array, $arrRegistColumn) {
         /*
@@ -721,5 +802,5 @@
         $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', "email", "email02") ,array("EQUAL_CHECK"));
 
-        //現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
+        // 現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
         if (strlen($array["email"]) > 0) {
             $array["email"] = strtolower($array["email"]);
@@ -763,5 +844,5 @@
         $objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK"));
 
-        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
         $objErr->doFunc(array("メールマガジン", 'mailmaga_flg'), array("SELECT_CHECK"));
         return $objErr->arrErr;
@@ -782,33 +863,4 @@
     // {{{ mobile functions
 
-    // 郵便番号から住所の取得
-    function lfGetAddress($zipcode) {
-
-        $conn = new SC_DBconn(ZIP_DSN);
-
-        // 郵便番号検索文作成
-        $zipcode = mb_convert_kana($zipcode ,"n");
-        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
-
-        $data_list = $conn->getAll($sqlse, array($zipcode));
-
-        // インデックスと値を反転させる。
-        $arrREV_PREF = array_flip($this->arrPref);
-
-        /*
-         総務省からダウンロードしたデータをそのままインポートすると
-         以下のような文字列が入っているので	対策する。
-         ・（１・１９丁目）
-         ・以下に掲載がない場合
-        */
-        $town =  $data_list[0]['town'];
-        $town = ereg_replace("（.*）$","",$town);
-        $town = ereg_replace("以下に掲載がない場合","",$town);
-        $data_list[0]['town'] = $town;
-        $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
-
-        return $data_list;
-    }
-
     //---- 入力エラーチェック
     function lfErrorCheck1($array) {
@@ -823,5 +875,5 @@
         $objErr->doFunc(array('メールアドレス', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
 
-        //現会員の判定 →　現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
+        // 現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
         if (strlen($array["email"]) > 0) {
             $array['email'] = strtolower($array['email']);
@@ -863,13 +915,5 @@
 
         $objErr->doFunc(array("性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
-        $objErr->doFunc(array("生年月日 (年)", "year", 4), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        if (!isset($objErr->arrErr['year']) && strlen($array['year'] > 0)) {
-            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getStartYear()), array("MIN_CHECK"));
-            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getEndYear()), array("MAX_CHECK"));
-        }
-        $objErr->doFunc(array("生年月日 (月日)", "month", "day"), array("SELECT_CHECK"));
-        if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
-            $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
-        }
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
 
         return $objErr->arrErr;
Index: tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_Complete.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_Complete.php	(revision 16930)
+++ tmp/version-2_5-test/data/class/pages/entry/LC_Page_Entry_Complete.php	(revision 18609)
@@ -56,4 +56,5 @@
 
         $this->tpl_title .= '会員登録(完了ページ)';
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Login.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Login.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Login.php	(revision 18609)
@@ -48,4 +48,5 @@
         $this->tpl_login = false;
         $this->tpl_disable_logout = false;
+        $this->httpCacheControl('nocache');
     }
 
@@ -80,5 +81,5 @@
 
         $this->tpl_disable_logout = $this->lfCheckDisableLogout();
-        $objSubView = new SC_SiteView();
+        $objSubView = new SC_SiteView(false);
         $this->transactionid = $this->getToken();
         $objSubView->assignobj($this);
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php	(revision 18609)
@@ -60,5 +60,5 @@
             $objView = new SC_MobileView();
         } else {
-            $objView = new SC_SiteView();
+            $objView = new SC_SiteView(false);
         }
 
@@ -161,4 +161,5 @@
         return $arrRegularHoliday;
     }
+
     // 休日チェック
     function lfCheckHoliday($year, $month, $day) {
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.php	(revision 18609)
@@ -54,5 +54,5 @@
      */
     function process() {
-        $objSubView = new SC_SiteView();
+        $objSubView = new SC_SiteView(false);
         $objCart = new SC_CartSession();
         $objSiteInfo = new SC_SiteInfo;
@@ -86,7 +86,7 @@
             $arrInfo = $objSiteInfo->data;
             // 購入金額合計
-            $ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
+            $ProductsTotal = $objCart->getAllProductsTotal();
 
-            // 合計個数
+            // 合計数量
             $TotalQuantity = $objCart->getTotalQuantity();
 
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php	(revision 18609)
@@ -64,11 +64,22 @@
             // 文字サイズを制限する
             foreach($arrRet as $key => $val) {
-                $str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
-                $arrRet[$key] = preg_replace('/　/', "&nbsp;", $str);
+                $arrRet[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
             }
         }
         $this->arrCatList = $arrRet;
 
-        $objSubView = new SC_SiteView();
+        // 選択中のメーカーIDを判定する
+        $this->maker_id = $objDb->sfGetMakerId($_GET['product_id'], $_GET['maker_id']);
+        // メーカー検索用選択リスト
+        $arrRet = $objDb->sfGetMakerList('', true);
+        if(is_array($arrRet)) {
+            // 文字サイズを制限する
+            foreach($arrRet as $key => $val) {
+                $arrRet[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN);
+            }
+        }
+        $this->arrMakerList = $arrRet;
+
+        $objSubView = new SC_SiteView(false);
         $objSubView->assignobj($this);
         $objSubView->display($this->tpl_mainpage);
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php	(revision 17204)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php	(revision 18609)
@@ -55,5 +55,5 @@
     function process() {
         if (defined("MOBILE_SITE") && MOBILE_SITE) {
-            $objSubView = new SC_SiteView();
+            $objSubView = new SC_SiteView(false);
         } else {
             $objSubView = new SC_MobileView();
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php	(revision 18609)
@@ -54,5 +54,5 @@
      */
     function process() {
-        $objSubView = new SC_SiteView();
+        $objSubView = new SC_SiteView(false);
         $objDb = new SC_Helper_DB_Ex();
 
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php	(revision 16732)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php	(revision 18609)
@@ -40,10 +40,14 @@
      */
     function setTplMainpage($bloc_file) {
-    	$debug_message = "";
-    	$user_bloc_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . BLOC_DIR . $bloc_file;
-        if (is_file($user_bloc_path)) {
-            $this->tpl_mainpage = $user_bloc_path;
+        $debug_message = "";
+        if (substr($bloc_file, 0, 1) == '/') {
+            $this->tpl_mainpage = $bloc_file;
         } else {
-            $this->tpl_mainpage = BLOC_PATH . $bloc_file;
+            $user_bloc_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . BLOC_DIR . $bloc_file;
+            if (is_file($user_bloc_path)) {
+                $this->tpl_mainpage = $user_bloc_path;
+            } else {
+                $this->tpl_mainpage = BLOC_PATH . $bloc_file;
+            }
         }
         $debug_message = "block：" . $this->tpl_mainpage . "\n";
Index: tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php	(revision 18609)
@@ -57,5 +57,5 @@
             $objView = new SC_MobileView();
         } else {
-            $objView = new SC_SiteView();
+            $objView = new SC_SiteView(false);
         }
         $objSiteInfo = $objView->objSiteInfo;
@@ -68,6 +68,8 @@
         $this->arrBestProducts = $this->lfGetRanking();
 
-        $objView->assignobj($this);
-        $objView->display($this->tpl_mainpage);
+        if (!empty($this->arrBestProducts)) {
+            $objView->assignobj($this);
+            $objView->display($this->tpl_mainpage);
+        }
     }
 
@@ -106,5 +108,11 @@
         $col = "DISTINCT A.*, name, price02_min, price01_min, main_list_image ";
         $from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)";
-        $where = "status = 1";
+        $where = "allcls.del_flg = 0 AND allcls.status = 1";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $where .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         $order = "rank";
         $objQuery->setorder($order);
Index: tmp/version-2_5-test/data/class/pages/LC_Page_Sitemap.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/LC_Page_Sitemap.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/LC_Page_Sitemap.php	(revision 18609)
@@ -60,8 +60,4 @@
     var $staticURL;
 
-
-    /** ページデータ */
-    var $arrPageData;
-
     /** ページリスト */
     var $arrPageList;
@@ -78,5 +74,11 @@
     function init() {
         parent::init();
-        $this->staticURL = array(SITE_URL, MOBILE_SITE_URL, SITE_URL . "rss/index.php");
+        
+        $this->staticURL = array();
+        
+        $this->staticURL[] = SITE_URL . 'rss/' . DIR_INDEX_URL;
+        if (USE_MOBILE !== false) {
+            $this->staticURL[] = MOBILE_SITE_URL;
+        }
     }
 
@@ -104,9 +106,4 @@
         print("<?xml version='1.0' encoding='UTF-8'?>\n");
         print("<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>\n");
-
-        // 静的なページを処理
-        foreach($this->staticURL as $url) {
-            $this->createSitemap($url, '', 'daily', 1.0);
-        }
 
         // TOPページを処理
@@ -116,7 +113,12 @@
                              'daily', 1.0);
 
+        // 静的なページを処理
+        foreach ($this->staticURL as $url) {
+            $this->createSitemap($url, '', 'daily', 1.0);
+        }
+
         // 編集可能ページを処理
         $editablePages = $this->getEditablePage($this->arrPageList);
-        foreach($editablePages as $editablePage) {
+        foreach ($editablePages as $editablePage) {
             $this->createSitemap($editablePage['url'],
                                  $this->date2W3CDatetime($editablePage['update_date']));
@@ -125,22 +127,13 @@
         // 商品一覧ページを処理
         $products = $this->getAllProducts();
-        foreach($products as $product) {
+        foreach ($products as $product) {
             $this->createSitemap($product['url'], '', 'daily');
-        }
-        $mobileProducts = $this->getAllProducts(true);
-        foreach($mobileProducts as $mobileProduct) {
-            $this->createSitemap($mobileProduct['url'], '', 'daily');
         }
 
         // 商品詳細ページを処理
         $details = $this->getAllDetail();
-        foreach($details as $detail) {
+        foreach ($details as $detail) {
             $this->createSitemap($detail['url'],
                                  $this->date2W3CDatetime($detail['update_date']));
-        }
-        $mobileDetails = $this->getAllDetail(true);
-        foreach($mobileDetails as $mobileDetail) {
-            $this->createSitemap($mobileDetail['url'], 
-                                 $this->date2W3CDatetime($mobileDetail['update_date']));
         }
 
@@ -192,7 +185,6 @@
     function getTopPage($pageData) {
         $arrRet = array();
-        foreach($pageData as $page) {
+        foreach ($pageData as $page) {
             if ($page['page_id'] == "1") {
-                $page['url'] = SITE_URL . $page['url'];
                 $arrRet[0] = $page;
                 return $arrRet;
@@ -209,9 +201,7 @@
     function getEditablePage($pageData) {
         $arrRet = array();
-        $i = 0;
-        foreach($pageData as $page) {
+        foreach ($pageData as $page) {
             if ($page['page_id'] > 4) {
-                $arrRet[$i] = $page;
-                $i++;
+                $arrRet[] = $page;
             }
         }
@@ -222,22 +212,25 @@
      * すべての商品一覧ページを取得する.
      *
-     * @param boolean $isMobile モバイルページを取得する場合 true
      * @return array 検索エンジンからアクセス可能な商品一覧ページの情報
      */
-    function getAllProducts($isMobile = false) {
+    function getAllProducts() {
+        
+        // XXX: 商品登録の無いカテゴリーは除外する方が良い気もする
         $conn = new SC_DBConn();
         $sql = "SELECT category_id FROM dtb_category WHERE del_flg = 0";
         $result = $conn->getAll($sql);
 
-        $mobile = "";
-        if ($isMobile) {
-            $mobile = "mobile/";
-        }
-
         $arrRet = array();
-        for ($i = 0; $i < count($result); $i++) {
+        foreach ($result as $row) {
             // :TODO: カテゴリの最終更新日を取得できるようにする
-            $page = array("url" => SITE_URL . sprintf("%sproducts/list.php?category_id=%d", $mobile, $result[$i]['category_id']));
-            $arrRet[$i] = $page;
+            
+            $page["url"] = SITE_URL . 'products/list.php?category_id=' . $row['category_id'];
+            $arrRet[] = $page;
+            
+            // モバイルサイト
+            if (USE_MOBILE !== false) {
+                $page["url"] = MOBILE_SITE_URL . 'products/list.php?category_id=' . $row['category_id'];
+                $arrRet[] = $page;
+            }
         }
         return $arrRet;
@@ -247,22 +240,24 @@
      * すべての商品詳細ページを取得する.
      *
-     * @param boolean $isMobile モバイルページを取得する場合 true
      * @return array 検索エンジンからアクセス可能な商品詳細ページの情報
      */
-    function getAllDetail($isMobile = false) {
+    function getAllDetail() {
         $conn = new SC_DBConn();
         $sql = "SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1";
         $result = $conn->getAll($sql);
 
-        $mobile = "";
-        if ($isMobile) {
-            $mobile = "mobile/";
-        }
-
         $arrRet = array();
-        for ($i = 0; $i < count($result); $i++) {
-            $page = array("url" => SITE_URL. sprintf("%sproducts/detail.php?product_id=%d", $mobile, $result[$i]['product_id']),
-                          "update_date" => $result[$i]['update_date']);
-            $arrRet[$i] = $page;
+        foreach ($result as $row) {
+            
+            $page["update_date"] = $row['update_date'];
+            
+            $page["url"] = SITE_URL . substr(DETAIL_P_HTML, strlen(URL_DIR)) . $row['product_id'];
+            $arrRet[] = $page;
+            
+            // モバイルサイト
+            if (USE_MOBILE !== false) {
+                $page["url"] = SITE_URL . substr(MOBILE_DETAIL_P_HTML, strlen(URL_DIR)) . $row['product_id'];
+                $arrRet[] = $page;
+            }
         }
         return $arrRet;
@@ -278,24 +273,24 @@
      */
     function getPageData($where = '', $arrVal = ''){
-        $objDBConn = new SC_DbConn;		// DB操作オブジェクト
-        $sql = "";						// データ取得SQL生成用
-        $arrRet = array();				// データ取得用
+        $objDBConn = new SC_DbConn;     // DB操作オブジェクト
+        $sql = "";                      // データ取得SQL生成用
+        $arrRet = array();              // データ取得用
 
         // SQL生成(url と update_date 以外は不要？)
         $sql .= " SELECT";
-        $sql .= " page_id";				// ページID
-        $sql .= " ,page_name";			// 名称
-        $sql .= " ,url";				// URL
-        $sql .= " ,php_dir";			// php保存先ディレクトリ
-        $sql .= " ,tpl_dir";			// tpl保存先ディdレクトリ
-        $sql .= " ,filename";			// ファイル名称
-        $sql .= " ,header_chk ";		// ヘッダー使用FLG
-        $sql .= " ,footer_chk ";		// フッター使用FLG
-        $sql .= " ,author";				// authorタグ
-        $sql .= " ,description";		// descriptionタグ
-        $sql .= " ,keyword";			// keywordタグ
-        $sql .= " ,update_url";			// 更新URL
-        $sql .= " ,create_date";		// データ作成日
-        $sql .= " ,update_date";		// データ更新日
+        $sql .= " page_id";             // ページID
+        $sql .= " ,page_name";          // 名称
+        $sql .= " ,url";                // URL
+        $sql .= " ,php_dir";            // php保存先ディレクトリ
+        $sql .= " ,tpl_dir";            // tpl保存先ディdレクトリ
+        $sql .= " ,filename";           // ファイル名称
+        $sql .= " ,header_chk ";        // ヘッダー使用FLG
+        $sql .= " ,footer_chk ";        // フッター使用FLG
+        $sql .= " ,author";             // authorタグ
+        $sql .= " ,description";        // descriptionタグ
+        $sql .= " ,keyword";            // keywordタグ
+        $sql .= " ,update_url";         // 更新URL
+        $sql .= " ,create_date";        // データ作成日
+        $sql .= " ,update_date";        // データ更新日
         $sql .= " FROM ";
         $sql .= "     dtb_pagelayout";
@@ -306,7 +301,19 @@
         }
 
-        $sql .= " ORDER BY 	page_id";
-
-        return $objDBConn->getAll($sql, $arrVal);
+        $sql .= " ORDER BY page_id";
+
+        $pageData = $objDBConn->getAll($sql, $arrVal);
+        
+        // URL にプロトコルの記載が無い場合、SITE_URL を前置する。
+        foreach (array_keys($pageData) as $key) {
+            $page =& $pageData[$key];
+            if (!preg_match('|^https?://|i', $page['url'])) {
+                $page['url'] = SITE_URL . $page['url'];
+            }
+            $page['url'] = preg_replace('|/' . preg_quote(DIR_INDEX_FILE) . '$|', '/' . DIR_INDEX_URL, $page['url']);
+        }
+        unset($page);
+        
+        return $pageData;
     }
 
Index: tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_CategoryList.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 18609)
@@ -70,4 +70,7 @@
      */
     function mobileProcess() {
+        // カテゴリIDの正当性チェック
+        $this->lfCheckCategoryId();
+        
         $objView = new SC_MobileView();
 
@@ -92,4 +95,17 @@
     }
 
+    /* カテゴリIDの正当性チェック */
+    function lfCheckCategoryId() {
+        $objDb = new SC_Helper_DB_Ex();
+        $category_id = $_POST['category_id'] ? $_POST['category_id'] : $_GET['category_id'];
+        if (!defined('MOBILE_SITE') && !isset($_REQUEST['category_id']))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+        if ($category_id
+                && (!SC_Utils_Ex::sfIsInt($category_id)
+                || SC_Utils_Ex::sfIsZeroFilling($category_id)
+                || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')))
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+    }
+
     /**
      * 選択されたカテゴリーとその子カテゴリーの情報を取得し、
@@ -107,5 +123,5 @@
         $category_id = $arrCategory_id[0];
         if ($category_id == 0) {
-            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
         }
 
@@ -133,5 +149,5 @@
 
         if (!isset($arrCategory)) {
-            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
         }
 
Index: tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_List.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_List.php	(revision 18609)
@@ -37,11 +37,26 @@
 
     /** テンプレートクラス名1 */
-    var $tpl_class_name1;
+    var $tpl_class_name1 = array();
 
     /** テンプレートクラス名2 */
-    var $tpl_class_name2;
+    var $tpl_class_name2 = array();
 
     /** JavaScript テンプレート */
     var $tpl_javascript;
+
+    var $orderby;
+
+    var $mode;
+
+    /** 検索条件(内部データ) */
+    var $arrSearchData = array();
+
+    /** 検索条件(表示用) */
+    var $arrSearch = array();
+
+    var $tpl_subtitle = '';
+
+    /** ランダム文字列 **/
+    var $tpl_rnd = '';
 
     // }}}
@@ -61,8 +76,4 @@
         $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date");
         $this->arrPRODUCTLISTMAX = $masterData->getMasterData("mtb_product_list_max");
-
-        $this->tpl_class_name1 = array();
-        $this->tpl_class_name2 = array();
-        $this->allowClientCache();
     }
 
@@ -73,74 +84,47 @@
      */
     function process() {
-        $objView = new SC_SiteView();
+        $this->lfLoadParam();
+
+        $objView = new SC_SiteView(!$this->inCart);
         $conn = new SC_DBConn();
         $objDb = new SC_Helper_DB_Ex();
 
-        //表示件数の選択
-        if(isset($_POST['disp_number'])
-           && SC_Utils_Ex::sfIsInt($_POST['disp_number'])) {
-            $this->disp_number = $_POST['disp_number'];
-        } else {
-            //最小表示件数を選択
-            $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX));
-        }
-
-        //表示順序の保存
-        $this->orderby = isset($_POST['orderby']) ? $_POST['orderby'] : "";
-
-        // GETのカテゴリIDを元に正しいカテゴリIDを取得する。
-        $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']);
-
-        if (!isset($_GET['mode'])) $_GET['mode'] = "";
-        if (!isset($_GET['name'])) $_GET['name'] = "";
-        if (!isset($_POST['orderby'])) $_POST['orderby'] = "";
-        if (empty($arrCategory_id)) $arrCategory_id = array("0");
-
         // タイトル編集
-        $tpl_subtitle = "";
-        if ($_GET['mode'] == 'search') {
-            $tpl_subtitle = "検索結果";
-        } elseif (empty($arrCategory_id[0])) {
-            $tpl_subtitle = "全商品";
-        } else {
-            $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
-            $tpl_subtitle = $arrFirstCat['name'];
+        if ($this->mode == 'search') {
+            $this->tpl_subtitle = "検索結果";
+        } elseif ($this->arrSearchData['category_id'] == 0) {
+            $this->tpl_subtitle = "全商品";
+        } else {
+            $arrCat = $objDb->sfGetCat($this->arrSearchData['category_id']);
+            $this->tpl_subtitle = $arrCat['name'];
         }
 
         $objQuery = new SC_Query();
-        $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id);
-
-        // 以下の条件でBEST商品を表示する
-        // ・BEST最大数の商品が登録されている。
-        // ・カテゴリIDがルートIDである。
-        // ・検索モードでない。
-        if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) {
-            // 商品TOPの表示処理
-            $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]);
-            $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);
-        } else {
-            if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){
-                // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す
-                $arrCategory_id = array(0);
-            }
-
-            // 商品一覧の表示処理
-            $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_POST['orderby']);
-
-            // 検索条件を画面に表示
-            // カテゴリー検索条件
-            if (strlen($_GET['category_id']) == 0) {
-                $arrSearch['category'] = "指定なし";
-            }else{
-                $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", $arrCategory_id);
-                $arrSearch['category'] = $arrCat;
-            }
-
-            // 商品名検索条件
-            if ($_GET['name'] === "") {
-                $arrSearch['name'] = "指定なし";
-            }else{
-                $arrSearch['name'] = $_GET['name'];
-            }
+        $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id']));
+
+        // 商品一覧の表示処理
+        $this->lfDispProductsList();
+
+        // 検索条件を画面に表示
+        // カテゴリー検索条件
+        if ($this->arrSearchData['category_id'] == 0) {
+            $this->arrSearch['category'] = "指定なし";
+        } else {
+            $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($this->arrSearchData['category_id']));
+            $this->arrSearch['category'] = $arrCat;
+        }
+
+        // メーカー検索条件
+        if (strlen($this->arrSearchData['maker_id']) == 0) {
+            $this->arrSearch['maker'] = "指定なし";
+        } else {
+            $this->arrSearch['maker'] = $conn->getOne("SELECT name FROM dtb_maker WHERE maker_id = ?", $this->arrSearchData['maker_id']);
+        }
+
+        // 商品名検索条件
+        if (strlen($this->arrSearchData['name']) == 0) {
+            $this->arrSearch['name'] = "指定なし";
+        } else {
+            $this->arrSearch['name'] = $this->arrSearchData['name'];
         }
 
@@ -149,46 +133,47 @@
         $layout->sfGetPageLayout($this, false, "products/list.php");
 
-        if(isset($_POST['mode']) && $_POST['mode'] == "cart"
-           && $_POST['product_id'] != "") {
-
-            // 値の正当性チェック
-            if(!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {
+        foreach ($this->arrProducts as $arrProduct) {
+            $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});\n";
+        }
+        
+        if ($this->inCart) {
+            // 商品IDの正当性チェック
+            if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) {
                 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-            } else {
-                // 入力値の変換
-                $this->arrErr = $this->lfCheckError($_POST['product_id']);
-                if(count($this->arrErr) == 0) {
-                    $objCartSess = new SC_CartSession();
-                    $classcategory_id = "classcategory_id". $_POST['product_id'];
-                    $classcategory_id1 = $_POST[$classcategory_id. '_1'];
-                    $classcategory_id2 = $_POST[$classcategory_id. '_2'];
-                    $quantity = "quantity". $_POST['product_id'];
+            }
+            $product_id = $this->arrForm['product_id'];
+            // 入力内容のチェック
+            $arrErr = $this->lfCheckError($product_id);
+            if (count($arrErr) == 0) {
+                $classcategory_id1 = $this->arrForm['classcategory_id1'];
+                $classcategory_id2 = $this->arrForm['classcategory_id2'];
                     // 規格1が設定されていない場合
-                    if(!$this->tpl_classcat_find1[$_POST['product_id']]) {
+                if (!$this->tpl_classcat_find1[$product_id]) {
                         $classcategory_id1 = '0';
                     }
                     // 規格2が設定されていない場合
-                    if(!$this->tpl_classcat_find2[$_POST['product_id']]) {
+                if (!$this->tpl_classcat_find2[$product_id]) {
                         $classcategory_id2 = '0';
                     }
-                    $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
-                    $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
+                $objCartSess = new SC_CartSession();
+                $objCartSess->addProduct(array($product_id, $classcategory_id1, $classcategory_id2), $this->arrForm['quantity']);
                     $this->sendRedirect($this->getLocation(URL_CART_TOP));
                     exit;
+            }
+            foreach (array_keys($this->arrProducts) as $key) {
+                $arrProduct =& $this->arrProducts[$key];
+                if ($arrProduct['product_id'] == $product_id) {
+                    $arrProduct['classcategory_id1'] = $this->arrForm['classcategory_id1'];
+                    $arrProduct['classcategory_id2'] = $this->arrForm['classcategory_id2'];
+                    $arrProduct['quantity'] = $this->arrForm['quantity'];
+                    $arrProduct['arrErr'] = $arrErr;
+                    $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']}, '{$this->arrForm['classcategory_id2']}');\n";
                 }
             }
         }
-
-        $this->tpl_subtitle = $tpl_subtitle;
-
-        // 支払方法の取得
-        $this->arrPayment = $this->lfGetPayment();
-        // 入力情報を渡す
-        $this->arrForm = $_POST;
-
-        $this->lfConvertParam();
-
-        $this->category_id = $arrCategory_id[0];
-        $this->arrSearch = $arrSearch;
+        $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
+        $this->tpl_onload .= 'fnOnLoad(); ';
+
+        $this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
 
         $objView->assignobj($this);
@@ -213,111 +198,44 @@
      */
     function mobileProcess() {
+        $this->lfLoadParam();
+
         $objView = new SC_MobileView();
         $conn = new SC_DBConn();
         $objDb = new SC_Helper_DB_Ex();
 
-        //表示件数の選択
-        if(isset($_REQUEST['disp_number'])
-           && SC_Utils_Ex::sfIsInt($_REQUEST['disp_number'])) {
-            $this->disp_number = $_REQUEST['disp_number'];
-        } else {
-            //最小表示件数を選択
-            $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX));
-        }
-
-        //表示順序の保存
-        $this->orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : "";
-
-        // GETのカテゴリIDを元に正しいカテゴリIDを取得する。
-        $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']);
-
-
         // タイトル編集
-        $tpl_subtitle = "";
         $tpl_search_mode = false;
 
-        if (!isset($_GET['mode'])) $_GET['mode'] = "";
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-        if (!isset($_GET['name'])) $_GET['name'] = "";
-        if (!isset($_REQUEST['orderby'])) $_REQUEST['orderby'] = "";
-        if (empty($arrCategory_id)) $arrCategory_id = array("0");
-
-        if($_GET['mode'] == 'search'){
-            $tpl_subtitle = "検索結果";
+        if ($this->mode == 'search') {
+            $this->tpl_subtitle = "検索結果";
             $tpl_search_mode = true;
-        }elseif (empty($arrCategory_id[0])) {
-            $tpl_subtitle = "全商品";
-        }else{
-            $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
-            $tpl_subtitle = $arrFirstCat['name'];
+        } elseif ($this->arrSearchData['category_id'] == 0) {
+            $this->tpl_subtitle = "全商品";
+        } else {
+            $arrCat = $objDb->sfGetCat($this->arrSearchData['category_id']);
+            $this->tpl_subtitle = $arrCat['name'];
         }
 
         $objQuery = new SC_Query();
-        $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id);
-
-        // 以下の条件でBEST商品を表示する
-        // ・BEST最大数の商品が登録されている。
-        // ・カテゴリIDがルートIDである。
-        // ・検索モードでない。
-        if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) {
-            // 商品TOPの表示処理
-
-            $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]);
-            $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);
-        } else {
-            if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){
-                // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す
-                $arrCategory_id = array("");
-            }
+        $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id']));
 
             // 商品一覧の表示処理
-            $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_REQUEST['orderby']);
+        $this->lfDispProductsList();
 
             // 検索条件を画面に表示
             // カテゴリー検索条件
-            if (strlen($_GET['category_id']) == 0) {
-                $arrSearch['category'] = "指定なし";
-            }else{
+        if ($this->arrSearchData['category_id'] == 0) {
+            $this->arrSearch['category'] = "指定なし";
+        } else {
                 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
-                $arrSearch['category'] = $arrCat;
+            $this->arrSearch['category'] = $arrCat;
             }
 
             // 商品名検索条件
-            if ($_GET['name'] === "") {
-                $arrSearch['name'] = "指定なし";
-            }else{
-                $arrSearch['name'] = $_GET['name'];
-            }
-        }
-
-        if($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
-            // 値の正当性チェック
-            if(!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !SC_Utils_Ex::sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {
-                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true);
+        if ($this->arrForm['name'] === "") {
+            $this->arrSearch['name'] = "指定なし";
             } else {
-                // 入力値の変換
-                $this->arrErr = $this->lfCheckError($_POST['product_id']);
-                if(count($this->arrErr) == 0) {
-                    $objCartSess = new SC_CartSession();
-                    $classcategory_id = "classcategory_id". $_POST['product_id'];
-                    $classcategory_id1 = $_POST[$classcategory_id. '_1'];
-                    $classcategory_id2 = $_POST[$classcategory_id. '_2'];
-                    $quantity = "quantity". $_POST['product_id'];
-                    // 規格1が設定されていない場合
-                    if(!$this->tpl_classcat_find1[$_POST['product_id']]) {
-                        $classcategory_id1 = '0';
+            $this->arrSearch['name'] = $this->arrForm['name'];
                     }
-                    // 規格2が設定されていない場合
-                    if(!$this->tpl_classcat_find2[$_POST['product_id']]) {
-                        $classcategory_id2 = '0';
-                    }
-                    $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
-                    $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
-                    $this->sendRedirect(MOBILE_URL_CART_TOP, array(session_name() => session_id()));
-                    exit;
-                }
-            }
-        }
-
 
         // ページ送り機能用のURLを作成する。
@@ -339,14 +257,6 @@
         }
 
-        $this->tpl_subtitle = $tpl_subtitle;
         $this->tpl_search_mode = $tpl_search_mode;
 
-        // 支払方法の取得
-        $this->arrPayment = $this->lfGetPayment();
-        // 入力情報を渡す
-        $this->arrForm = $_POST;
-
-        $this->category_id = $arrCategory_id[0];
-        $this->arrSearch = $arrSearch;
         $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl";
 
@@ -364,50 +274,69 @@
     }
 
-    /* カテゴリIDがルートかどうかの判定 */
-    function lfIsRootCategory($category_id) {
-        $objQuery = new SC_Query();
-        $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));
-        if($level == 1) {
-            return true;
-        }
-        return false;
+    /**
+     * カテゴリIDの取得
+     *
+     * @return integer カテゴリID
+     */
+    function lfGetCategoryId($category_id) {
+        $objDb = new SC_Helper_DB_Ex();
+        
+        // 指定なしの場合、0 を返す
+        if (
+            strlen($category_id) == 0
+            || (String) $category_id == '0'
+        ) {
+            return 0;
+        }
+        
+        // 正当性チェック
+        if (
+            !SC_Utils_Ex::sfIsInt($category_id)
+                || SC_Utils_Ex::sfIsZeroFilling($category_id)
+            || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')
+        ) {
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+    }
+        
+        // 指定されたカテゴリIDを元に正しいカテゴリIDを取得する。
+        $arrCategory_id = $objDb->sfGetCategoryId('', $category_id);
+        
+        if (empty($arrCategory_id)) {
+            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
+        }
+        
+        return $arrCategory_id[0];
     }
 
     /* 商品一覧の表示 */
-    function lfDispProductsList($category_id, $name, $disp_num, $orderby) {
+    function lfDispProductsList() {
 
         $objQuery = new SC_Query();
         $objDb = new SC_Helper_DB_Ex();
-        $this->tpl_pageno = defined("MOBILE_SITE") ? @$_GET['pageno'] : @$_POST['pageno'];
         $arrval = array();
         $arrval_order = array();
         $arrval_category = array();
-
+        
         // カテゴリからのWHERE文字列取得
-
-        if ( $category_id ) {
-            list($tmp_where, $arrval_category) = $objDb->sfGetCatWhere($category_id);
-            if (strlen($tmp_where) >= 1) {
-                $where_category = "AND $tmp_where";
-                //並び替え用（MySQL4.1対応）
-                $where_category_order = "AND " ."T2.".trim($tmp_where);
-            }
-        }
-
+        if ($this->arrSearchData['category_id'] != 0) {
+            list($where_category, $arrval_category) = $objDb->sfGetCatWhere($this->arrSearchData['category_id']);
+        }
+        
         // ▼対象商品IDの抽出
         // 商品検索条件の作成（未削除、表示）
         $where = "del_flg = 0 AND status = 1 ";
-
+        
         // 在庫無し商品の非表示
         if (NOSTOCK_HIDDEN === true) {
             $where .= ' AND (stock_max >= 1 OR stock_unlimited_max = 1)';
         }
-
+        
         if (strlen($where_category) >= 1) {
-            $where.= " $where_category";
+            $where.= " AND $where_category";
             $arrval = array_merge($arrval, $arrval_category);
         }
 
         // 商品名をwhere文に
+        $name = $this->arrSearchData['name'];
         $name = ereg_replace(",", "", $name);// XXX
         // 全角スペースを半角スペースに変換
@@ -417,5 +346,5 @@
         // 分割したキーワードを一つずつwhere文に追加
         foreach ($names as $val) {
-            if ( strlen($val) > 0 ){
+            if ( strlen($val) > 0 ) {
                 $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
                 $ret = SC_Utils_Ex::sfManualEscape($val);
@@ -425,7 +354,13 @@
         }
 
+        // メーカーらのWHERE文字列取得
+        if ($this->arrSearchData['maker_id']) {
+            $where .= " AND maker_id = ? ";
+            $arrval[] = $this->arrSearchData['maker_id'];
+        }
+        
+        // 対象商品IDの抽出
         $arrProduct_id = $objQuery->getCol('vw_products_allclass AS allcls', 'DISTINCT product_id', $where, $arrval);
-        // ▲対象商品IDの抽出
-
+        
         // 行数の取得
         $linemax = count($arrProduct_id);
@@ -434,12 +369,12 @@
 
         // ページ送りの取得
-        $this->objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);
-
+        $urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
+        $this->objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $this->disp_number, "fnNaviPage", NAVI_PMAX, $urlParam);
         $strnavi = $this->objNavi->strnavi;
-        $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi);
+
         // 表示文字列
         $this->tpl_strnavi = empty($strnavi) ? "&nbsp;" : $strnavi;
         $startno = $this->objNavi->start_row;                 // 開始行
-
+        
         // ▼商品詳細取得
         $col = <<< __EOS__
@@ -464,5 +399,4 @@
             ,point_rate
             ,sale_limit
-            ,sale_unlimited
             ,deliv_date_id
             ,deliv_fee
@@ -471,7 +405,7 @@
             ,del_flg
 __EOS__;
-
+        
         $from = "vw_products_allclass_detail AS alldtl";
-
+        
         // WHERE 句
         $where = '0=0';
@@ -482,14 +416,14 @@
             $where .= ' AND 0<>0';
         }
-
-        //表示順序
-        switch($orderby) {
-
-            //販売価格順
+        
+        // 表示順序
+        switch ($this->orderby) {
+
+            // 販売価格順
             case 'price':
                 $order = "price02_min, product_id";
                 break;
 
-            //新着順
+            // 新着順
             case 'date':
                 $order = "create_date DESC, product_id";
@@ -497,4 +431,10 @@
 
             default:
+                if (strlen($where_category) >= 1) {
+                    $dtb_product_categories = "(SELECT * FROM dtb_product_categories WHERE $where_category)";
+                    $arrval_order = array_merge($arrval_category, $arrval_category);
+                } else {
+                    $dtb_product_categories = 'dtb_product_categories';
+                }
                 $order = <<< __EOS__
                     (
@@ -502,9 +442,8 @@
                              T3.rank
                         FROM
-                            dtb_product_categories T2
+                            $dtb_product_categories T2
                             JOIN dtb_category T3
                                 USING (category_id)
                         WHERE T2.product_id = alldtl.product_id
-                            $where_category_order
                         ORDER BY T3.rank DESC, T2.rank DESC
                         LIMIT 1
@@ -514,9 +453,8 @@
                             T2.rank
                         FROM
-                            dtb_product_categories T2
+                            $dtb_product_categories T2
                             JOIN dtb_category T3
                                 USING (category_id)
                         WHERE T2.product_id = alldtl.product_id
-                            $where_category_order
                         ORDER BY T3.rank DESC, T2.rank DESC
                         LIMIT 1
@@ -524,174 +462,48 @@
                     ,product_id
 __EOS__;
-                $arrval_order = array_merge($arrval_category, $arrval_category);
                 break;
         }
-
+        
         // 取得範囲の指定(開始行番号、行数のセット)
-        $objQuery->setlimitoffset($disp_num, $startno);
+        $objQuery->setlimitoffset($this->disp_number, $startno);
         // 表示順序
         $objQuery->setorder($order);
-
+        
         // 検索結果の取得
         $this->arrProducts = $objQuery->select($col, $from, $where, $arrval_order);
         // ▲商品詳細取得
-
-        // 規格名一覧
-        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
-        // 規格分類名一覧
-        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+        
+        $arrProductId = array();
         // 規格セレクトボックス設定
-        if($disp_num == 15) {
-            for($i = 0; $i < count($this->arrProducts); $i++) {
-                $this->lfMakeSelect($this->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
-            }
-        }
-    }
-
-    /* 規格セレクトボックスの作成 */
-    function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
-
-        $classcat_find1 = false;
-        $classcat_find2 = false;
-        // 在庫ありの商品の有無
-        $stock_find = false;
-
-        // 商品規格情報の取得
-        $arrProductsClass = $this->lfGetProductsClass($product_id);
-
-        // 規格1クラス名の取得
-        $this->tpl_class_name1[$product_id] =
-            isset($arrClassName[$arrProductsClass[0]['class_id1']])
-            ? $arrClassName[$arrProductsClass[0]['class_id1']]
-            : "";
-
-        // 規格2クラス名の取得
-        $this->tpl_class_name2[$product_id] =
-            isset($arrClassName[$arrProductsClass[0]['class_id2']])
-            ? $arrClassName[$arrProductsClass[0]['class_id2']]
-            : "";
-
-        // すべての組み合わせ数
-        $count = count($arrProductsClass);
-
-        $classcat_id1 = "";
-
-        $arrSele = array();
-        $arrList = array();
-
-        $list_id = 0;
-        $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'";
-        $arrVal[0] = "\tval". $product_id. "_0 = new Array(''";
-
-        for ($i = 0; $i < $count; $i++) {
-            // 在庫のチェック
-            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
-                continue;
-            }
-
-            $stock_find = true;
-
-            // 規格1のセレクトボックス用
-            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
-                $arrList[$list_id].=");\n";
-                $arrVal[$list_id].=");\n";
-                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
-                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
-                $list_id++;
-
-                $arrList[$list_id] = "";
-                $arrVal[$list_id] = "";
-            }
-
-            // 規格2のセレクトボックス用
-            $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
-
-            // セレクトボックス表示値
-            if($arrList[$list_id] == "") {
-                $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'";
-            } else {
-                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
-            }
-
-            // セレクトボックスPOST値
-            if($arrVal[$list_id] == "") {
-                $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
-            } else {
-                $arrVal[$list_id].= ", '".$classcat_id2."'";
-            }
-        }
-
-        $arrList[$list_id].=");\n";
-        $arrVal[$list_id].=");\n";
-
+        foreach ($this->arrProducts as $product) {
+            $arrProductId[] = $product['product_id'];
+            // 購入制限数を取得
+            $this->lfGetSaleLimit($product);
+        }
+        
+        require_once CLASS_PATH . 'SC_Product.php';
+        $objProduct = new SC_Product($arrProductId);
+        
+        // 規格1クラス名
+        $this->tpl_class_name1 = $objProduct->className1;
+
+        // 規格2クラス名
+        $this->tpl_class_name2 = $objProduct->className2;
+        
         // 規格1
-        $this->arrClassCat1[$product_id] = $arrSele;
-
-        $lists = "\tlists".$product_id. " = new Array(";
-        $no = 0;
-        foreach($arrList as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $lists.= ",list". $product_id. "_". $no;
-            } else {
-                $lists.= "list". $product_id. "_". $no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.= $lists.");\n";
-
-        $vals = "\tvals".$product_id. " = new Array(";
-        $no = 0;
-        foreach($arrVal as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $vals.= ",val". $product_id. "_". $no;
-            } else {
-                $vals.= "val". $product_id. "_". $no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.= $vals.");\n";
-
-        // 選択されている規格2ID
-        $classcategory_id = "classcategory_id". $product_id;
-
-        $classcategory_id_2 = $classcategory_id . "_2";
-        if (!isset($classcategory_id_2)) $classcategory_id_2 = "";
-        if (!isset($_POST[$classcategory_id_2]) || !is_numeric($_POST[$classcategory_id_2])) $_POST[$classcategory_id_2] = "";
-
-        $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', "
-            . "'" . $classcategory_id_2 . "',"
-            . "'" . $product_id . "',"
-            . "'" . $_POST[$classcategory_id_2] ."'); ";
+        $this->arrClassCat1 = $objProduct->classCats1;
 
         // 規格1が設定されている
-        if($arrProductsClass[0]['classcategory_id1'] != '0') {
-            $classcat_find1 = true;
-        }
-
+        $this->tpl_classcat_find1 = $objProduct->classCat1_find;
         // 規格2が設定されている
-        if($arrProductsClass[0]['classcategory_id2'] != '0') {
-            $classcat_find2 = true;
-        }
-
-        $this->tpl_classcat_find1[$product_id] = $classcat_find1;
-        $this->tpl_classcat_find2[$product_id] = $classcat_find2;
-        $this->tpl_stock_find[$product_id] = $stock_find;
-    }
-
-    /* 商品規格情報の取得 */
-    function lfGetProductsClass($product_id) {
-        $arrRet = array();
-        if(SC_Utils_Ex::sfIsInt($product_id)) {
-            // 商品規格取得
-            $objQuery = new SC_Query();
-            $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
-            $table = "vw_product_class AS prdcls";
-            $where = "product_id = ?";
-            $objQuery->setorder("rank1 DESC, rank2 DESC");
-            $arrRet = $objQuery->select($col, $table, $where, array($product_id));
-        }
-        return $arrRet;
+        $this->tpl_classcat_find2 = $objProduct->classCat2_find;
+
+        $this->tpl_stock_find = $objProduct->stock_find;
+
+        $productsClassCategories = $objProduct->classCategories;
+        
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $objJson = new Services_JSON();
+        $this->tpl_javascript .= 'productsClassCategories = ' . $objJson->encode($productsClassCategories) . '; ';
     }
 
@@ -700,41 +512,54 @@
 
         // 入力データを渡す。
-        $objErr = new SC_CheckError();
-
-        $classcategory_id1 = "classcategory_id". $id. "_1";
-        $classcategory_id2 = "classcategory_id". $id. "_2";
-        $quantity = "quantity". $id;
+        $objErr = new SC_CheckError($this->arrForm);
+
         // 複数項目チェック
         if ($this->tpl_classcat_find1[$id]) {
-            $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+            $objErr->doFunc(array("規格1", 'classcategory_id1', INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
         }
         if ($this->tpl_classcat_find2[$id]) {
-            $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
-        }
-        $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+            $objErr->doFunc(array("規格2", 'classcategory_id2', INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+        }
+        $objErr->doFunc(array("数量", 'quantity', INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
 
         return $objErr->arrErr;
     }
 
-    //支払方法の取得
-    //payment_id    1:代金引換　2:銀行振り込み　3:現金書留
-    function lfGetPayment() {
-        $objQuery = new SC_Query;
-        $col = "payment_id, rule, payment_method";
-        $from = "dtb_payment";
-        $where = "del_flg = 0";
-        $order = "payment_id";
-        $objQuery->setorder($order);
-        $arrRet = $objQuery->select($col, $from, $where);
-        return $arrRet;
-    }
-
-    function lfconvertParam () {
-        foreach ($this->arrForm as $key => $value) {
-            if (preg_match('/^quantity[0-9]+/', $key)) {
-                 $this->arrForm[$key]
-                    = htmlspecialchars($this->arrForm[$key], ENT_QUOTES, CHAR_CODE);
-            }
-        }
+    // 購入制限数の設定
+    // XXX 標準実装では「tpl_sale_limit」は利用されていないようである。カスタマイズ用?
+    function lfGetSaleLimit($arrProduct) {
+        //在庫が無限または購入制限値が設定値より大きい場合
+        if (!SC_Utils_Ex::sfIsInt($arrProduct['sale_limit']) || $arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+            $this->tpl_sale_limit[$arrProduct['product_id']] = SALE_LIMIT_MAX;
+        } else {
+            $this->tpl_sale_limit[$arrProduct['product_id']] = $arrProduct['sale_limit'];
+        }
+    }
+
+    /**
+     * パラメータの読み込み
+     *
+     * @return void
+     */
+    function lfLoadParam() {
+        $this->arrForm = $_GET;
+        
+        $this->mode = $this->arrForm['mode'];
+        $this->arrSearchData['category_id'] = $this->lfGetCategoryId($this->arrForm['category_id']);
+        $this->arrSearchData['maker_id'] = $this->arrForm['maker_id'];
+        $this->arrSearchData['name'] = $this->arrForm['name'];
+        $this->orderby = $this->arrForm['orderby'];
+        // 表示件数
+        if (
+            isset($this->arrForm['disp_number'])
+            && SC_Utils_Ex::sfIsInt($this->arrForm['disp_number'])
+        ) {
+            $this->disp_number = $this->arrForm['disp_number'];
+        } else {
+            //最小表示件数を選択
+            $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX));
+        }
+        $this->tpl_pageno = $this->arrForm['pageno'];
+        $this->inCart = strlen($this->arrForm['product_id']) >= 1;
     }
 }
Index: tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Review.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Review.php	(revision 17383)
+++ tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Review.php	(revision 18609)
@@ -61,4 +61,5 @@
         $this->arrSex = $masterData->getMasterData("mtb_sex");
         $this->arrReviewDenyURL = $masterData->getMasterData("mtb_review_deny_url");
+        $this->httpCacheControl('nocache');
     }
 
@@ -105,5 +106,5 @@
 
             //エラーチェック
-            if($this->arrErr == ""){
+            if (empty($this->arrErr)) {
                 //重複タイトルでない
                 if($flag == 0){
@@ -138,5 +139,5 @@
             $flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
             //エラーチェック
-            if ($arrErr == ""){
+            if (empty($this->arrErr)) {
                 //重複タイトルでない
                 if($flag == 0) {
@@ -187,5 +188,5 @@
         $objErr->doFunc(array("商品ID", "product_id", INT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("投稿者名", "reviewer_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("URL", "reviewer_url", MTEXT_LEN), array("NO_SPTAB", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK"));
+        $objErr->doFunc(array("投稿者URL", "reviewer_url", MTEXT_LEN), array("NO_SPTAB", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK"));
         $objErr->doFunc(array("おすすめレベル", "recommend_level"), array("SELECT_CHECK"));
         $objErr->doFunc(array("タイトル", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
Index: tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18609)
@@ -78,5 +78,8 @@
      */
     function process() {
-        $objView = new SC_SiteView();
+        // プロダクトIDの正当性チェック
+        $product_id = $this->lfCheckProductId();
+
+        $objView = new SC_SiteView(strlen($_POST['mode']) == 0);
         $objCustomer = new SC_Customer();
         $objQuery = new SC_Query();
@@ -86,4 +89,19 @@
         $helper = new SC_Helper_PageLayout_Ex();
         $helper->sfGetPageLayout($this, false, "products/detail.php");
+
+        // ログイン中のユーザが商品をお気に入りにいれる処理
+        if ($objCustomer->isLoginSuccess() === true && strlen($_POST['mode']) > 0 && $_POST['mode'] == "add_favorite" && strlen($_POST['favorite_product_id']) > 0 ) {
+            // 値の正当性チェック
+            if(!SC_Utils_Ex::sfIsInt($_POST['favorite_product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_POST['favorite_product_id'], "del_flg = 0 AND status = 1")) {
+                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
+                exit;
+            } else {
+                $this->arrErr = $this->lfCheckError();
+                if(count($this->arrErr) == 0) {
+                    $customer_id = $objCustomer->getValue('customer_id');
+                    $this->lfRegistFavoriteProduct($customer_id, $_POST['favorite_product_id']);
+                }
+            }
+        }
 
         // パラメータ管理クラス
@@ -99,27 +117,6 @@
         $this->lfInitFile();
 
-        // 管理ページからの確認の場合は、非公開の商品も表示する。
-        if(isset($_GET['admin']) && $_GET['admin'] == 'on') {
-            SC_Utils_Ex::sfIsSuccess(new SC_Session());
-            $status = true;
-            $where = "del_flg = 0";
-        } else {
-            $status = false;
-            $where = "del_flg = 0 AND status = 1";
-        }
-
-        if(isset($_POST['mode']) && $_POST['mode'] != "") {
-            $tmp_id = $_POST['product_id'];
-        } else {
-            $tmp_id = $_GET['product_id'];
-        }
-
-        // 値の正当性チェック
-        if(!SC_Utils_Ex::sfIsInt($_GET['product_id'])
-                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
-            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-        }
         // ログイン判定
-        if($objCustomer->isLoginSuccess() === true) {
+        if ($objCustomer->isLoginSuccess() === true) {
             //お気に入りボタン表示
             $this->tpl_login = true;
@@ -136,5 +133,5 @@
             if ($rpcnt < CUSTOMER_READING_MAX){
                 //閲覧履歴に新規追加
-                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
             } else {
                 //閲覧履歴の中で一番古いものを削除して新規追加
@@ -146,92 +143,110 @@
                 $objQuery->delete($table, $where, $arrval);
                 //追加
-                lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
             }
         */
         }
 
-
         // 規格選択セレクトボックスの作成
-        $this->lfMakeSelect($tmp_id);
+        $this->lfMakeSelect($product_id);
+
+        require_once CLASS_PATH . 'SC_Product.php';
+        $objProduct = new SC_Product($product_id);
+        // 規格1クラス名
+        $this->tpl_class_name1 = $objProduct->className1[$product_id];
+
+        // 規格2クラス名
+        $this->tpl_class_name2 = $objProduct->className2[$product_id];
+        
+        // 規格1
+        $this->arrClassCat1 = $objProduct->classCats1[$product_id];
+
+        // 規格1が設定されている
+        $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];
+        // 規格2が設定されている
+        $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];
+
+        $this->tpl_stock_find = $objProduct->stock_find[$product_id];
+
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $objJson = new Services_JSON();
+        $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';';
+        $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';
+        $this->tpl_onload .= 'lnOnLoad();';
 
         // 商品IDをFORM内に保持する。
-        $this->tpl_product_id = $tmp_id;
+        $this->tpl_product_id = $product_id;
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
+        $arrErr = array();
+        
         switch($_POST['mode']) {
-        case 'cart':
-            // 入力値の変換
-            $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError();
-            if(count($this->arrErr) == 0) {
-                $objCartSess = new SC_CartSession();
-                $classcategory_id1 = $_POST['classcategory_id1'];
-                $classcategory_id2 = $_POST['classcategory_id2'];
-
-                if (!empty($_POST['gmo_oneclick'])) {
-                    $objCartSess->delAllProducts();
-                }
-
-                // 規格1が設定されていない場合
-                if(!$this->tpl_classcat_find1) {
-                    $classcategory_id1 = '0';
-                }
-
-                // 規格2が設定されていない場合
-                if(!$this->tpl_classcat_find2) {
-                    $classcategory_id2 = '0';
-                }
-
-                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
-                $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
-
-                if (!empty($_POST['gmo_oneclick'])) {
-                    $objSiteSess = new SC_SiteSession;
-                    $objSiteSess->setRegistFlag();
-                    $objCartSess->saveCurrentCart($objSiteSess->getUniqId());
-
-                    $this->sendRedirect($this->getLocation(
-                        URL_DIR . 'user_data/gmopg_oneclick_confirm.php', array(), true));
+            case 'cart':
+                // 入力値の変換
+                $this->objFormParam->convParam();
+                $arrErr = $this->lfCheckError();
+                if (count($arrErr) == 0) {
+                    $objCartSess = new SC_CartSession();
+                    $classcategory_id1 = $_POST['classcategory_id1'];
+                    $classcategory_id2 = $_POST['classcategory_id2'];
+
+                    if (!empty($_POST['gmo_oneclick'])) {
+                        $objCartSess->delAllProducts();
+                    }
+
+                    // 規格1が設定されていない場合
+                    if(!$this->tpl_classcat_find1) {
+                        $classcategory_id1 = '0';
+                    }
+
+                    // 規格2が設定されていない場合
+                    if(!$this->tpl_classcat_find2) {
+                        $classcategory_id2 = '0';
+                    }
+
+                    $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
+
+                    if (!empty($_POST['gmo_oneclick'])) {
+                        $objSiteSess = new SC_SiteSession;
+                        $objSiteSess->setRegistFlag();
+                        $objCartSess->saveCurrentCart($objSiteSess->getUniqId());
+
+                        $this->sendRedirect($this->getLocation(
+                            URL_DIR . 'user_data/gmopg_oneclick_confirm.php', array(), true));
+                        exit;
+                    }
+
+                    $this->sendRedirect($this->getLocation(URL_CART_TOP));
                     exit;
                 }
-
-                $this->sendRedirect($this->getLocation(URL_CART_TOP));
-                exit;
-            }
-            break;
-
-        case 'add_favorite':
-            // お気に入りに追加する
-            $this->lfAddFavoriteProduct($objCustomer);
-            break;
-
-        default:
-            break;
-        }
-
-        $objQuery = new SC_Query();
+                break;
+
+            default:
+                break;
+        }
+        $this->arrErr = $arrErr;
+
         // DBから商品情報を取得する。
-        $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = alldtl.product_id) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $tmp_id));
+        $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $product_id));
         $this->arrProduct = $arrRet[0];
 
-        // 商品コードの取得
-        $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
-        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
-        $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
-        $this->arrProductCode = $arrProductCode["product_code"];
-
+        // 購入制限数を取得
+        if (!SC_Utils_Ex::sfIsInt($this->arrProduct['sale_limit']) || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+          $this->tpl_sale_limit = SALE_LIMIT_MAX;
+        } else {
+          $this->tpl_sale_limit = $this->arrProduct['sale_limit'];
+        }
+        
         // サブタイトルを取得
-        $arrCategory_id = $objDb->sfGetCategoryId($arrRet[0]['product_id'],'',$status);
-        $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
-        $this->tpl_subtitle = $arrFirstCat['name'];
-
+        $this->tpl_subtitle = $this->arrProduct['name'];
+        
         // 関連カテゴリを取得
-        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($tmp_id);
-
-        // DBからのデータを引き継ぐ
-        $this->objUpFile->setDBFileList($this->arrProduct);
-        // ファイル表示用配列を渡す
-        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
+        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($product_id);
+        
+        // 画像ファイル指定がない場合の置換処理
+        $this->arrProduct['main_image']
+            = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
+        
+        $this->lfSetFile();
         // 支払方法の取得
         $this->arrPayment = $this->lfGetPayment();
@@ -239,5 +254,5 @@
         $this->arrForm = $this->objFormParam->getFormParamList();
         //レビュー情報の取得
-        $this->arrReview = $this->lfGetReviewData($tmp_id);
+        $this->arrReview = $this->lfGetReviewData($product_id);
         // トラックバック情報の取得
 
@@ -247,13 +262,9 @@
         } else {
             $this->arrTrackbackView = "ON";
-            $this->arrTrackback = $this->lfGetTrackbackData($tmp_id);
-        }
-        $this->trackback_url = TRACKBACK_TO_URL . $tmp_id;
-        // タイトルに商品名を入れる
-        $this->tpl_title = "商品詳細 ". $this->arrProduct["name"];
-        //オススメ商品情報表示
-        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
-        //この商品を買った人はこんな商品も買っています
-        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);
+            $this->arrTrackback = $this->lfGetTrackbackData($product_id);
+        }
+        $this->trackback_url = TRACKBACK_TO_URL . $product_id;
+        //関連商品情報表示
+        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
 
         $this->lfConvertParam();
@@ -290,4 +301,7 @@
      */
     function mobileProcess() {
+        // プロダクトIDの正当性チェック
+        $product_id = $this->lfCheckProductId();
+        
         $objView = new SC_MobileView();
         $objCustomer = new SC_Customer();
@@ -307,18 +321,4 @@
         $this->lfInitFile();
 
-        if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
-        if(!empty($_POST['mode'])) {
-            $tmp_id = $_POST['product_id'];
-        } else {
-            $tmp_id = $_GET['product_id'];
-        }
-
-        // 値の正当性チェック
-        if(!SC_Utils_Ex::sfIsInt($tmp_id)
-                || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, 'del_flg = 0 AND status = 1')) {
-            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-        }
-
         // ログイン判定
         if($objCustomer->isLoginSuccess(true)) {
@@ -337,5 +337,5 @@
                if ($rpcnt < CUSTOMER_READING_MAX){
                //閲覧履歴に新規追加
-               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
                } else {
                //閲覧履歴の中で一番古いものを削除して新規追加
@@ -347,5 +347,5 @@
                $objQuery->delete($table, $where, $arrval);
                //追加
-               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id'));
                }
             */
@@ -354,8 +354,8 @@
 
         // 規格選択セレクトボックスの作成
-        $this->lfMakeSelectMobile($this, $tmp_id);
+        $this->lfMakeSelectMobile($this, $product_id);
 
         // 商品IDをFORM内に保持する。
-        $this->tpl_product_id = $tmp_id;
+        $this->tpl_product_id = $product_id;
 
         switch($_POST['mode']) {
@@ -418,5 +418,4 @@
                 }
 
-                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
                 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
                 $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true);
@@ -431,22 +430,23 @@
         $objQuery = new SC_Query();
         // DBから商品情報を取得する。
-        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
+        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($product_id));
         $this->arrProduct = $arrRet[0];
 
-        // 商品コードの取得
-        $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
-        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
-        $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode);
-        $this->arrProductCode = $arrProductCode["product_code"];
+        // 購入制限数を取得
+        if (!SC_Utils_Ex::sfIsInt($this->arrProduct['sale_limit']) || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+            $this->tpl_sale_limit = SALE_LIMIT_MAX;
+        } else {
+            $this->tpl_sale_limit = $this->arrProduct['sale_limit'];
+        }
 
         // サブタイトルを取得
-        $arrFirstCat = $objDb->sfGetFirstCat($arrRet[0]['category_id']);
-        $tpl_subtitle = $arrFirstCat['name'];
-        $this->tpl_subtitle = $tpl_subtitle;
-
-        // DBからのデータを引き継ぐ
-        $this->objUpFile->setDBFileList($this->arrProduct);
-        // ファイル表示用配列を渡す
-        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
+        $this->tpl_subtitle = $this->arrProduct["name"];
+        
+        // 画像ファイル指定がない場合の置換処理
+        $this->arrProduct['main_image']
+            = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
+        
+        // ファイル情報のセット
+        $this->lfSetFile();
         // 支払方法の取得
         $this->arrPayment = $this->lfGetPayment();
@@ -454,11 +454,9 @@
         $this->arrForm = $this->objFormParam->getFormParamList();
         //レビュー情報の取得
-        $this->arrReview = $this->lfGetReviewData($tmp_id);
+        $this->arrReview = $this->lfGetReviewData($product_id);
         // タイトルに商品名を入れる
         $this->tpl_title = "商品詳細 ". $this->arrProduct["name"];
-        //オススメ商品情報表示
-        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id);
-        //この商品を買った人はこんな商品も買っています
-        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id);
+        //関連商品情報表示
+        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
 
         $objView->assignobj($this);
@@ -466,12 +464,44 @@
     }
 
+    /* プロダクトIDの正当性チェック */
+    function lfCheckProductId() {
+        // 管理機能からの確認の場合は、非公開の商品も表示する。
+        if (isset($_GET['admin']) && $_GET['admin'] == 'on') {
+            SC_Utils_Ex::sfIsSuccess(new SC_Session());
+            $status = true;
+            $where = 'del_flg = 0';
+        } else {
+            $status = false;
+            $where = 'del_flg = 0 AND status = 1';
+        }
+
+        if (defined('MOBILE_SITE')) {
+            if (!isset($_POST['mode'])) $_POST['mode'] = "";
+            if (!empty($_POST['mode'])) {
+                $product_id = $_POST['product_id'];
+            } else {
+                $product_id = $_GET['product_id'];
+            }
+        } else {
+            if(isset($_POST['mode']) && $_POST['mode'] != '') {
+                $product_id = $_POST['product_id'];
+            } else {
+                $product_id = $_GET['product_id'];
+            }
+        }
+
+        $objDb = new SC_Helper_DB_Ex();
+        if(!SC_Utils_Ex::sfIsInt($product_id)
+            || SC_Utils_Ex::sfIsZeroFilling($product_id)
+            || !$objDb->sfIsRecord('dtb_products', 'product_id', (array)$product_id, $where))
+            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
+        return $product_id;
+    }
+
     /* ファイル情報の初期化 */
     function lfInitFile() {
-        $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
         $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
-        $this->objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
             $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);
-            $this->objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
         }
         $this->objUpFile->addFile("商品比較画像", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT);
@@ -480,5 +510,28 @@
 
     /* 規格選択セレクトボックスの作成 */
-    function lfMakeSelect($product_id) {
+    function lfMakeSelect() {
+
+        // 選択されている規格
+        $classcategory_id1
+            = isset($_POST['classcategory_id1']) && is_numeric($_POST['classcategory_id1'])
+            ? $_POST['classcategory_id1']
+            : '';
+
+        $classcategory_id2
+            = isset($_POST['classcategory_id2']) && is_numeric($_POST['classcategory_id2'])
+            ? $_POST['classcategory_id2']
+            : '';
+
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $this->js_lnOnload .= 'fnSetClassCategories('
+            . 'document.form1, '
+            . Services_JSON::encode($classcategory_id2)
+            . '); ';
+    }
+
+    /* 規格選択セレクトボックスの作成
+     * FIXME 要リファクタリング
+     */
+    function lfMakeSelectMobile(&$objPage, $product_id) {
 
         $objDb = new SC_Helper_DB_Ex();
@@ -496,9 +549,7 @@
 
         // 規格1クラス名の取得
-        $this->tpl_class_name1 = isset($arrClassName[$arrProductsClass[0]['class_id1']])
-                                        ? $arrClassName[$arrProductsClass[0]['class_id1']] : "";
+        $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
         // 規格2クラス名の取得
-        $this->tpl_class_name2 = isset($arrClassName[$arrProductsClass[0]['class_id2']])
-                                        ? $arrClassName[$arrProductsClass[0]['class_id2']] : "";
+        $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];
 
         // すべての組み合わせ数
@@ -507,10 +558,6 @@
         $classcat_id1 = "";
 
-        $arrSele = array();
-        $arrList = array();
-
-        $list_id = 0;
-        $arrList[0] = "\tlist0 = new Array('選択してください'";
-        $arrVal[0] = "\tval0 = new Array(''";
+        $arrSele1 = array();
+        $arrSele2 = array();
 
         for ($i = 0; $i < $count; $i++) {
@@ -524,125 +571,4 @@
             // 規格1のセレクトボックス用
             if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
-                $arrList[$list_id].=");\n";
-                $arrVal[$list_id].=");\n";
-                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
-                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
-                $list_id++;
-            }
-
-            // 規格2のセレクトボックス用
-            $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
-
-            // セレクトボックス表示値
-            if (!isset($arrList[$list_id])) $arrList[$list_id] = "";
-            if($arrList[$list_id] == "") {
-                $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'";
-            } else {
-                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
-            }
-
-            // セレクトボックスPOST値
-            if (!isset($arrVal[$list_id])) $arrVal[$list_id] = "";
-            if($arrVal[$list_id] == "") {
-                $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
-            } else {
-                $arrVal[$list_id].= ", '".$classcat_id2."'";
-            }
-        }
-
-        $arrList[$list_id].=");\n";
-        $arrVal[$list_id].=");\n";
-
-        // 規格1
-        $this->arrClassCat1 = $arrSele;
-
-        $lists = "\tlists = new Array(";
-        $no = 0;
-
-        foreach($arrList as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $lists.= ",list".$no;
-            } else {
-                $lists.= "list".$no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.=$lists.");\n";
-
-        $vals = "\tvals = new Array(";
-        $no = 0;
-
-        foreach($arrVal as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $vals.= ",val".$no;
-            } else {
-                $vals.= "val".$no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.=$vals.");\n";
-
-        // 選択されている規格2ID
-        if (!isset($_POST['classcategory_id2'])) $_POST['classcategory_id2'] = "";
-        $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . htmlspecialchars($_POST['classcategory_id2'], ENT_QUOTES) . "');";
-
-        // 規格1が設定されている
-        if($arrProductsClass[0]['classcategory_id1'] != '0') {
-            $classcat_find1 = true;
-        }
-
-        // 規格2が設定されている
-        if($arrProductsClass[0]['classcategory_id2'] != '0') {
-            $classcat_find2 = true;
-        }
-
-        $this->tpl_classcat_find1 = $classcat_find1;
-        $this->tpl_classcat_find2 = $classcat_find2;
-        $this->tpl_stock_find = $stock_find;
-    }
-
-    /* 規格選択セレクトボックスの作成
-     * FIXME 要リファクタリング
-     */
-    function lfMakeSelectMobile(&$objPage, $product_id) {
-
-        $objDb = new SC_Helper_DB_Ex();
-        $classcat_find1 = false;
-        $classcat_find2 = false;
-        // 在庫ありの商品の有無
-        $stock_find = false;
-
-        // 規格名一覧
-        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
-        // 規格分類名一覧
-        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
-        // 商品規格情報の取得
-        $arrProductsClass = $this->lfGetProductsClass($product_id);
-
-        // 規格1クラス名の取得
-        $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
-        // 規格2クラス名の取得
-        $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];
-
-        // すべての組み合わせ数
-        $count = count($arrProductsClass);
-
-        $classcat_id1 = "";
-
-        $arrSele1 = array();
-        $arrSele2 = array();
-
-        for ($i = 0; $i < $count; $i++) {
-            // 在庫のチェック
-            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
-                continue;
-            }
-
-            $stock_find = true;
-
-            // 規格1のセレクトボックス用
-            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
                 $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
                 $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1];
@@ -679,5 +605,5 @@
         $this->objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("数量", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
     }
 
@@ -697,5 +623,5 @@
     }
 
-    /* 登録済みオススメ商品の読み込み */
+    /* 登録済み関連商品の読み込み */
     function lfPreGetRecommendProducts($product_id) {
         $arrRecommend = array();
@@ -728,15 +654,24 @@
     /* 入力内容のチェック */
     function lfCheckError() {
-        // 入力データを渡す。
-        $arrRet =  $this->objFormParam->getHashArray();
-        $objErr = new SC_CheckError($arrRet);
-        $objErr->arrErr = $this->objFormParam->checkError();
-
-        // 複数項目チェック
-        if ($this->tpl_classcat_find1) {
-            $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK"));
-        }
-        if ($this->tpl_classcat_find2) {
-            $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK"));
+        if ($_POST['mode'] == "add_favorite") {
+            $objCustomer = new SC_Customer();
+            $objErr = new SC_CheckError();
+            $customer_id = $objCustomer->getValue('customer_id');
+            if (SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $favorite_product_id))) {
+                $objErr->arrErr['add_favorite'.$favorite_product_id] = "※ この商品は既にお気に入りに追加されています。<br />";
+            }
+        } else {
+            // 入力データを渡す。
+            $arrRet =  $this->objFormParam->getHashArray();
+            $objErr = new SC_CheckError($arrRet);
+            $objErr->arrErr = $this->objFormParam->checkError();
+
+            // 複数項目チェック
+            if ($this->tpl_classcat_find1) {
+                $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK"));
+            }
+            if ($this->tpl_classcat_find2) {
+                $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK"));
+            }
         }
 
@@ -745,29 +680,11 @@
 
     //閲覧履歴新規登録
-    function lfRegistReadingData($tmp_id, $customer_id){
+    function lfRegistReadingData($product_id, $customer_id){
         $objQuery = new SC_Query;
         $sqlval['customer_id'] = $customer_id;
-        $sqlval['reading_product_id'] = $tmp_id;
+        $sqlval['reading_product_id'] = $product_id;
         $sqlval['create_date'] = 'NOW()';
         $sqlval['update_date'] = 'NOW()';
         $objQuery->insert("dtb_customer_reading", $sqlval);
-    }
-
-    //この商品を買った人はこんな商品も買っています FIXME
-    function lfGetRelateProducts($tmp_id) {
-        $objQuery = new SC_Query;
-        //自動抽出
-        $objQuery->setorder("random()");
-        //表示件数の制限
-        $objQuery->setlimit(RELATED_PRODUCTS_MAX);
-        //検索条件
-        $col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
-        $from = "vw_products_allclass AS allcls ";
-        $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
-        $arrval[] = $tmp_id;
-        //結果の取得
-        $arrProducts = $objQuery->select($col, $from, $where, $arrval);
-
-        return $arrProducts;
     }
 
@@ -823,65 +740,43 @@
     }
 
-    /**
-     * 商品をお気に入りにいれる処理
-     * @param object 顧客管理用クラスオブジェクト
-     */
-    function lfAddFavoriteProduct($objCustomer)
-    {
-        // ログイン中のユーザーかつ、お気に入り商品機能ONの時
-        if ( $objCustomer->isLoginSuccess() === true && OPTION_FAVOFITE_PRODUCT == 1 ){
-            $add_favorite_product_id = $_POST['favorite_product_id'];    // お気に入りに追加する商品ID
-            $customer_id = $objCustomer->getValue('customer_id');        // ログイン中の顧客ID
-
-            // お気に入りに商品を追加する際のエラーチェックを行う
-            $this->arrErr = array();    // エラー内容
-            $this->lfCheckAddFavoriteProduct($customer_id, $add_favorite_product_id);
-
-            if( count($this->arrErr) == 0 ) {
-                // お気に入りに商品を追加する
-                $this->lfRegistFavoriteProduct($customer_id, $add_favorite_product_id);
-            }
-        }
-        return ;
-    }
-
-    /**
-     * 商品をお気に入りにいれる際のエラーチェックを行う
-     * @param int $customer_id 顧客ID
-     * @param int $add_favorite_product_id お気に入りに追加する商品ID
-     */
-    function lfCheckAddFavoriteProduct($customer_id, $add_favorite_product_id)
-    {
-        // 値の正当性チェック
-        $objDb = new SC_Helper_DB_Ex();
-        if( !SC_Utils_Ex::sfIsInt($add_favorite_product_id) || !$objDb->sfIsRecord('dtb_products', 'product_id', $add_favorite_product_id, 'del_flg = 0 AND status = 1') ) {
-            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
-            exit;
-        }
-
-        // 既にお気に入り商品として追加されていないかチェック
-        if (SC_Helper_DB_Ex::sfDataExists( 'dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $add_favorite_product_id)) ) {
-            $this->arrErr['add_favorite'.$add_favorite_product_id] = "※ この商品は既にお気に入りに追加されています。<br />";
-            $this->add_favorite_product_id = $add_favorite_product_id;
-        }
-    }
-
-    /**
+    /*
+     * ファイルの情報をセットする
+     *
+     */
+    function lfSetFile() {
+        // DBからのデータを引き継ぐ
+        $this->objUpFile->setDBFileList($this->arrProduct);
+        // ファイル表示用配列を渡す
+        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
+
+        // サブ画像の有無を判定
+        $this->subImageFlag = false;
+        for ($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
+            if ($this->arrFile["sub_image" . $i]["filepath"] != "") {
+                $this->subImageFlag = true;
+            }
+        }
+    }
+
+    /*
      * お気に入り商品登録
-     * @param int $customer_id 顧客ID
-     * @param int $add_favorite_product_id お気に入りに追加する商品ID
-     */
-    function lfRegistFavoriteProduct($customer_id, $add_favorite_product_id) {
-        $sqlval = array();
-        $sqlval['customer_id'] = $customer_id;
-        $sqlval['product_id'] = $add_favorite_product_id;
-        $sqlval['update_date'] = "now()";
-        $sqlval['create_date'] = "now()";
-
+     */
+    function lfRegistFavoriteProduct($customer_id, $product_id) {
         $objQuery = new SC_Query();
-        $objQuery->begin();
-        $objQuery->insert('dtb_customer_favorite_products', $sqlval);
-        $objQuery->commit();
-    }
+        $objConn = new SC_DbConn();
+        $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
+
+        if ($count == 0) {
+            $sqlval['customer_id'] = $customer_id;
+            $sqlval['product_id'] = $product_id;
+            $sqlval['update_date'] = "now()";
+            $sqlval['create_date'] = "now()";
+
+            $objQuery->begin();
+            $objQuery->insert('dtb_customer_favorite_products', $sqlval);
+            $objQuery->commit();
+        }
+    }
+
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/LC_Page_ResizeImage.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/LC_Page_ResizeImage.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/LC_Page_ResizeImage.php	(revision 18609)
@@ -58,19 +58,16 @@
 
         // NO_IMAGE_DIR以外のファイル名が渡された場合、ファイル名のチェックを行う
-        if ( isset($_GET['image']) && $_GET['image'] !== NO_IMAGE_DIR) {
+        if (strlen($_GET['image']) >= 1 && $_GET['image'] !== NO_IMAGE_DIR) {
 
-            // ファイル名が正しい場合だけ、$fileを設定
-            if ( $this->lfCheckFileName() === true ) {
+            // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定
+            if (!$this->lfCheckFileName()) {
+                GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET["image"]=' . $_GET['image']);
+            }
+            else if (file_exists(IMAGE_SAVE_DIR . $_GET['image'])) {
                 $file = IMAGE_SAVE_DIR . $_GET['image'];
-            } else {
-                GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET["image"]=' . $_GET['image']);
             }
         }
 
-        if(file_exists($file)){
-            $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true);
-        }else{
-            $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true);
-        }
+        $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true);
     }
 
Index: tmp/version-2_5-test/data/class/pages/tb/LC_Page_TrackBack.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/tb/LC_Page_TrackBack.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/tb/LC_Page_TrackBack.php	(revision 18609)
@@ -308,5 +308,5 @@
             print("<title>" . $retProduct[0]["name"] . "</title>");
             print("<link>");
-            print(SITE_URL . "products/detail.php?product_id=" . $product_id);
+            print(SITE_URL . substr(DETAIL_P_HTML, strlen(URL_DIR)) . $product_id);
             print("</link>");
             print("<description>");
Index: tmp/version-2_5-test/data/class/pages/LC_Page_Index.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/LC_Page_Index.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/LC_Page_Index.php	(revision 18609)
@@ -69,4 +69,5 @@
         $layout = new SC_Helper_PageLayout_Ex();
         $layout->sfGetPageLayout($this, false, "index.php");
+        $this->tpl_title = '';
 
         $objView->assignobj($this);
Index: tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss.php	(revision 17650)
+++ tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss.php	(revision 18609)
@@ -60,5 +60,5 @@
         //新着情報を取得
         $arrNews = $this->lfGetNews($objQuery);
-
+        
         //キャッシュしない(念のため)
         header("pragma: no-cache");
@@ -69,5 +69,4 @@
         //新着情報をセット
         $this->arrNews = $arrNews;
-        $this->timestamp = SC_Utils_Ex::sf_mktime("r", $arrNews[0]['hour'], $arrNews[0]['minute'], $arrNews[0]['second'], $arrNews[0]['month'], $arrNews[0]['day'], $arrNews[0]['year']);
 
         //店名をセット
@@ -101,27 +100,12 @@
     function lfGetNews(&$objQuery){
         $col = "";
-        $col .= "     news_id ";								//新着情報ID
-        $col .= "     ,news_title ";							//新着情報タイトル
-        $col .= "     ,news_comment ";							//新着情報本文
-
-        if (DB_TYPE == "pgsql") {
-            $col .= "     ,to_char(news_date, 'YYYY') AS YEAR ";	//日付(年)
-            $col .= "     ,to_char(news_date, 'MM') AS MONTH ";		//日付(月)
-            $col .= "     ,to_char(news_date, 'DD') AS DAY ";		//日付(日)
-            $col .= "     ,to_char(news_date, 'HH24') AS HOUR ";	//日付(時間)
-            $col .= "     ,to_char(news_date, 'MI') AS MINUTE ";	//日付(分)
-            $col .= "     ,to_char(news_date, 'SS') AS SECOND ";	//日付(秒)
-        }else if (DB_TYPE == "mysql") {
-            $col .= "     ,DATE_FORMAT(news_date, '%Y') AS YEAR ";		//日付(年)
-            $col .= "     ,DATE_FORMAT(news_date, '%m') AS MONTH ";		//日付(月)
-            $col .= "     ,DATE_FORMAT(news_date, '%d') AS DAY ";		//日付(日)
-            $col .= "     ,DATE_FORMAT(news_date, '%H') AS HOUR ";		//日付(時間)
-            $col .= "     ,DATE_FORMAT(news_date, '%i') AS MINUTE ";	//日付(分)
-            $col .= "     ,DATE_FORMAT(news_date, '%s') AS SECOND ";	//日付(秒)
-        }
-        $col .= "     ,news_url ";								//新着情報URL
-        $col .= "     ,news_select ";							//新着情報の区分(1:URL、2:本文)
-        $col .= "     ,(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";	//店名
-        $col .= "     ,(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";			//代表Emailアドレス
+        $col .= "news_id ";        // 新着情報ID
+        $col .= ",news_title ";    // 新着情報タイトル
+        $col .= ",news_comment ";  // 新着情報本文
+        $col .= ",news_date ";     // 日付
+        $col .= ",news_url ";      // 新着情報URL
+        $col .= ",news_select ";   // 新着情報の区分(1:URL、2:本文)
+        $col .= ",(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";    // 店名
+        $col .= ",(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";           // 代表Emailアドレス
         $from = "dtb_news";
         $where = "del_flg = '0'";
@@ -129,4 +113,12 @@
         $objQuery->setorder($order);
         $arrNews = $objQuery->select($col,$from,$where);
+        
+        // RSS用に変換
+        foreach (array_keys($arrNews) as $key) {
+            $row =& $arrNews[$key];
+            // 日付
+            $row['news_date'] = date('r', strtotime($row['news_date']));
+        }
+        
         return $arrNews;
     }
Index: tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss_Products.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss_Products.php	(revision 17266)
+++ tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss_Products.php	(revision 18609)
@@ -60,5 +60,5 @@
 
         //店舗情報をセット
-        $arrSiteInfo = $objSiteInfo->data;
+        $this->arrSiteInfo = $objSiteInfo->data;
 
         //商品IDを取得
@@ -72,6 +72,6 @@
             // 値のセットし直し
             foreach($arrProduct as $key => $val){
-                //商品価格を税込みに編集
-                $arrProduct[$key]["price02"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+                //販売価格を税込みに編集
+                $arrProduct[$key]["price02"] = SC_Helper_DB_Ex::sfPreTax($arrProduct[$key]["price02"]);
 
                 // 画像ファイルのURLセット
@@ -97,9 +97,7 @@
             // 値のセットし直し
             foreach($arrProduct as $key => $val){
-                //商品価格を税込みに編集
-                $arrProduct[$key]["price01_max"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price01_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
-                $arrProduct[$key]["price01_min"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price01_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
-                $arrProduct[$key]["price02_max"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
-                $arrProduct[$key]["price02_min"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+                //販売価格を税込みに編集
+                $arrProduct[$key]["price02_max"] = SC_Helper_DB_Ex::sfPreTax($arrProduct[$key]["price02_max"]);
+                $arrProduct[$key]["price02_min"] = SC_Helper_DB_Ex::sfPreTax($arrProduct[$key]["price02_min"]);
 
                 // 画像ファイルのURLセット
@@ -122,7 +120,4 @@
             $this->arrProductKeys = array_keys(SC_Utils_Ex::sfswaparray($arrProduct));
         }
-
-        //店舗情報をセット
-        $this->arrSiteInfo = $arrSiteInfo;
 
         //セットしたデータをテンプレートファイルに出力
@@ -219,5 +214,12 @@
             FROM  vw_products_allclass as allcls
             WHERE allcls.del_flg = 0 AND allcls.status = 1";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $sql .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         $sql .= " ORDER BY allcls.product_id";
+        
         $arrProduct = $objQuery->getall($sql);
         return $arrProduct;
Index: tmp/version-2_5-test/data/class/pages/order/LC_Page_Order.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/order/LC_Page_Order.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/pages/order/LC_Page_Order.php	(revision 18609)
@@ -26,5 +26,5 @@
 
 /**
- * 特定商取引に関する法律 のページクラス.
+ * 特定商取引に関する法律に基づく表記 のページクラス.
  *
  * @package Page
@@ -46,5 +46,5 @@
         $this->tpl_mainpage = 'order/index.tpl';
         $this->tpl_page_category = 'order';
-        $this->tpl_title = '特定商取引に関する法律';
+        $this->tpl_title = '特定商取引に関する法律に基づく表記';
 
         $masterData = new SC_DB_MasterData_Ex();
@@ -73,4 +73,30 @@
 
     /**
+     * モバイルページを初期化する.
+     *
+     * @return void
+     */
+    function mobileInit() {
+        $this->init();
+    }
+
+    /**
+     * Page のプロセス(モバイル).
+     *
+     *
+     * @return void
+     */
+    function mobileProcess() {
+        $objView = new SC_MobileView();
+        $objDb = new SC_Helper_DB_Ex();
+
+        $this->arrRet = $objDb->sf_getBasisData();
+
+        $objView->assignobj($this);
+        $objView->display(SITE_FRAME);
+    }
+
+
+    /**
      * デストラクタ.
      *
Index: tmp/version-2_5-test/data/class/pages/campaign/LC_Page_Campaign.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/campaign/LC_Page_Campaign.php	(revision 17653)
+++ tmp/version-2_5-test/data/class/pages/campaign/LC_Page_Campaign.php	(revision 18609)
@@ -351,5 +351,5 @@
             $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
         }
-        $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("数量", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
 
         return $objErr->arrErr;
@@ -357,10 +357,10 @@
 
     // 購入制限数の設定
-    function lfGetSaleLimit($product) {
+    function lfGetSaleLimit($arrProduct) {
         //在庫が無限または購入制限値が設定値より大きい場合
-        if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
-            $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
+        if (!SC_Utils_Ex::sfIsInt($arrProduct['sale_limit']) || $arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+            $this->tpl_sale_limit[$arrProduct['product_id']] = SALE_LIMIT_MAX;
         } else {
-            $this->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
+            $this->tpl_sale_limit[$arrProduct['product_id']] = $arrProduct['sale_limit'];
         }
     }
Index: tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignEntry.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignEntry.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignEntry.php	(revision 18609)
@@ -52,8 +52,10 @@
         $this->arrJob = $masterData->getMasterData("mtb_job");
         $this->arrReminder = $masterData->getMasterData("mtb_reminder");
-        $this->objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
-        $this->arrYear = $this->objDate->getYear('', 1950);	//　日付プルダウン設定
-        $this->arrMonth = $this->objDate->getMonth();
-        $this->arrDay = $this->objDate->getDay();
+        
+        // 生年月日選択肢の取得
+        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+        $this->arrYear = $objDate->getYear('', 1950, '');
+        $this->arrMonth = $objDate->getMonth(true);
+        $this->arrDay = $objDate->getDay(true);
     }
 
@@ -115,8 +117,4 @@
             $this->arrForm = $_POST;
 
-            if($this->arrForm['year'] == '----') {
-                $this->arrForm['year'] = '';
-            }
-
             $this->arrForm['email'] = strtolower($this->arrForm['email']);		// emailはすべて小文字で処理
             $this->arrForm['email02'] = strtolower($this->arrForm['email02']);	// emailはすべて小文字で処理
@@ -129,6 +127,6 @@
 
             if ($this->arrErr || $_POST["mode"] == "return") {		// 入力エラーのチェック
-                foreach($arrRegistColumn as $key) {
-                    $this->$key['column'] = $arrForm[$key['column']];
+                foreach($this->arrForm as $key => $val) {
+                    $this->$key = $val;
                 }
 
@@ -171,5 +169,5 @@
                     $objQuery = new SC_Query();
 
-                    $subject = $objHelperMail->sfMakeSubject($objQuery, $objMailText, $this, '会員登録のご確認');
+                    $subject = $objHelperMail->sfMakeSubject('会員登録のご確認');
 
                     $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
@@ -201,8 +199,4 @@
         }
 
-        if($this->year == '') {
-            $this->year = '----';
-        }
-
         //---- ページ表示
         $objView->assignobj($this);
@@ -369,5 +363,5 @@
         $objErr->doFunc(array("パスワードを忘れたときのヒント 答え", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("メールマガジン", "mailmaga_flg") ,array("SELECT_CHECK", "NUM_CHECK"));
-        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
 
 
Index: tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignApplication.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignApplication.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/campaign/LC_Page_CampaignApplication.php	(revision 18609)
@@ -45,5 +45,4 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . '/campaign/application.tpl';
-        $this->allowClientCache();
     }
 
@@ -120,5 +119,5 @@
 
                     if($orverlapping_flg) {
-                        if($this->lfOverlappingCheck($objCustomer->getValue('customer_id'), $objCampaignSess->getCampaignId(), $objQuery)) {
+                        if($this->lfOverlappingCheck($objCustomer->getValue('customer_id'), $objQuery)) {
                             $this->arrErr['login_email'] = "※ 複数回ご応募することは出来ません。";
                         }
@@ -253,6 +252,6 @@
      * 戻り値：フラグ (重複があったら true 重複がなかったら false)
      */
-    function lfOverlappingCheck($customer_id, $campaign_id, &$objQuery) {
-        $count = $objQuery->count("dtb_campaign_order", "customer_id = ? AND campaign_id = ?", array($customer_id, $campaign_id));
+    function lfOverlappingCheck($customer_id, &$objQuery) {
+        $count = $objQuery->count("dtb_campaign_order", "customer_id = ?", array($customer_id));
         if($count > 0) {
             return true;
Index: tmp/version-2_5-test/data/class/pages/LC_Page.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/LC_Page.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/pages/LC_Page.php	(revision 18609)
@@ -81,5 +81,10 @@
      * @return void
      */
-    function init() {}
+    function init() {
+        $this->tpl_authority = $_SESSION['authority'];
+        // XXX すべてのページで宣言するべき
+        $layout = new SC_Helper_PageLayout_Ex();
+        $layout->sfGetPageLayout($this, false);
+    }
 
     /**
@@ -241,21 +246,37 @@
     }
 
+    /**
+     * EC-CUBE のWEBルート(/html/)を / としたパスを返す
+     *
+     * @param string $path 結果を取得するためのパス
+     * @return string EC-CUBE のWEBルート(/html/)を / としたパス
+     */
     function getRootPath($path) {
+        // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する
+        $path = str_replace('\\', '/', $path);
+        $htmlPath = str_replace('\\', '/', HTML_PATH);
+        
+        // PHP 5.1 対策 ( http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=4277&forum=9 )
+        if (strlen($path) == 0) {
+            $path = '.';
+        }
+        
         // $path が / で始まっている場合
-        if (substr($path, 0, 1) == "/") {
-            $realPath = realpath(HTML_PATH . substr_replace($path, "", 0, strlen(URL_DIR)));
+        if (substr($path, 0, 1) == '/') {
+            $realPath = realpath($htmlPath . substr_replace($path, '', 0, strlen(URL_DIR)));
         // 相対パスの場合
         } else {
             $realPath = realpath($path);
         }
-
+        $realPath = str_replace('\\', '/', $realPath);
+        
+        // $path が / で終わっている場合、realpath によって削られた末尾の / を復元する。
+        if (substr($path, -1, 1) == '/' && substr($realPath, -1, 1) != '/') {
+            $realPath .= '/';
+        }
+        
         // HTML_PATH を削除した文字列を取得.
-        // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する
-        $realPath = str_replace("\\", "/", $realPath);
-        $htmlPath = str_replace("\\", "/", HTML_PATH);
-
-        $htmlPath = rtrim($htmlPath, "/");
-        $rootPath = str_replace($htmlPath, "", $realPath);
-        $rootPath = ltrim($rootPath, "/");
+        $rootPath = str_replace($htmlPath, '', $realPath);
+        $rootPath = ltrim($rootPath, '/');
 
         return $rootPath;
@@ -277,9 +298,9 @@
 
         // 現在の URL を取得
-        $netURL = new Net_URL();
+        $netURL = new Net_URL($_SERVER['REQUEST_URI']);
 
         if ($removeQueryString) {
             $netURL->querystring = array();
-            $_SERVER['QUERY_STRING'] = '';
+            $_SERVER['QUERY_STRING'] = ''; // sendRedirect() での処理用らしい
         }
 
@@ -295,14 +316,41 @@
 
     /**
-     * クライアントのキャッシュを許可する.
-     *
-     * session_start時のno-cacheヘッダーを抑制することで
-     * 「戻る」ボタン使用時の有効期限切れ表示を抑制する.
-     *
-     * @access protected
-     * @return void
+     * 互換性確保用メソッド
+     *
+     * @access protected
+     * @return void
+     * @deprecated 決済モジュール互換のため
      */
     function allowClientCache() {
-        session_cache_limiter('private-no-expire');
+        LC_Page::httpCacheControl('private');
+    }
+
+    /**
+     * クライアント・プロキシのキャッシュを制御する.
+     *
+     * @access protected
+     * @param string $mode (nocache/private)
+     * @return void
+     */
+    function httpCacheControl($mode = '') {
+        switch ($mode) {
+            case 'nocache':
+                header('Pragma: no-cache');
+                header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
+                header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
+                header('Last-Modified:');
+                break;
+                
+            case 'private':
+                $cache_expire = session_cache_expire() * 60;
+                header('Pragma: no-cache');                                                            // anti-proxy
+                header('Expires:');                                                                    // anti-mozilla
+                header("Cache-Control: private, max-age={$cache_expire}, pre-check={$cache_expire}");  // HTTP/1.1 client
+                header('Last-Modified:');
+                break;
+                
+            default:
+                break;
+        }
     }
 
@@ -332,4 +380,80 @@
         return sha1(uniqid(rand(), true));
     }
+    
+    /**
+     * HTTPステータスコードを送出する。
+     *
+     * @param integer $code HTTPステータスコード
+     * @return void
+     * @author Seasoft (新規作成)
+     * @see Moony_Action::status() (オリジナル)
+     * @link http://moony.googlecode.com/ (オリジナル)
+     * @author YAMAOKA Hiroyuki (オリジナル)
+     * @copyright 2005-2008 YAMAOKA Hiroyuki (オリジナル)
+     * @license http://opensource.org/licenses/bsd-license.php New BSD License (オリジナル)
+     * @link http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳)
+     * @license http://www.gnu.org/licenses/fdl.html GFDL (邦訳)
+     */
+    function sendHttpStatus($code) {
+        $protocol = $_SERVER['SERVER_PROTOCOL'];
+        $httpVersion = (strpos($protocol, '1.1') !== false) ? '1.1' : '1.0';
+        $messages = array(
+            // Informational 1xx                        // 【情報】
+            100 => 'Continue',                          // 継続
+            101 => 'Switching Protocols',               // プロトコル切替え
+            // Success 2xx                              // 【成功】
+            200 => 'OK',                                // OK
+            201 => 'Created',                           // 作成
+            202 => 'Accepted',                          // 受理
+            203 => 'Non-Authoritative Information',     // 信頼できない情報
+            204 => 'No Content',                        // 内容なし
+            205 => 'Reset Content',                     // 内容のリセット
+            206 => 'Partial Content',                   // 部分的内容
+            // Redirection 3xx                          // 【リダイレクション】
+            300 => 'Multiple Choices',                  // 複数の選択
+            301 => 'Moved Permanently',                 // 恒久的に移動した
+            302 => 'Found',  // 1.1                     // 発見した (リクエストしたリソースは一時的に移動されているときに返される)
+            303 => 'See Other',                         // 他を参照せよ
+            304 => 'Not Modified',                      // 未更新
+            305 => 'Use Proxy',                         // プロキシを使用せよ
+            // 306 is no longer used but still reserved // 将来のために予約されている
+            307 => 'Temporary Redirect',                // 一時的リダイレクト
+            // Client Error 4xx                         // 【クライアントエラー】
+            400 => 'Bad Request',                       // リクエストが不正である
+            401 => 'Unauthorized',                      // 認証が必要である
+            402 => 'Payment Required',                  // 支払いが必要である
+            403 => 'Forbidden',                         // 禁止されている
+            404 => 'Not Found',                         // 未検出
+            405 => 'Method Not Allowed',                // 許可されていないメソッド
+            406 => 'Not Acceptable',                    // 受理できない
+            407 => 'Proxy Authentication Required',     // プロキシ認証が必要である
+            408 => 'Request Timeout',                   // リクエストタイムアウト
+            409 => 'Conflict',                          // 矛盾
+            410 => 'Gone',                              // 消滅した
+            411 => 'Length Required',                   // 長さが必要
+            412 => 'Precondition Failed',               // 前提条件で失敗した
+            413 => 'Request Entity Too Large',          // リクエストエンティティが大きすぎる
+            414 => 'Request-URI Too Long',              // リクエストURIが大きすぎる
+            415 => 'Unsupported Media Type',            // サポートしていないメディアタイプ
+            416 => 'Requested Range Not Satisfiable',   // リクエストしたレンジは範囲外にある
+            417 => 'Expectation Failed',                // 期待するヘッダに失敗
+            // Server Error 5xx                         // 【サーバエラー】
+            500 => 'Internal Server Error',             // サーバ内部エラー
+            501 => 'Not Implemented',                   // 実装されていない
+            502 => 'Bad Gateway',                       // 不正なゲートウェイ
+            503 => 'Service Unavailable',               // サービス利用不可
+            504 => 'Gateway Timeout',                   // ゲートウェイタイムアウト
+            505 => 'HTTP Version Not Supported',        // サポートしていないHTTPバージョン
+            509 => 'Bandwidth Limit Exceeded'           // 帯域幅制限超過
+        );
+        if (isset($messages[$code])) {
+            if ($httpVersion !== '1.1') {
+                // HTTP/1.0
+                $messages[302] = 'Moved Temporarily';
+            }
+            header("HTTP/{$httpVersion} {$code} {$messages[$code]}");
+            header("Status: {$code} {$messages[$code]}", true, $code);
+        }
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/preview/LC_Page_Preview.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/preview/LC_Page_Preview.php	(revision 17742)
+++ tmp/version-2_5-test/data/class/pages/preview/LC_Page_Preview.php	(revision 18609)
@@ -69,5 +69,5 @@
             return;
         }
-        SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", false, "", true);
+        SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
     }
 
Index: tmp/version-2_5-test/data/class/pages/LC_Page_InputZip.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/LC_Page_InputZip.php	(revision 17682)
+++ tmp/version-2_5-test/data/class/pages/LC_Page_InputZip.php	(revision 18609)
@@ -53,5 +53,4 @@
      */
     function process() {
-        $conn = new SC_DBconn(ZIP_DSN);
         $objView = new SC_SiteView(false);
 
@@ -60,52 +59,29 @@
         // 入力エラーの場合は終了
         if(count($arrErr) > 0) {
-            $this->tpl_start = "window.close();";
-            SC_Utils::sfDispSiteError(CUSTOMER_ERROR);
+            $tpl_message = "";
+            foreach($arrErr as $key => $val) {
+                $tpl_message .= preg_replace("/<br \/>/", "\n", $val);
+            }
+            echo $tpl_message;
+        
+        // エラー無し
+        } else {
+            // 郵便番号検索文作成
+            $zipcode = $_GET['zip1'].$_GET['zip2'];
+            $zipcode = mb_convert_kana($zipcode ,"n");
+
+            // 郵便番号検索
+            $data_list = SC_Utils_Ex::sfGetAddress($zipcode);
+
+            // 郵便番号が発見された場合
+            if(!empty($data_list)) {
+                $data = $data_list[0]['state']. "|". $data_list[0]['city']. "|". $data_list[0]['town'];
+                echo $data;
+
+            // 該当無し
+            } else {
+                echo "該当する住所が見つかりませんでした。";
+            }
         }
-        
-        // 郵便番号検索文作成
-        $zipcode = $_GET['zip1'].$_GET['zip2'];
-        $zipcode = mb_convert_kana($zipcode ,"n");
-        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
-
-        $data_list = $conn->getAll($sqlse, array($zipcode));
-        if (empty($data_list)) $data_list = array();
-
-        $masterData = new SC_DB_MasterData_Ex();
-        $arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
-        // インデックスと値を反転させる。
-        $arrREV_PREF = array_flip($arrPref);
-
-        if (!empty($data_list)) {
-            $this->tpl_state = isset($arrREV_PREF[$data_list[0]['state']])
-                ? $arrREV_PREF[$data_list[0]['state']] : "";
-            $this->tpl_city = isset($data_list[0]['city']) ? $data_list[0]['city'] : "";
-            $town =  isset($data_list[0]['town']) ? $data_list[0]['town'] : "";
-        } else {
-            $town = "";
-        }
-
-        /*
-         総務省からダウンロードしたデータをそのままインポートすると
-         以下のような文字列が入っているので  対策する。
-         ・（１~１９丁目）
-         ・以下に掲載がない場合
-        */
-        $town = ereg_replace("（.*）$","",$town);
-        $town = ereg_replace("以下に掲載がない場合","",$town);
-        $this->tpl_town = $town;
-
-        // 郵便番号が発見された場合
-        if(!empty($data_list)) {
-            $func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');";
-            $this->tpl_onload = "$func";
-            $this->tpl_start = "window.close();";
-        } else {
-            $this->tpl_message = "該当する住所が見つかりませんでした。";
-        }
-
-        /* ページの表示 */
-        $objView->assignobj($this);
-        $objView->display("input_zip.tpl");
     }
 
@@ -121,11 +97,11 @@
 
     /* 入力エラーのチェック */
-    function fnErrorCheck() {
+    function fnErrorCheck($array) {
         // エラーメッセージ配列の初期化
         $objErr = new SC_CheckError($array);
 
         // 郵便番号
-        $objErr->doFunc( array("郵便番号1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) );
-        $objErr->doFunc( array("郵便番号2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) );
+        $objErr->doFunc( array("郵便番号1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK", "NUM_CHECK" ) );
+        $objErr->doFunc( array("郵便番号2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK", "NUM_CHECK" ) );
         // 親ウィンドウの戻り値を格納するinputタグのnameのエラーチェック
         if (!$this->lfInputNameCheck($array['input1'])) {
@@ -138,11 +114,11 @@
         return $objErr->arrErr;
     }
-	
-	/**
- * エラーチェック
- *
- * @param string $value
- * @return エラーなし：true エラー：false
- */
+
+    /**
+     * エラーチェック
+     *
+     * @param string $value
+     * @return エラーなし：true エラー：false
+     */
     function lfInputNameCheck($value) {
         // 半角英数字と_（アンダーバー）以外の文字を使用していたらエラー
@@ -150,8 +126,7 @@
             return false;
         }
-        
+
         return true;
     }
-
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Login.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Login.php	(revision 17653)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Login.php	(revision 18609)
@@ -47,4 +47,5 @@
         $this->tpl_title = 'MYページ(ログイン)';
         $this->tpl_column_num = 1;
+        $this->httpCacheControl('nocache');
     }
 
@@ -64,5 +65,5 @@
         // ログイン判定
         if($objCustomer->isLoginSuccess()) {
-            $this->sendRedirect($this->getLocation("./index.php"));
+            $this->sendRedirect($this->getLocation(DIR_INDEX_URL));
             exit;
         } else {
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_RefusalComplete.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_RefusalComplete.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_RefusalComplete.php	(revision 18609)
@@ -45,5 +45,6 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/refusal_complete.tpl';
-        $this->tpl_title = "MYページ/退会手続き(完了ページ)";
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '退会手続き(完了ページ)';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_mypageno = 'refusal';
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Order.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Order.php	(revision 17680)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Order.php	(revision 18609)
@@ -52,4 +52,24 @@
      */
     function process() {
+        $objCustomer = new SC_Customer();
+        $objCartSess = new SC_CartSession();
+
+        //受注詳細データの取得
+        $arrDisp = $this->lfGetOrderDetail($_POST['order_id']);
+
+        //ログインしていない、またはDBに情報が無い場合
+        if (!$objCustomer->isLoginSuccess(true) or count($arrDisp) == 0){
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
+        }
+
+        for($num = 0; $num < count($arrDisp); $num++) {
+            $product_id = $arrDisp[$num]['product_id'];
+            $cate_id1 = $arrDisp[$num]['classcategory_id1'];
+            $cate_id2 = $arrDisp[$num]['classcategory_id2'];
+            $quantity = $arrDisp[$num]['quantity'];
+
+            $objCartSess->addProduct(array($product_id, $cate_id1, $cate_id2), $quantity);
+        }
+        $this->sendRedirect($this->getLocation(URL_CART_TOP));
     }
 
@@ -77,5 +97,5 @@
         //ログインしていない、またはDBに情報が無い場合
         if (!$objCustomer->isLoginSuccess(true) or count($arrDisp) == 0){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
 
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_MailView.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_MailView.php	(revision 18609)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_MailView.php	(revision 18609)
@@ -0,0 +1,92 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * 受注管理メール確認 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id: LC_Page_Mypage_MailView.php 16582 2007-10-29 03:06:29Z nanasess $
+ */
+class LC_Page_Mypage_MailView extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'mypage/mail_view.tpl';
+        $this->httpCacheControl('nocache');
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $objView = new SC_SiteView();
+        $objSess = new SC_Session();
+        $objCustomer = new SC_Customer();
+
+        // ログインチェック
+        if(!$objCustomer->isLoginSuccess()) {
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
+        }
+
+        if(SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
+            $objQuery = new SC_Query();
+            $col = "subject, mail_body";
+            $where = "send_id = ? AND customer_id = ?";
+            $arrval = array($_GET['send_id'], $objCustomer->getValue('customer_id'));
+            $arrRet = $objQuery->select($col, "dtb_mail_history LEFT JOIN dtb_order USING(order_id)", $where, $arrval);
+
+            if (empty($arrRet)) {
+                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
+            }
+            $this->tpl_subject = $arrRet[0]['subject'];
+            $this->tpl_body = $arrRet[0]['mail_body'];
+        }
+
+        $objView->assignobj($this);
+        $objView->display($this->tpl_mainpage);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+}
+?>
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_ChangeComplete.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_ChangeComplete.php	(revision 16582)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_ChangeComplete.php	(revision 18609)
@@ -45,5 +45,6 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/change_complete.tpl';
-        $this->tpl_title = 'MYページ/会員登録内容変更(完了ページ)';
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '会員登録内容変更(完了ページ)';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_mypageno = 'change';
@@ -103,5 +104,5 @@
         //ログイン判定
         if (!$objCustomer->isLoginSuccess(true)){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }else {
             //マイページトップ顧客情報表示用
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php	(revision 18177)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php	(revision 18609)
@@ -45,9 +45,9 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/delivery_addr.tpl';
-        $this->tpl_title = "新しいお届け先の追加･変更";
+        $this->tpl_title = "お届け先の追加･変更";
         $masterData = new SC_DB_MasterData_Ex();
         $this->arrPref= $masterData->getMasterData("mtb_pref",
                             array("pref_id", "pref_name", "rank"));
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -93,16 +93,16 @@
         //別のお届け先ＤＢ登録用カラム配列
         $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" => "tel01",		"convert" => "n" ),
-                                 array(  "column" => "tel02",		"convert" => "n" ),
-                                 array(  "column" => "tel03",		"convert" => "n" ),
+                                 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" => "tel01",     "convert" => "n"),
+                                 array("column" => "tel02",     "convert" => "n"),
+                                 array("column" => "tel03",     "convert" => "n"),
                                  );
 
@@ -123,23 +123,12 @@
                     }
                 } else {
-                    //別のお届け先登録数の取得
-                    $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
-                    if ($deliv_count < DELIV_ADDR_MAX or isset($_POST['other_deliv_id'])){
-                        if(strlen($_POST['other_deliv_id'] != 0)){
-                            $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
-                            if ($deliv_count == 0) {
-                                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
-                            }else{
-                                $this->lfRegistData($_POST,$arrRegistColumn, $objCustomer);
-                            }
-                        }else{
-                            $this->lfRegistData($_POST,$arrRegistColumn, $objCustomer);
-                        }
+                    
+                    if ($_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP) {
+                        $this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) ."'); window.close();";
+                    } else {
+                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                     }
-                        if( $_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP ){
-                            $this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) ."'); window.close();";
-                        }else{
-                            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
-                        }
+                    
+                    $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer);
                 }
                 break;
@@ -171,10 +160,10 @@
         $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
         $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
-        $objErr->doFunc(array("ご住所（1）", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("ご住所（2）", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
-        $objErr->doFunc(array("お電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
-        $objErr->doFunc(array("お電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
-        $objErr->doFunc(array("お電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
-        $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+        $objErr->doFunc(array("住所（1）", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("住所（2）", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
+        $objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
+        $objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
+        $objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
         return $objErr->arrErr;
 
@@ -184,4 +173,5 @@
     function lfRegistData($array, $arrRegistColumn, &$objCustomer) {
         $objConn = new SC_DBConn();
+        $objQuery = new SC_Query();
         foreach ($arrRegistColumn as $data) {
             if (strlen($array[ $data["column"] ]) > 0) {
@@ -192,14 +182,28 @@
         $arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');
 
-        //-- 編集登録実行
-        $objConn->query("BEGIN");
-        if ($array['other_deliv_id'] != ""){
+        // 追加
+        if (strlen($_POST['other_deliv_id'] == 0)) {
+            // 別のお届け先登録数の取得
+            $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
+            // 別のお届け先最大登録数に達している場合、エラー
+            if ($deliv_count >= DELIV_ADDR_MAX) {
+                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '別のお届け先最大登録数に達しています。');
+            }
+            
+            // 実行
+            $objConn->autoExecute("dtb_other_deliv", $arrRegist);
+            
+        // 変更
+        } else {
+            $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
+            if ($deliv_count != 1) {
+                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '一致する別のお届け先がありません。');
+            }
+            
+            // 実行
             $objConn->autoExecute("dtb_other_deliv", $arrRegist,
                                   "other_deliv_id = "
                                   . SC_Utils_Ex::sfQuoteSmart($array["other_deliv_id"]));
-        }else{
-            $objConn->autoExecute("dtb_other_deliv", $arrRegist);
-        }
-        $objConn->query("COMMIT");
+        }
     }
 
@@ -207,9 +211,9 @@
     function lfConvertParam($array, $arrRegistColumn) {
         /*
-         *	文字列の変換
-         *	K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
-         *	C :  「全角ひら仮名」を「全角かた仮名」に変換
-         *	V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
-         *	n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         *  文字列の変換
+         *  K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *  n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
          *  a :  全角英数字を半角英数字に変換する
          */
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Favorite.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 18609)
@@ -56,5 +56,4 @@
         $this->tpl_mainno = 'mypage';
         $this->tpl_mypageno = 'favorite';
-        $this->allowClientCache();
     }
 
@@ -78,5 +77,5 @@
             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }else {
-            //マイページトップ顧客情報表示用
+            // マイページトップ顧客情報表示用
             $this->CustomerName1 = $objCustomer->getvalue('name01');
             $this->CustomerName2 = $objCustomer->getvalue('name02');
@@ -90,42 +89,16 @@
         }
 
-        //ページ送り用
+        // ページ送り用
         if (isset($_POST['pageno'])) {
             $this->tpl_pageno = htmlspecialchars($_POST['pageno'], ENT_QUOTES, CHAR_CODE);
         }
 
-        $col = "*";
-        $from =" (SELECT
-                        T2.product_id AS product_id_main,
-                        T2.del_flg ,
-                        T2.status ,
-                        T2.name ,
-                        T2.main_list_image ,
-                        T1.create_date ,
-                        T1.customer_id
-                    FROM
-                       (SELECT
-                            product_id AS product_id_c ,
-                            create_date ,
-                            customer_id
-                        FROM
-                           dtb_customer_favorite_products
-                        ) AS T1 INNER JOIN dtb_products AS T2 ON T1.product_id_c = T2.product_id
-                    ) AS T3 INNER JOIN
-                        (SELECT
-                            product_id ,
-                            MIN(price02) AS price02_min ,
-                            MAX(price02) AS price02_max ,
-                            MAX(stock) AS stock_max ,
-                            MAX(stock_unlimited) AS stock_unlimited_max
-                         FROM
-                            dtb_products_class
-                         GROUP BY
-                            product_id
-                    ) AS T4 ON T3.product_id_main = T4.product_id";
-        $where = "customer_id = ? AND del_flg = 0 AND status = 1";
+        $col = "alldtl.*";
+        $from = "dtb_customer_favorite_products AS dcfp LEFT JOIN vw_products_allclass_detail AS alldtl USING(product_id)";
+        
+        $where = "dcfp.customer_id = ? AND alldtl.del_flg = 0 AND alldtl.status = 1";
         // 在庫無し商品の非表示
         if (NOSTOCK_HIDDEN === true) {
-            $where .= " AND (stock_max >= 1 OR stock_unlimited_max = 1)";
+            $where .= ' AND (alldtl.stock_max >= 1 OR alldtl.stock_unlimited_max = 1)';
         }
         $order = "create_date DESC";
@@ -133,5 +106,5 @@
         $arrval = array($objCustomer->getvalue('customer_id'));
 
-        //お気に入りの数を取得
+        // お気に入りの数を取得
         $linemax = $objQuery->count($from, $where, $arrval);
         $this->tpl_linemax = $linemax;
@@ -147,5 +120,5 @@
         $objQuery->setorder($order);
 
-        //お気に入りの取得
+        // お気に入りの取得
         $this->arrFavorite = $objQuery->select($col, $from, $where, $arrval);
 
@@ -157,6 +130,6 @@
         // 入力情報を渡す
         $this->arrForm = $this->objFormParam->getFormParamList();
-        $objView->assignobj($this);    //$objpage内の全てのテンプレート変数をsmartyに格納
-        $objView->display(SITE_FRAME); //パスとテンプレート変数の呼び出し、実行
+        $objView->assignobj($this);				//$objpage内の全てのテンプレート変数をsmartyに格納
+        $objView->display(SITE_FRAME);				//パスとテンプレート変数の呼び出し、実行
     }
 
@@ -169,5 +142,4 @@
         $this->tpl_mainpage = 'mypage/favorite.tpl';
         $this->tpl_title = 'MYページ/お気に入り一覧';
-        $this->allowClientCache();
     }
 
@@ -230,7 +202,7 @@
 
                     if($ret > 0) {
-                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     } else {
-                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                     }
                 }
@@ -253,6 +225,6 @@
         }
 
-        $objView->assignobj($this);       //$objpage内の全てのテンプレート変数をsmartyに格納
-        $objView->display(SITE_FRAME);    //パスとテンプレート変数の呼び出し、実行
+        $objView->assignobj($this);				//$objpage内の全てのテンプレート変数をsmartyに格納
+        $objView->display(SITE_FRAME);				//パスとテンプレート変数の呼び出し、実行
 
     }
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage.php	(revision 17653)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage.php	(revision 18609)
@@ -50,10 +50,11 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR .'mypage/index.tpl';
-        $this->tpl_title = 'MYページ/購入履歴一覧';
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '購入履歴一覧';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_column_num = 1;
         $this->tpl_mainno = 'mypage';
         $this->tpl_mypageno = 'index';
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -113,5 +114,4 @@
         $objDb = new SC_Helper_DB_Ex();
         $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
-
         $objView->assignobj($this);				//$objpage内の全てのテンプレート変数をsmartyに格納
         $objView->display(SITE_FRAME);				//パスとテンプレート変数の呼び出し、実行
@@ -126,5 +126,5 @@
         $this->tpl_mainpage = 'mypage/index.tpl';
         $this->tpl_title = 'MYページ/購入履歴一覧';
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -188,7 +188,7 @@
 
                     if($ret > 0) {
-                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     } else {
-                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                     }
                 }
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_History.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_History.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_History.php	(revision 18609)
@@ -45,11 +45,15 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/history.tpl';
-        $this->tpl_title = "MYページ/購入履歴詳細";
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '購入履歴詳細';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_column_num = 1;
         $this->tpl_mainno = 'mypage';
         $this->tpl_mypageno = 'index';
-        $this->allowClientCache();
-    }
+        $this->httpCacheControl('nocache');
+        $masterData = new SC_DB_MasterData_Ex();
+        $this->arrMAILTEMPLATE = $masterData->getMasterData("mtb_mail_template");
+        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+   }
 
     /**
@@ -68,8 +72,15 @@
         $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
 
+        // FIXME 他の画面と同様のバリデーションを行なう
+        if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
+            SC_Utils_Ex::sfDispException();
+        }
+
+        $orderId = $_GET['order_id'];
+
         //不正アクセス判定
         $from = "dtb_order";
         $where = "del_flg = 0 AND customer_id = ? AND order_id = ? ";
-        $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']);
+        $arrval = array($objCustomer->getValue('customer_id'), $orderId);
         //DBに情報があるか判定
         $cnt = $objQuery->count($from, $where, $arrval);
@@ -77,22 +88,25 @@
         if (!$objCustomer->isLoginSuccess() || $cnt == 0){
             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
-        } else {
-            //受注詳細データの取得
-            $this->arrDisp = $this->lfGetOrderData($_POST['order_id']);
-            // 支払い方法の取得
-            $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
-            // お届け時間の取得
-            $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']);
-            $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
-
-            //マイページトップ顧客情報表示用
-            $this->CustomerName1 = $objCustomer->getvalue('name01');
-            $this->CustomerName2 = $objCustomer->getvalue('name02');
-            $this->CustomerPoint = $objCustomer->getvalue('point');
-        }
-
-        $masterData = new SC_DB_MasterData_Ex();
-        $this->arrPref = $masterData->getMasterData("mtb_pref",
-                                 array("pref_id", "pref_name", "rank"));
+        }
+
+        //受注詳細データの取得
+        $this->arrDisp = $this->lfGetOrderData($orderId);
+        // 支払い方法の取得
+        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+        // お届け時間の取得
+        $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']);
+        $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
+
+        //マイページトップ顧客情報表示用
+        $this->CustomerName1 = $objCustomer->getvalue('name01');
+        $this->CustomerName2 = $objCustomer->getvalue('name02');
+        $this->CustomerPoint = $objCustomer->getvalue('point');
+
+        // 受注商品明細の取得
+        $this->tpl_arrOrderDetail = $this->lfGetOrderDetail($orderId);
+
+        // 受注メール送信履歴の取得
+        $this->tpl_arrMailHistory = $this->lfGetMailHistory($orderId);
+
         $objView->assignobj($this);
         $objView->display(SITE_FRAME);
@@ -116,5 +130,5 @@
         $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . 'mypage/history.tpl';
         $this->tpl_title = 'MYページ/購入履歴一覧';
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
@@ -134,5 +148,5 @@
         // ログインチェック
         if(!isset($_SESSION['customer'])) {
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
 
@@ -182,33 +196,50 @@
     }
 
-    //受注詳細データの取得
-    function lfGetOrderData($order_id) {
-        //注文番号が数字であれば
-        if(SC_Utils_Ex::sfIsInt($order_id)) {
-            // DBから受注情報を読み込む
-            $objQuery = new SC_Query();
-            $col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, ";
-            $col .= "deliv_fee, charge, payment_total, deliv_name01, deliv_name02, deliv_kana01, deliv_kana02, ";
-            $col .= "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_time_id, deliv_date ";
-            $from = "dtb_order";
-            $where = "order_id = ?";
-            $arrRet = $objQuery->select($col, $from, $where, array($order_id));
-            $arrOrder = $arrRet[0];
-            // 受注詳細データの取得
-            $arrRet = $this->lfGetOrderDetail($order_id);
-            $arrOrderDetail = SC_Utils_Ex::sfSwapArray($arrRet);
-            $arrData = array_merge($arrOrder, $arrOrderDetail);
-        }
-        return $arrData;
-    }
-
-    // 受注詳細データの取得
-    function lfGetOrderDetail($order_id) {
+    /**
+     * 受注の取得
+     *
+     * @param integer $orderId 注文番号
+     * @return array 受注の内容
+     */
+    function lfGetOrderData($orderId) {
+        // DBから受注情報を読み込む
+        $objQuery = new SC_Query();
+        $col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, ";
+        $col .= "deliv_fee, charge, payment_total, deliv_name01, deliv_name02, deliv_kana01, deliv_kana02, ";
+        $col .= "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_time_id, deliv_date ";
+        $from = "dtb_order";
+        $where = "order_id = ?";
+        $arrRet = $objQuery->select($col, $from, $where, array($orderId));
+        return $arrRet[0];
+    }
+
+    /**
+     * 受注商品明細の取得
+     *
+     * @param integer $orderId 注文番号
+     * @return array 受注商品明細の内容
+     */
+    function lfGetOrderDetail($orderId) {
         $objQuery = new SC_Query();
         $col = "product_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+        $col .= ",CASE WHEN EXISTS(SELECT * FROM dtb_products WHERE product_id = dtb_order_detail.product_id AND del_flg = 0 AND status = 1) THEN '1' ELSE '0' END AS enable";
         $where = "order_id = ?";
         $objQuery->setorder("classcategory_id1, classcategory_id2");
-        $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+        $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($orderId));
         return $arrRet;
+    }
+
+    /**
+     * 受注メール送信履歴の取得
+     *
+     * @param integer $orderId 注文番号
+     * @return array 受注メール送信履歴の内容
+     */
+    function lfGetMailHistory($orderId) {
+        $objQuery = new SC_Query();
+        $col = 'send_date, subject, template_id, send_id';
+        $where = 'order_id = ?';
+        $objQuery->setorder('send_date DESC');
+        $this->arrMailHistory = $objQuery->select($col, 'dtb_mail_history', $where, array($orderId));
     }
 }
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Refusal.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Refusal.php	(revision 16630)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Refusal.php	(revision 18609)
@@ -45,5 +45,6 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/refusal.tpl';
-        $this->tpl_title = "MYページ/退会手続き(入力ページ)";
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '退会手続き(入力ページ)';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_mainno = 'mypage';
@@ -84,5 +85,5 @@
 
             $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/refusal_confirm.tpl';
-            $this->tpl_title = "MYページ/退会手続き(確認ページ)";
+            $this->tpl_subtitle = '退会手続き(確認ページ)';
 
             // 確認ページを経由したことを登録
@@ -133,5 +134,5 @@
         //ログイン判定
         if (!$objCustomer->isLoginSuccess(true)){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }else {
             //マイページトップ顧客情報表示用
@@ -142,5 +143,5 @@
 
         if (isset($_POST['no'])) {
-            $this->sendRedirect($this->getLocation("./index.php"), true);
+            $this->sendRedirect($this->getLocation(DIR_INDEX_URL), true);
             exit;
         } elseif (isset($_POST['complete'])){
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Delivery.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Delivery.php	(revision 17062)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Delivery.php	(revision 18609)
@@ -45,5 +45,6 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR .'mypage/delivery.tpl';
-        $this->tpl_title = "MYページ/お届け先追加･変更";
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = 'お届け先追加･変更';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_mainno = 'mypage';
@@ -53,5 +54,5 @@
                             array("pref_id", "pref_name", "rank"));
         $this->tpl_column_num = 1;
-        $this->allowClientCache();
+        $this->httpCacheControl('nocache');
     }
 
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_HistoryDetail.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_HistoryDetail.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_HistoryDetail.php	(revision 18609)
@@ -61,5 +61,6 @@
     function mobileInit() {
         $this->tpl_mainpage = 'mypage/history_detail.tpl';
-        $this->tpl_title = "MYページ/購入履歴詳細";
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '購入履歴詳細';
     }
 
@@ -85,5 +86,5 @@
         //ログインしていない、またはDBに情報が無い場合
         if (!$objCustomer->isLoginSuccess(true) or $cnt == 0){
-            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         } else {
             //受注詳細データの取得
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Change.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Change.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_Change.php	(revision 18609)
@@ -50,5 +50,6 @@
         parent::init();
         $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/change.tpl';
-        $this->tpl_title = 'MYページ/会員登録内容変更(入力ページ)';
+        $this->tpl_title = 'MYページ';
+        $this->tpl_subtitle = '会員登録内容変更(入力ページ)';
         $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
         $this->tpl_mainno = 'mypage';
@@ -63,6 +64,5 @@
         $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type");
         $this->arrSex = $masterData->getMasterData("mtb_sex");
-        $this->allowClientCache();
-
+        $this->httpCacheControl('nocache');
     }
 
@@ -82,9 +82,9 @@
         $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
 
-        //日付プルダウン設定
-        $objDate = new SC_Date(1901);
-        $this->arrYear = $objDate->getYear();
-        $this->arrMonth = $objDate->getMonth();
-        $this->arrDay = $objDate->getDay();
+        // 生年月日選択肢の取得
+        $objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+        $this->arrYear = $objDate->getYear('', 1950, '');
+        $this->arrMonth = $objDate->getMonth(true);
+        $this->arrDay = $objDate->getDay(true);
 
         // ログインチェック
@@ -140,5 +140,5 @@
                 //確認ページへ
                 $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/change_confirm.tpl';
-                $this->tpl_title = 'MYページ/会員登録内容変更(確認ページ)';
+                $this->tpl_subtitle = '会員登録内容変更(確認ページ)';
                 $passlen = strlen($this->arrForm['password']);
                 $this->passlen = $this->lfPassLen($passlen);
@@ -231,8 +231,9 @@
         $objConn = new SC_DbConn();
         $objView = new SC_MobileView();
-        $this->objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
-        $this->arrYear = $this->objDate->getYear();
-        $this->arrMonth = $this->objDate->getMonth();
-        $this->arrDay = $this->objDate->getDay();
+        
+        // 生年月日選択肢の取得
+        $objDate = new SC_Date();
+        $this->arrMonth = $objDate->getMonth(true);
+        $this->arrDay = $objDate->getDay(true);
 
         $this->objQuery = new SC_Query();
@@ -270,7 +271,4 @@
                                  );
 
-        //---- 登録除外用カラム配列
-        $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
-
         $this->arrForm = $this->lfGetCustomerData();
         $this->arrForm['password'] = DEFAULT_PASSWORD;
@@ -280,9 +278,4 @@
             //-- POSTデータの引き継ぎ
             $this->arrForm = array_merge($this->arrForm, $_POST);
-
-            if (!isset($this->arrForm['year'])) $this->arrForm['year'] = "";
-            if($this->arrForm['year'] == '----') {
-                $this->arrForm['year'] = '';
-            }
 
             //-- 入力データの変換
@@ -392,5 +385,5 @@
                         exit;
                     } else {
-                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
+                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                     }
                 }
@@ -426,7 +419,4 @@
      */
     function checkErrorTotal(&$arrRegistColumn, &$arrMailType, $isMobile = false) {
-        // emailはすべて小文字で処理
-        $this->paramToLower($arrRegistColumn);
-
         // 入力データの変換
         $this->arrForm = $this->lfConvertParam($_POST, $arrRegistColumn);
@@ -473,6 +463,6 @@
         $this->objFormParam->addParam("郵便番号2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
         $this->objFormParam->addParam("都道府県", "pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("ご住所1", "addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
-        $this->objFormParam->addParam("ご住所2", "addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("ご住所1", "addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("ご住所2", "addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("お電話番号1", "tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("お電話番号2", "tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
@@ -508,5 +498,5 @@
         $objErr->doFunc(array("ご性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
         $objErr->doFunc(array("ご職業", "job") ,array("NUM_CHECK"));
-        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
         $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
         $objErr->doFunc(array("パスワード(確認)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
@@ -541,4 +531,9 @@
                 $val = mb_convert_kana($val ,$mb_convert_kana_option);
             }
+            
+            // メールアドレスは小文字に変換
+            if ($key == 'email' || $key == 'email02' || $key == 'email_mobile' || $key == 'email_mobile02') {
+                $val = strtolower($val);
+            }
         }
         return $array;
@@ -625,45 +620,4 @@
     // }}}
     // {{{ mobile functions
-
-    /**
-     * TODO
-     * @deprecated 未使用?
-     */
-    function lfRegistDataMobile ($array, $arrRegistColumn,
-                                 $arrRejectRegistColumn) {
-
-        // 仮登録
-        foreach ($arrRegistColumn as $data) {
-            if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
-                $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
-            }
-        }
-
-        // 誕生日が入力されている場合
-        if (strlen($array["year"]) > 0 ) {
-            $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
-        }
-
-        // パスワードの暗号化
-        $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
-
-        $count = 1;
-        while ($count != 0) {
-            $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
-            $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
-        }
-
-        $arrRegist["secret_key"] = $uniqid;		// 仮登録ID発行
-        $arrRegist["create_date"] = "now()"; 	// 作成日
-        $arrRegist["update_date"] = "now()"; 	// 更新日
-        $arrRegist["first_buy_date"] = "";	 	// 最初の購入日
-
-
-        //-- 仮登録実行
-        $this->objQuery->insert("dtb_customer", $arrRegist);
-
-        return $uniqid;
-    }
-
 
     //エラーチェック
@@ -691,5 +645,5 @@
         $objErr->doFunc(array("性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
         $objErr->doFunc(array("ご職業", "job") ,array("NUM_CHECK"));
-        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
         $objErr->doFunc(array("パスワード", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
         $objErr->doFunc(array("パスワード確認用の質問", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
@@ -752,12 +706,5 @@
 
         $objErr->doFunc(array("性別", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
-        $objErr->doFunc(array("生年月日 (年)", "year", 4), array("SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
-        if (!empty($array["year"])) {
-            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getStartYear()), array("MIN_CHECK"));
-            $objErr->doFunc(array("生年月日 (年)", "year", $this->objDate->getEndYear()), array("MAX_CHECK"));
-        }
-        if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
-            $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_DATE"));
-        }
+        $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY"));
 
         return $objErr->arrErr;
@@ -779,75 +726,4 @@
         return $objErr->arrErr;
     }
-
-    // 郵便番号から住所の取得
-    function lfGetAddress($zipcode) {
-        global $arrPref;
-
-        $conn = new SC_DBconn(ZIP_DSN);
-
-        // 郵便番号検索文作成
-        $zipcode = mb_convert_kana($zipcode ,"n");
-        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
-
-        $data_list = $conn->getAll($sqlse, array($zipcode));
-
-        // インデックスと値を反転させる。
-        $arrREV_PREF = array_flip($arrPref);
-
-        /*
-          総務省からダウンロードしたデータをそのままインポートすると
-          以下のような文字列が入っているので	対策する。
-          ・（１・１９丁目）
-          ・以下に掲載がない場合
-        */
-        $town =  $data_list[0]['town'];
-        $town = ereg_replace("（.*）$","",$town);
-        $town = ereg_replace("以下に掲載がない場合","",$town);
-        $data_list[0]['town'] = $town;
-        $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
-
-        return $data_list;
-    }
-
-    //顧客情報の取得
-    function lfGetCustomerDataMobile(){
-
-        //顧客情報取得
-        $ret = $this->objQuery->select("*","dtb_customer","customer_id=?", array($this->objCustomer->getValue('customer_id')));
-        $arrForm = $ret[0];
-        //$arrForm['email'] = $arrForm['email_mobile'];
-
-        //メルマガフラグ取得
-        // TODO たぶん未使用
-        $arrForm['mailmaga_flg'] = $this->objQuery->get("dtb_customer","mailmaga_flg","email_mobile=?", array($this->objCustomer->getValue('email_mobile')));
-
-        //誕生日の年月日取得
-        if (isset($arrForm['birth'])){
-            $birth = split(" ", $arrForm["birth"]);
-            list($year, $month, $day) = split("-",$birth[0]);
-
-            $arrForm['year'] = $year;
-            $arrForm['month'] = $month;
-            $arrForm['day'] = $day;
-
-        }
-        return $arrForm;
-    }
-
-    /**
-     * フォームパラメータの内容を小文字に変換する.
-     *
-     * @param array $arrParam パラメータ名の配列
-     * @return void
-     */
-    function paramToLower(&$arrParam) {
-        foreach ($arrParam as $key => $val) {
-            if (!isset($val)) {
-                $this->arrForm[$key] = "";
-            }elseif($key == 'email' || $key == 'email02' || $key == 'email_mobile' || $key == 'email_mobile02'){
-                $this->arrForm[$key] = strtolower($val);
-            }
-        }
-    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_LoginCheck.php
===================================================================
--- tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_LoginCheck.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_LoginCheck.php	(revision 18609)
@@ -90,5 +90,5 @@
 
             if($objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'], true)) {
-                $this->sendRedirect($this->getLocation("./index.php"));
+                $this->sendRedirect($this->getLocation(DIR_INDEX_URL));
                 exit;
             } else {
Index: tmp/version-2_5-test/data/class/SC_FormParam.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_FormParam.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/SC_FormParam.php	(revision 18609)
@@ -22,5 +22,12 @@
  */
 
-/* パラメータ管理クラス */
+/**
+ * パラメータ管理クラス
+ *
+ * :XXX: addParam と setParam で言う「パラメータ」が用語として競合しているように感じる。(2009/10/17 Seasoft 塚田)
+ *
+ * @package SC
+ * @author LOCKON CO.,LTD.
+ */
 class SC_FormParam {
 
@@ -38,4 +45,13 @@
     function SC_FormParam() {
         $this->check_dir = IMAGE_SAVE_DIR;
+        $this->initParam();
+    }
+
+    /**
+     * パラメータの初期化
+     *
+     * @return void
+     */
+    function initParam() {
         $this->disp_name = array();
         $this->keyname = array();
Index: tmp/version-2_5-test/data/class/SC_MobileUserAgent.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_MobileUserAgent.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_MobileUserAgent.php	(revision 18609)
@@ -147,4 +147,27 @@
         }
     }
+
+    /**
+     * 携帯端末の場合、モバイルサイトへリダイレクトする
+     *
+     * @return void
+     */
+    function sfAutoRedirectMobileSite() {
+        // 携帯端末ではない場合、処理しない
+        if (SC_MobileUserAgent::isNonMobile()) return;
+
+        $url = SC_Utils_Ex::sfIsHTTPS()
+            ? MOBILE_SSL_URL
+            : MOBILE_SITE_URL
+        ;
+
+        $url .= (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches))
+            ? $matches[1]
+            : ''
+        ;
+
+        header("Location: ". SC_Utils_Ex::sfRmDupSlash($url));
+        exit;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/graph/SC_GraphBase.php
===================================================================
--- tmp/version-2_5-test/data/class/graph/SC_GraphBase.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/graph/SC_GraphBase.php	(revision 18609)
@@ -182,5 +182,5 @@
 
     // コンストラクタ
-    function SC_GraphBase($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left, $top) {
+    function SC_GraphBase($bgw, $bgh, $left, $top) {
         $this->init();
         // 画像作成
Index: tmp/version-2_5-test/data/class/SC_CustomerList.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_CustomerList.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_CustomerList.php	(revision 18609)
@@ -31,8 +31,8 @@
     function SC_CustomerList($array, $mode = '') {
         parent::SC_SelectSql($array);
-
+        
         $masterData = new SC_DB_MasterData_Ex();
         $arrMobileDomain = $masterData->getMasterData("mtb_mobile_domain");
-
+        
         $objDb = new SC_Helper_DB_Ex();
 
@@ -45,5 +45,5 @@
 
         if($mode == "customer") {
-            // 管理者ページ顧客検索の場合仮登録会員も検索
+            // 管理機能顧客検索の場合仮登録会員も検索
             //$this->setWhere( "(status = 1 OR status = 2) AND del_flg = 0 ");
             $this->setWhere( " del_flg = 0 ");
@@ -165,5 +165,5 @@
         //　E-MAIL(mobile)
         if (!isset($this->arrSql['email_mobile'])) $this->arrSql['email_mobile'] = "";
-
+        
         if (strlen($this->arrSql['email_mobile']) > 0) {
             //カンマ区切りで複数の条件指定可能に
@@ -353,4 +353,5 @@
             }
         }
+
         $this->setOrder( "customer_id DESC" );
     }
Index: tmp/version-2_5-test/data/class/SC_Customer.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Customer.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/SC_Customer.php	(revision 18609)
@@ -102,5 +102,5 @@
 		if(SC_MobileUserAgent::getCarrier() == 'docomo'){
 			if($_SESSION['mobile']['phone_id'] == "" && strlen($_SESSION['mobile']['phone_id']) == 0)
-				$_SESSION['mobile']['phone_id'] = SC_MobileUserAgent::getId();
+			    $_SESSION['mobile']['phone_id'] = SC_MobileUserAgent::getId();
 		}
 		if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
@@ -226,7 +226,5 @@
         unset($_SESSION['customer']);
         $objSiteSess = new SC_SiteSession();
-        $objCartSess = new SC_CartSession();
         $objSiteSess->unsetUniqId();
-        $objCartSess->delAllProducts();
         // ログに記録する
         GC_Utils_Ex::gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $this->getRemoteHost(), CUSTOMER_LOG_PATH );
Index: tmp/version-2_5-test/data/class/util/SC_Utils.php
===================================================================
--- tmp/version-2_5-test/data/class/util/SC_Utils.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/util/SC_Utils.php	(revision 18609)
@@ -74,39 +74,35 @@
     }
 
-    /**
-     * インストール初期処理
-     */
-    function sfInitInstall()
-    {
-        // インストールが完了していない時
-        if( !defined('ECCUBE_INSTALL') ) {
-            if( !ereg('/install/', $_SERVER['PHP_SELF']) ) {
-                // インストールページに遷移させる
-
-                $script_filename = $_SERVER['SCRIPT_FILENAME'];
-                list($real_root, $tmp) = explode('/html/', $script_filename);
-                $real_root = $real_root . '/html/';
-                $script_name = $_SERVER['SCRIPT_NAME'];
-                $url_dir = rtrim($script_name, basename($script_name));
-
-                if ($dh = opendir($real_root)) {
-                    $arrDir = array();
-                    while ($entry = readdir($dh)) {
-                        if (is_dir($real_root.$entry) && !in_array($entry, array('.', '..', '.svn', 'install'))) {
-                            $url_dir = rtrim($url_dir, $entry.'/');
-                        }
-                    }
-                    closedir($dh);
-                }
-
-                $location = $url_dir . '/install/';
-                header('Location: ' . $location);
-                exit;
-            }
-        } else {
-            $path = HTML_PATH . "install/index.php";
-            if(file_exists($path)) {
-                SC_Utils::sfErrorHeader("&gt;&gt; /install/index.phpは、インストール完了後にファイルを削除してください。");
-            }
+    // インストール初期処理
+    function sfInitInstall() {
+        // インストール済みが定義されていない。
+        if (!defined('ECCUBE_INSTALL')) {
+            // ここから2つ上はdataディレクトリ
+            $eccube_data_dir = realpath(dirname(__FILE__) . '/../../');
+            // dataディレクトリとDATA_DIR2HTMLからhtmlディレクトリを取得。
+            $eccube_html_dir = realpath($eccube_data_dir . '/' . DATA_DIR2HTML);
+            // htmlディレクトリとDOCUMENT_ROOTの相対パスがURL_DIR
+            $document_root = realpath($_SERVER['DOCUMENT_ROOT']);
+            $url_dir = str_replace($document_root, '', $eccube_html_dir);
+
+            // installページへのURLを生成。
+            // Windowsの場合は, ディレクトリの区切り文字を\から/に変換する
+            $url_dir = str_replace("\\", "/", $url_dir);
+            // 先頭が'/'でない場合は'/'を付与。(php4,5のrealpathの挙動の違いによる)
+            if (substr($url_dir, 0, 1) != '/') {
+                $url_dir = '/' . $url_dir;
+            }
+            // 最後が'/'でない場合は'/'を付与。
+            if (substr($url_dir, -1) != '/') {
+                $url_dir .= '/';
+            }
+            $location = $url_dir . 'install/index.php';
+
+            header('Location: ' . $location);
+            exit;
+        }
+        $path = HTML_PATH . "install/index.php";
+        if(file_exists($path)) {
+            SC_Utils::sfErrorHeader("&gt;&gt; /install/index.phpは、インストール完了後にファイルを削除してください。");
         }
     }
@@ -138,5 +134,5 @@
 
     /* サイトエラーページの表示 */
-    function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "", $is_mobile = false) {
+    function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "") {
         global $objCampaignSess;
 
@@ -155,4 +151,28 @@
     }
 
+    /**
+     * 例外エラーページの表示
+     *
+     * @param string $debugMsg デバッグ用のメッセージ
+     * @return void
+     */
+    function sfDispException($debugMsg = null) {
+        require_once(CLASS_EX_PATH . "page_extends/error/LC_Page_Error_SystemError_Ex.php");
+        
+        $objPage = new LC_Page_Error_SystemError_Ex();
+        register_shutdown_function(array($objPage, "destroy"));
+        $objPage->init();
+        if (!is_null($debugMsg)) {
+            $objPage->addDebugMsg($debugMsg);
+        }
+        if (function_exists("debug_backtrace")) {
+            $objPage->backtrace = debug_backtrace();
+        }
+        GC_Utils_Ex::gfPrintLog($objPage->sfGetErrMsg());
+        $objPage->process();
+        
+        exit();
+    }
+
     /* 認証の可否判定 */
     function sfIsSuccess($objSess, $disp_error = true) {
@@ -232,9 +252,9 @@
 
     /* 前のページで正しく登録が行われたか判定 */
-    function sfIsPrePage(&$objSiteSess, $is_mobile = false) {
+    function sfIsPrePage(&$objSiteSess) {
         $ret = $objSiteSess->isPrePage();
         if($ret != true) {
             // エラーページの表示
-            SC_Utils::sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile);
+            SC_Utils::sfDispSiteError(PAGE_ERROR, $objSiteSess);
         }
     }
@@ -284,9 +304,29 @@
     }
 
-    // INT型の数値チェック
+    /**
+     *  INT型の数値チェック
+     *  ・FIXME: マイナス値の扱いが不明確
+     *  ・XXX: INT_LENには収まるが、INT型の範囲を超えるケースに対応できないのでは?
+     *  
+     *  @param mixed $value
+     *  @return bool
+     */
+    // 
     function sfIsInt($value) {
-        if($value != "" && strlen($value) <= INT_LEN && is_numeric($value)) {
+        if (strlen($value) >= 1 && strlen($value) <= INT_LEN && is_numeric($value)) {
             return true;
         }
+        return false;
+    }
+
+    /*
+     * 桁が0で埋められているかを判定する
+     * 
+     * @param string $value 検査対象
+     * @return boolean 0で埋められている
+     */
+    function sfIsZeroFilling($value) {
+        if (strlen($value) > 1 && $value{0} === '0')
+            return true;
         return false;
     }
@@ -398,22 +438,11 @@
     // html_checkboxesの値をマージしてSQL検索用に変更する。
     function sfSearchCheckBoxes($array) {
-        $max = 0;
-        $ret = "";
-        foreach($array as $val) {
-            $arrTmp[$val] = "1";
-            if($val > $max) {
-                $max = $val;
-            }
-        }
-        for($i = 1; $i <= $max; $i++) {
-            if($arrTmp[$i] == "1") {
-                $ret.= "1";
-            } else {
-                $ret.= "_";
-            }
-        }
-
-        if($ret != "") {
-            $ret.= "%";
+        $max = max($array);
+        $ret = '';
+        for ($i = 1; $i <= $max; $i++) {
+            $ret .= in_array($i, $array) ? '1' : '_';
+        }
+        if (strlen($ret) != 0) {
+            $ret .= '%';
         }
         return $ret;
@@ -448,4 +477,5 @@
     // チェックボックスの値を分解
     function sfSplitCBValue($val, $keyname = "") {
+        $arr = array();
         $len = strlen($val);
         $no = 1;
@@ -651,18 +681,16 @@
     }
 
-    /* 税金計算 */
-    function sfTax($price, $tax = null, $tax_rule = null) {
-        // 店舗基本情報を取得
-        static $CONF;
-        if (is_null($CONF) && (is_null($tax) || is_null($tax_rule))) {
-            $CONF = SC_Helper_DB_Ex::sf_getBasisData();
-         }
-        if (is_null($tax)) {
-            $tax = $CONF['tax'];
-        }
-        if (is_null($tax_rule)) {
-            $tax_rule = $CONF['tax_rule'];
-        }
-
+    /**
+     * 税金額を返す
+     *
+     * ・店舗基本情報に基づいた計算は SC_Helper_DB::sfTax() を使用する
+     *
+     * @param integer $price 計算対象の金額
+     * @param integer $tax 税率(%単位)
+     *     XXX integer のみか不明
+     * @param integer $tax_rule 端数処理
+     * @return integer 税金額
+     */
+    function sfTax($price, $tax, $tax_rule) {
         $real_tax = $tax / 100;
         $ret = $price * $real_tax;
@@ -688,6 +716,16 @@
     }
 
-    /* 税金付与 */
-    function sfPreTax($price, $tax = null, $tax_rule = null) {
+    /**
+     * 税金付与した金額を返す
+     * 
+     * ・店舗基本情報に基づいた計算は SC_Helper_DB::sfTax() を使用する
+     *
+     * @param integer $price 計算対象の金額
+     * @param integer $tax 税率(%単位)
+     *     XXX integer のみか不明
+     * @param integer $tax_rule 端数処理
+     * @return integer 税金付与した金額
+     */
+    function sfPreTax($price, $tax, $tax_rule) {
         return $price + SC_Utils_Ex::sfTax($price, $tax, $tax_rule);
     }
@@ -769,43 +807,4 @@
     }
 
-    /* 規格の登録 */
-    function sfInsertProductClass($objQuery, $arrList, $product_id , $product_class_id = "") {
-        // すでに規格登録があるかどうかをチェックする。
-        $where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
-        $count = $objQuery->count("dtb_products_class", $where,  array($product_id));
-
-        // すでに規格登録がない場合
-        if($count == 0) {
-            // 既存規格の削除
-            $where = "product_id = ?";
-            $objQuery->delete("dtb_products_class", $where, array($product_id));
-
-            // 配列の添字を定義
-            $checkArray = array("product_code", "stock", "stock_unlimited", "price01", "price02");
-            $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
-
-            $sqlval['product_id'] = $product_id;
-            if(strlen($product_class_id ) > 0 ){
-                $sqlval['product_class_id'] = $product_class_id;
-            }
-            $sqlval['classcategory_id1'] = '0';
-            $sqlval['classcategory_id2'] = '0';
-            $sqlval['product_code'] = $arrList["product_code"];
-            $sqlval['stock'] = $arrList["stock"];
-            $sqlval['stock_unlimited'] = $arrList["stock_unlimited"];
-            $sqlval['price01'] = $arrList['price01'];
-            $sqlval['price02'] = $arrList['price02'];
-            $sqlval['creator_id'] = $_SESSION['member_id'];
-            $sqlval['create_date'] = "now()";
-
-            if($_SESSION['member_id'] == "") {
-                $sqlval['creator_id'] = '0';
-            }
-
-            // INSERTの実行
-            $objQuery->insert("dtb_products_class", $sqlval);
-        }
-    }
-
     function sfGetProductClassId($product_id, $classcategory_id1, $classcategory_id2) {
         $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
@@ -915,9 +914,17 @@
     }
 
-    /* 加算ポイントの計算式 */
-    function sfGetAddPoint($totalpoint, $use_point, $arrInfo) {
-        if( USE_POINT === false ) return ;
+    /**
+     * 加算ポイントの計算
+     *
+     * ・店舗基本情報に基づいた計算は SC_Helper_DB::sfGetAddPoint() を使用する
+     *
+     * @param integer $totalpoint
+     * @param integer $use_point
+     * @param integer $point_rate
+     * @return integer 加算ポイント
+     */
+    function sfGetAddPoint($totalpoint, $use_point, $point_rate) {
         // 購入商品の合計ポイントから利用したポイントのポイント換算価値を引く方式
-        $add_point = $totalpoint - intval($use_point * ($arrInfo['point_rate'] / 100));
+        $add_point = $totalpoint - intval($use_point * ($point_rate / 100));
 
         if($add_point < 0) {
@@ -934,15 +941,4 @@
         $id = uniqid($head);
         return ($id . $random);
-    }
-
-    // カテゴリ別オススメ品の取得
-    function sfGetBestProducts( $conn, $category_id = 0){
-        // 既に登録されている内容を取得する
-        $sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
-                 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls
-                USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND status = 1 ORDER BY A.rank";
-        $arrItems = $conn->getAll($sql, array($category_id));
-
-        return $arrItems;
     }
 
@@ -1220,5 +1216,5 @@
         }
         $objConn->query("COMMIT");
-        $subject = sfMakeSubject('メルマガ仮登録が完了しました。');
+        $subject = 'メルマガ仮登録が完了しました';
         $objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=".$arrRegistMailMagazine['temp_id'];
         switch ($mail_flag){
@@ -1237,5 +1233,5 @@
             break;
         }
-            $objPage->tpl_email = $email;
+        $objPage->tpl_email = $email;
         sfSendTplMail($email, $subject, 'mail_templates/mailmagazine_temp.tpl', $objPage);
     }
@@ -1276,5 +1272,5 @@
 
         if($basename == "") {
-            $path = $_SERVER["REQUEST_URI"] . "index.php";
+            $path = $_SERVER["REQUEST_URI"] . DIR_INDEX_URL;
         } else {
             $path = $_SERVER["REQUEST_URI"];
@@ -1464,31 +1460,33 @@
 
         $fileArray=glob( $src."*" );
-        foreach( $fileArray as $key => $data_ ){
-            // CVS管理ファイルはコピーしない
-            if(ereg("/CVS/Entries", $data_)) {
-                break;
-            }
-            if(ereg("/CVS/Repository", $data_)) {
-                break;
-            }
-            if(ereg("/CVS/Root", $data_)) {
-                break;
-            }
-
-            mb_ereg("^(.*[\/])(.*)",$data_, $matches);
-            $data=$matches[2];
-            if( is_dir( $data_ ) ){
-                $mess = SC_Utils::sfCopyDir( $data_.'/', $des.$data.'/', $mess);
-            }else{
-                if(!$override && file_exists($des.$data)) {
-                    $mess.= $des.$data . "：ファイルが存在します\n";
-                } else {
-                    if(@copy( $data_, $des.$data)) {
-                        $mess.= $des.$data . "：コピー成功\n";
+        if (is_array($fileArray)) {
+            foreach( $fileArray as $key => $data_ ){
+                // CVS管理ファイルはコピーしない
+                if(ereg("/CVS/Entries", $data_)) {
+                    break;
+                }
+                if(ereg("/CVS/Repository", $data_)) {
+                    break;
+                }
+                if(ereg("/CVS/Root", $data_)) {
+                    break;
+                }
+
+                mb_ereg("^(.*[\/])(.*)",$data_, $matches);
+                $data=$matches[2];
+                if( is_dir( $data_ ) ){
+                    $mess = SC_Utils::sfCopyDir( $data_.'/', $des.$data.'/', $mess);
+                }else{
+                    if(!$override && file_exists($des.$data)) {
+                        $mess.= $des.$data . "：ファイルが存在します\n";
                     } else {
-                        $mess.= $des.$data . "：コピー失敗\n";
+                        if(@copy( $data_, $des.$data)) {
+                            $mess.= $des.$data . "：コピー成功\n";
+                        } else {
+                            $mess.= $des.$data . "：コピー失敗\n";
+                        }
                     }
-                }
-                $mod=stat($data_ );
+                    $mod=stat($data_ );
+                }
             }
         }
@@ -1555,19 +1553,25 @@
     }
 
-    function sfFlush($output = " ", $sleep = 0){
-        // 実行時間を制限しない
-        set_time_limit(0);
+    /**
+     * ブラウザに強制的に送出する
+     *
+     * @param boolean|string $output 半角スペース256文字+改行を出力するか。または、送信する文字列を指定。
+     * @return void
+     */
+    function sfFlush($output = false, $sleep = 0){
         // 出力をバッファリングしない(==日本語自動変換もしない)
-        ob_end_clean();
-
-        // IEのために256バイト空文字出力
-        echo str_pad('',256);
-
-        // 出力はブランクだけでもいいと思う
-        echo $output;
+        while (@ob_end_flush());
+
+        if ($output === true) {
+            // IEのために半角スペース256文字+改行を出力
+            //echo str_repeat(' ', 256) . "\n";
+            echo str_pad('', 256) . "\n";
+        } else if ($output !== false) {
+            echo $output;
+        }
+
         // 出力をフラッシュする
         flush();
 
-        ob_flush();
         ob_start();
 
@@ -1658,4 +1662,21 @@
         }
         return $array;
+    }
+
+    /**
+     * $arrSrc のうち、キーが $arrKey に含まれるものを返す
+     *
+     * $arrSrc に含まない要素は返されない。
+     *
+     * @param array $arrSrc
+     * @param array $arrKey
+     * @return array
+     */
+    function sfArrayIntersectKeys($arrSrc, $arrKey) {
+        $arrRet = array();
+        foreach ($arrKey as $key) {
+            if (isset($arrSrc[$key])) $arrRet[$key] = $arrSrc[$key];
+        }
+        return $arrRet;
     }
 
@@ -2008,5 +2029,5 @@
         for($i = 0; $i < $cnt; $i++) {
             $html.= "<tr>";
-          foreach($array[$i] as $val) {
+            foreach($array[$i] as $val) {
                 $html.="<td>$val</td>";
             }
@@ -2016,13 +2037,28 @@
     }
 
-    /**
-     * 出力バッファをフラッシュし, バッファリングを開始する.
-     *
-     * @return void
-     */
-    function flush() {
-        flush();
-        ob_end_flush();
-        ob_start();
+   /**
+     * 一覧-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
+     *
+     * @param string &$filename ファイル名
+     * @return string
+     */
+    function sfNoImageMainList($filename = '') {
+        if (strlen($filename) == 0 || substr($filename, -1, 1) == '/') {
+            $filename .= 'noimage_main_list.jpg';
+        }
+        return $filename;
+    }
+
+   /**
+     * 詳細-メイン画像のファイル指定がない場合、専用の画像ファイルに書き換える。
+     *
+     * @param string &$filename ファイル名
+     * @return string
+     */
+    function sfNoImageMain($filename = '') {
+        if (strlen($filename) == 0 || substr($filename, -1, 1) == '/') {
+            $filename .= 'noimage_main.png';
+        }
+        return $filename;
     }
 
@@ -2037,4 +2073,264 @@
         print("<strong>**デバッグ中**</strong></div>\n");
     }
+
+    /**
+     * ポイント使用するかの判定
+     * 
+     * @param integer $status 対応状況
+     * @return boolean 使用するか(顧客テーブルから減算するか)
+     */
+    function sfIsUsePoint($status) {
+        switch ($status) {
+            case ORDER_CANCEL:      // キャンセル
+                return false;
+            default:
+                break;
+        }
+
+        return true;
+    }
+
+    /**
+     * ポイント加算するかの判定
+     * 
+     * @param integer $status 対応状況
+     * @return boolean 加算するか
+     */
+    function sfIsAddPoint($status) {
+        switch ($status) {
+            case ORDER_NEW:         // 新規注文
+            case ORDER_PAY_WAIT:    // 入金待ち
+            case ORDER_PRE_END:     // 入金済み
+            case ORDER_CANCEL:      // キャンセル
+            case ORDER_BACK_ORDER:  // 取り寄せ中
+                return false;
+            
+            case ORDER_DELIV:       // 発送済み
+                return true;
+            
+            default:
+                break;
+        }
+
+        return false;
+    }
+
+    /**
+     * ランダムな文字列を取得する
+     * 
+     * @param integer $length 文字数
+     * @return string ランダムな文字列
+     */
+    function sfGetRandomString($length = 1) {
+        require_once(dirname(__FILE__) . '/../../module/Text/Password.php');
+        return Text_Password::create($length);
+    }
+    
+    /**
+     * 現在の URL を取得する
+     *
+     * @return string 現在のURL
+     */
+    function sfGetUrl() {
+        $url = '';
+        
+        if (SC_Utils_Ex::sfIsHTTPS()) {
+            $url = "https://";
+        } else {
+            $url = "http://";
+        }
+        
+        $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '?' . $_SERVER['QUERY_STRING'];
+        
+        return $url;
+    }
+    
+    /**
+     * バックトレースをテキスト形式で出力する
+     *
+     * @return string テキストで表現したバックトレース
+     */
+    function sfBacktraceToString($arrBacktrace) {
+        $string = '';
+        
+        foreach ($arrBacktrace as $backtrace) {
+            if (strlen($backtrace['class']) >= 1) {
+                $func = $backtrace['class'] . $backtrace['type'] . $backtrace['function'];
+            } else {
+                $func = $backtrace['function'];
+            }
+            
+            $string .= $backtrace['file'] . " " . $backtrace['line'] . ":" . $func . "\n";
+        }
+        
+        return $string;
+    }
+
+    /**
+     * 管理機能かを判定
+     *
+     * @return bool 管理機能か
+     */
+    function sfIsAdminFunction() {
+        return defined('ADMIN_FUNCTION') && ADMIN_FUNCTION;
+    }
+
+    /**
+     * フロント機能かを判定
+     *
+     * @return bool フロント機能か
+     */
+    function sfIsFrontFunction() {
+        return SC_Utils_Ex::sfIsPcSite() || SC_Utils_Ex::sfIsMobileSite();
+    }
+
+    /**
+     * フロント機能PCサイトかを判定
+     *
+     * @return bool フロント機能PCサイトか
+     */
+    function sfIsPcSite() {
+        return defined('FRONT_FUNCTION_PC_SITE') && FRONT_FUNCTION_PC_SITE;
+    }
+
+    /**
+     * フロント機能モバイル機能かを判定
+     *
+     * @return bool フロント機能モバイル機能か
+     */
+    function sfIsMobileSite() {
+        return defined('MOBILE_SITE') && MOBILE_SITE;
+    }
+
+    /**
+     * インストール機能かを判定
+     *
+     * @return bool インストール機能か
+     */
+    function sfIsInstallFunction() {
+        return defined('INSTALL_FUNCTION') && INSTALL_FUNCTION;
+    }
+
+    // 郵便番号から住所の取得
+    function sfGetAddress($zipcode) {
+
+        $conn = new SC_DBconn(ZIP_DSN);
+
+        $masterData = new SC_DB_MasterData_Ex();
+        $arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
+        // インデックスと値を反転させる。
+        $arrREV_PREF = array_flip($arrPref);
+
+        // 郵便番号検索文作成
+        $zipcode = mb_convert_kana($zipcode ,"n");
+        $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
+
+        $data_list = $conn->getAll($sqlse, array($zipcode));
+        if (empty($data_list)) return array();
+
+        /*
+         総務省からダウンロードしたデータをそのままインポートすると
+         以下のような文字列が入っているので 対策する。
+         ・（１・１９丁目）
+         ・以下に掲載がない場合
+        */
+        $town =  $data_list[0]['town'];
+        $town = ereg_replace("（.*）$","",$town);
+        $town = ereg_replace("以下に掲載がない場合","",$town);
+        $data_list[0]['town'] = $town;
+        $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
+
+        return $data_list;
+    }
+
+    /**
+     * プラグインが配置されているディレクトリ(フルパス)を取得する
+     *
+     * @param string $file プラグイン情報ファイル(info.php)のパス
+     * @return SimpleXMLElement プラグイン XML
+     */
+    function sfGetPluginFullPathByRequireFilePath($file) {
+        return str_replace('\\', '/', dirname($file)) . '/';
+    }
+
+    /**
+     * プラグインのパスを取得する
+     *
+     * @param string $pluginFullPath プラグインが配置されているディレクトリ(フルパス)
+     * @return SimpleXMLElement プラグイン XML
+     */
+    function sfGetPluginPathByPluginFullPath($pluginFullPath) {
+        return basename(rtrim($pluginFullPath, '/'));
+    }
+
+    /**
+     * プラグイン情報配列の基本形を作成する
+     *
+     * @param string $file プラグイン情報ファイル(info.php)のパス
+     * @return array プラグイン情報配列
+     */
+    function sfMakePluginInfoArray($file) {
+        $fullPath = SC_Utils_Ex::sfGetPluginFullPathByRequireFilePath($file);
+
+        return
+            array(
+                // パス
+                'path' => SC_Utils_Ex::sfGetPluginPathByPluginFullPath($fullPath),
+                // プラグイン名
+                'name' => '未定義',
+                // フルパス
+                'fullpath' => $fullPath,
+                // バージョン
+                'version' => null,
+                // 著作者
+                'auther' => '未定義',
+            )
+        ;
+    }
+
+    /**
+     * プラグイン情報配列を取得する
+     *
+     * TODO include_once を利用することで例外対応をサボタージュしているのを改善する。
+     *
+     * @param string $path プラグインのディレクトリ名
+     * @return array プラグイン情報配列
+     */
+    function sfGetPluginInfoArray($path) {
+        return (array)include_once(PLUGIN_PATH . "$path/plugin_info.php");
+    }
+
+    /**
+     * プラグイン XML を読み込む
+     *
+     * TODO 空だったときを考慮
+     *
+     * @return SimpleXMLElement プラグイン XML
+     */
+    function sfGetPluginsXml() {
+        return simplexml_load_file(PLUGIN_PATH . 'plugins.xml');
+    }
+
+    /**
+     * プラグイン XML を書き込む
+     *
+     * @param SimpleXMLElement $pluginsXml プラグイン XML
+     * @return integer ファイルに書き込まれたバイト数を返します。
+     */
+    function sfPutPluginsXml($pluginsXml) {
+        if (!($pluginsXml instanceof SimpleXMLElement)) SC_Utils_Ex::sfDispException();
+
+        $xml = $pluginsXml->asXML();
+        if (strlen($xml) == 0) SC_Utils_Ex::sfDispException();
+
+        $return = file_put_contents(PLUGIN_PATH . 'plugins.xml', $pluginsXml->asXML());
+        if ($return === false) SC_Utils_Ex::sfDispException();
+
+        return $return;
+    }
+
+    function sfLoadPluginInfo($filenamePluginInfo) {
+        return (array)include_once $filenamePluginInfo;
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/util/GC_Utils.php
===================================================================
--- tmp/version-2_5-test/data/class/util/GC_Utils.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/util/GC_Utils.php	(revision 18609)
@@ -160,5 +160,5 @@
     /**
      * ログローテーション機能
-     *
+     * XXX この類のローテーションは通常 0 開始だが、本実装は 1 開始である。
      * @param integer $max_log 最大ファイル数
      * @param integer $max_size 最大サイズ
@@ -168,54 +168,18 @@
     function gfLogRotation($max_log, $max_size, $path) {
 
-        // ディレクトリ名を取得
-        $dirname = dirname($path);
-        // ファイル名を取得
-        $basename = basename($path);
-		//umask値を777にする。スクリプトが終われば元のumask値に戻る。
-		umask(0);
-        // ファイルが最大サイズを超えていないかチェック
-        if(filesize($path) > $max_size) {
-            if ($dh = opendir($dirname)) {
-                while (($file = readdir($dh)) !== false) {
-                    // ログローテーションにて作成されたファイルを取得
-                    if(ereg("^". $basename . "\." , $file)) {
-                        $arrFile[] = $file;
-                    }
-                }
-
-                // ローテーションにて作成されたログファイルが存在しない場合は実行しない
-                if(is_array($arrFile)) {
-                    // ソートを行う
-                    natcasesort($arrFile);
-
-                    // ファイルログが最大個数なら以上なら古いファイルから削除する
-                    $count = count($arrFile);
-                    if($count >= $max_log) {
-                        $diff = $count - $max_log;
-                        for($i = 0; $diff >= $i ; $i++) {
-                            unlink($dirname . "/" . array_pop($arrFile));
-                        }
-                    }
-
-                    // ログファイルの添え字をずらす
-                    $count = count($arrFile);
-                    for($i = $count; 1 <= $i; $i--) {
-                        $move_number = $i + 1;
-                        if(file_exists("$path.$move_number")) {
-                            unlink("$path.$move_number");
-                        }
-                        copy("$dirname/" . $arrFile[$i - 1], "$path.$move_number");
-                    }
-                }
-                $ret = copy($path, "$path.1");
-
-                // 新規ログファイルを作成
-                if($ret) {
-                    unlink($path);
-                    touch($path);
-                    chmod($path, 0666);
-                }
+        // ファイルが最大サイズを超えていない場合、終了
+        if (filesize($path) <= $max_size) return;
+        
+        // アーカイブのインクリメント(削除を兼ねる)
+        for ($i = $max_log; $i >= 2; $i--) {
+            $path_old = "$path." . ($i - 1);
+            $path_new = "$path.$i";
+            if (file_exists($path_old)) {
+                rename($path_old, $path_new);
             }
         }
+        
+        // 現在ファイルのアーカイブ
+        rename($path, "$path.1");
     }
 
Index: tmp/version-2_5-test/data/class/SC_DbConn.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_DbConn.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_DbConn.php	(revision 18609)
@@ -24,15 +24,12 @@
 $current_dir = realpath(dirname(__FILE__));
 require_once($current_dir . "/../module/DB.php");
-require_once($current_dir . "/util/SC_Utils.php");
-require_once($current_dir . "/util/GC_Utils.php");
-$objDbConn = "";
-
-class SC_DbConn{
+
+$g_arr_objDbConn = array();
+
+class SC_DbConn {
 
     var $conn;
     var $result;
     var $includePath;
-    var $error_mail_to;
-    var $error_mail_title;
     var $dsn;
     var $err_disp = true;
@@ -42,5 +39,5 @@
     // コンストラクタ
     function SC_DbConn($dsn = "", $err_disp = true, $new = false){
-        global $objDbConn;
+        global $g_arr_objDbConn;
 
         // Debugモード指定
@@ -49,25 +46,30 @@
         $options['persistent'] = PEAR_DB_PERSISTENT;
 
+        if (strlen($dsn) >= 1) {
+            $this->dsn = $dsn;
+        } elseif (defined('DEFAULT_DSN')) {
+            $this->dsn = DEFAULT_DSN;
+        } else {
+            // XXX 以前の仕様を継承しているが、意図が良く分からない。(2010/03/03 Seasoft 塚田)
+            return;
+        }
+
         // 既に接続されていないか、新規接続要望の場合は接続する。
-        if(!isset($objDbConn->connection) || $new) {
-            if($dsn != "") {
-                $objDbConn = DB::connect($dsn, $options);
-                $this->dsn = $dsn;
-            } else {
-                if(defined('DEFAULT_DSN')) {
-                    $objDbConn = DB::connect(DEFAULT_DSN, $options);
-                    $this->dsn = DEFAULT_DSN;
-                } else {
-                    return;
-                }
+        if (!isset($g_arr_objDbConn[$this->dsn]) || !isset($g_arr_objDbConn[$this->dsn]->connection)) {
+            $new = true;
+        }
+
+        if ($new) {
+            $this->conn = DB::connect($this->dsn, $options);
+            $g_arr_objDbConn[$this->dsn] = $this->conn;
+
+            if (DB_TYPE == 'mysql') {
+                $g_arr_objDbConn->query('SET NAMES utf8'); // FIXME mysql_set_charset を使える環境では、その方が良さそう (2010/03/03 Seasoft 塚田)
+                $g_arr_objDbConn->query("SET SESSION sql_mode = 'ANSI'");
             }
-        }
-        //MySQL文字化け対策(MySQLで文字化けする場合は以下のコメントアウトをはずして動作確認してみてください。)
-        //if (DB_TYPE == 'mysql') {
-        //    $objDbConn->query('SET NAMES utf8');
-        //}
-        $this->conn = $objDbConn;
-        $this->error_mail_to = DB_ERROR_MAIL_TO;
-        $this->error_mail_title = DB_ERROR_MAIL_SUBJECT;
+        } else {
+            $this->conn = $g_arr_objDbConn[$this->dsn];
+        }
+
         $this->err_disp = $err_disp;
         $this->dbFactory = SC_DB_DBFactory_Ex::getInstance();
@@ -86,5 +88,5 @@
 
         if ($this->conn->isError($result) && !$ignore_err){
-            $this->send_err_mail ($result, $n);
+            $this->send_err_mail($result, $n);
         }
 
@@ -105,23 +107,28 @@
         }
         if ($this->conn->isError($result)){
-            $this->send_err_mail ($result ,$n);
-        }
-        $this->result = $result;
-
-        return $this->result;
-    }
-
-    function getRow($n, $arr = ""){
-
-        // mysqlの場合にはビュー表を変換する
-        if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);
-
-        if ( $arr ) {
-            $result = $this->conn->getRow($n, $arr);
-        } else {
-            $result = $this->conn->getRow($n);
-        }
+            $this->send_err_mail($result ,$n);
+        }
+        $this->result = $result;
+
+        return $this->result;
+    }
+    
+    /**
+     * クエリを実行し、最初の行を返す
+     *
+     * @param string $sql SQL クエリ
+     * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 
+     * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。
+     * @return array データを含む1次元配列。失敗した場合に DB_Error オブジェクトを返します。
+     */
+    function getRow($sql, $arrVal = array(), $fetchmode = DB_FETCHMODE_ASSOC) {
+        
+        // mysqlの場合にはビュー表を変換する
+        if (DB_TYPE == "mysql") $sql = $this->dbFactory->sfChangeMySQL($sql);
+        
+        $result = $this->conn->getRow($sql, $arrVal ,$fetchmode);
+        
         if ($this->conn->isError($result)){
-            $this->send_err_mail ($result ,$n);
+            $this->send_err_mail($result ,$sql);
         }
         $this->result = $result;
@@ -146,14 +153,22 @@
     }
 
-    // SELECT文の実行結果を全て取得
-    function getAll($n, $arr = ""){
-
-        // mysqlの場合にはビュー表を変換する
-        if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);
-
-        if(PEAR::isError($this->conn)) {
-            if(ADMIN_MODE){
+    /**
+     * クエリを実行し、全ての行を返す
+     *
+     * @param string $sql SQL クエリ
+     * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 
+     * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。
+     * @return array データを含む2次元配列。失敗した場合に 0 または DB_Error オブジェクトを返します。
+     */
+    function getAll($sql, $arrVal = "", $fetchmode = DB_FETCHMODE_ASSOC) {
+
+        // mysqlの場合にはビュー表を変換する
+        if (DB_TYPE == "mysql") $sql = $this->dbFactory->sfChangeMySQL($sql);
+
+        // XXX このエラー処理はここで行なうべきなのか疑問。また、戻り値も疑問(なお、変更時はドキュメントも変更を)。
+        if (PEAR::isError($this->conn)) {
+            if (ADMIN_MODE) {
                 SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:" . $this->dsn);
-            }else{
+            } else {
                 SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:");
             }
@@ -161,12 +176,12 @@
         }
 
-        if ( $arr ){
-            $result = $this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC);
-        } else {
-            $result = $this->conn->getAll($n, DB_FETCHMODE_ASSOC);
-        }
-
-        if ($this->conn->isError($result)){
-            $this->send_err_mail ($result, $n);
+        if ($arrVal) { // FIXME 判定が曖昧
+            $result = $this->conn->getAll($sql, $arrVal, $fetchmode);
+        } else {
+            $result = $this->conn->getAll($sql, $fetchmode);
+        }
+
+        if ($this->conn->isError($result)) {
+            $this->send_err_mail($result, $sql);
         }
         $this->result = $result;
@@ -184,5 +199,5 @@
 
         if ($this->conn->isError($result)){
-            $this->send_err_mail ($result, $n);
+            $this->send_err_mail($result, $n);
         }
         $this->result = $result;
@@ -211,53 +226,37 @@
     }
 
-    function send_err_mail($result, $sql){
-        $url = '';
-        $errmsg = '';
-
-        if (SC_Utils_Ex::sfIsHTTPS()) {
-            $url = "https://";
-        } else {
-            $url = "http://";
-        }
-        $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
-
-        $errmsg = $url."\n\n";
-        $errmsg.= "SERVER_ADDR:" . $_SERVER['SERVER_ADDR'] . "\n";
-        $errmsg.= "REMOTE_ADDR:" . $_SERVER['REMOTE_ADDR'] . "\n";
-        $errmsg.= "USER_AGENT:" . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
-        $errmsg.= $sql . "\n";
-        $errmsg.= $result->message . "\n\n";
-        $errmsg.= $result->userinfo . "\n\n";
-
-        $arrRbacktrace = array_reverse($result->backtrace);
-
-        foreach($arrRbacktrace as $backtrace) {
-            if($backtrace['class'] != "") {
-                $func = $backtrace['class'] . "->" . $backtrace['function'];
-            } else {
-                $func = $backtrace['function'];
-            }
-
-            $errmsg.= $backtrace['file'] . " " . $backtrace['line'] . ":" . $func . "\n";
-        }
-
-        require_once(CLASS_EX_PATH . "page_extends/error/LC_Page_Error_SystemError_Ex.php");
-
-        $objPage = new LC_Page_Error_SystemError_Ex();
-        register_shutdown_function(array($objPage, "destroy"));
-        $objPage->init();
-        $objPage->process();
-
-        if (DEBUG_MODE == true) {
-            print('<pre>');
-            print_r(htmlspecialchars($errmsg, ENT_QUOTES, CHAR_CODE));
-            print('</pre>');
+    function send_err_mail($pearResult, $sql){
+
+        $errmsg = $sql . "\n\n";
+
+        // PEAR エラーを伴う場合
+        if (!is_null($pearResult)) {
+            $errmsg .= $pearResult->message . "\n\n";
+            $errmsg .= $pearResult->userinfo . "\n\n";
+            $errmsg .= SC_Utils_Ex::sfBacktraceToString($pearResult->backtrace);
+        }
+        // (上に該当せず)バックトレースを生成できる環境(一般的には PHP 4 >= 4.3.0, PHP 5)の場合
+        else if (function_exists("debug_backtrace")) {
+            $errmsg .= SC_Utils_Ex::sfBacktraceToString(array_slice(debug_backtrace(), 2));
         }
 
         GC_Utils_Ex::gfPrintLog($errmsg);
-
+        trigger_error($errmsg, E_USER_ERROR);
         exit();
     }
+
+    /**
+     * 直前に実行されたSQL文を取得する.
+     *
+     * @param boolean $disp trueの場合、画面出力を行う.
+     * @return string SQL文
+     */
+    function getLastQuery($disp = true) {
+        $sql = $this->conn->last_query;
+        if($disp) {
+            print($sql.";<br />\n");
+        }
+        return $sql;
+    }
 }
-
 ?>
Index: tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseRequest.php
===================================================================
--- tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseRequest.php	(revision 17410)
+++ tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseRequest.php	(revision 18609)
@@ -183,4 +183,5 @@
         // セッションIDの受け渡しにクッキーを使用しない。
         ini_set('session.use_cookies', '0');
+        ini_set('session.use_trans_sid', '1');
 
         // パラメーターから有効なセッションIDを取得する。
Index: tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseCookie.php
===================================================================
--- tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseCookie.php	(revision 17118)
+++ tmp/version-2_5-test/data/class/session/sessionfactory/SC_SessionFactory_UseCookie.php	(revision 18609)
@@ -48,8 +48,7 @@
      **/
     function initSession() {
+        ini_set('session.cache_limiter', 'none');
         if (session_id() === "") {
-
             session_set_cookie_params(0, "/", DOMAIN_NAME);
-
             if (!ini_get("session.auto_start")) {
                 // セッション開始
@@ -62,5 +61,5 @@
      * Cookieを使用するかどうか
      *
-     * @return boolean 常にfalseを返す
+     * @return boolean 常に true を返す
      */
     function useCookie() {
Index: tmp/version-2_5-test/data/class/SC_MobileImage.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_MobileImage.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_MobileImage.php	(revision 18609)
@@ -69,10 +69,10 @@
             if ($carrier == "docomo" or $carrier == "softbank") {
                 if( $result != false && $result > 0){
-                    // 計算式：(利用端末で表示可能なcacheサイズ - HTMLのバイト数 - 変換後の画像名のバイト数(目安値) ) / HTML中の画像数
-                    $temp_imagefilesize = ($cacheSize - strlen($buffer) - (140 * $result) ) / $result;
-                } else {
-                    // 計算式：(利用端末で表示可能なcacheサイズ - HTMLのバイト数 )
-                    $temp_imagefilesize = ($cacheSize - strlen($buffer) );
-                }
+                	// 計算式：(利用端末で表示可能なcacheサイズ - HTMLのバイト数 - 変換後の画像名のバイト数(目安値) ) / HTML中の画像数
+					$temp_imagefilesize = ($cacheSize - strlen($buffer) - (140 * $result) ) / $result;
+				} else {
+					// 計算式：(利用端末で表示可能なcacheサイズ - HTMLのバイト数 )
+					$temp_imagefilesize = ($cacheSize - strlen($buffer) );
+				}
                 // 計算結果が端末の表示可能ファイルサイズ上限より小さい場合は計算結果の値を有効にする
                 if ($temp_imagefilesize < $imageFileSize) {
@@ -90,8 +90,10 @@
 
             // HTML中のIMGタグを変換後のファイルパスに置換する
-            foreach ($images[1] as $key => $value) {
-                $converted = $imageConverter->execute(preg_replace('|^' . URL_DIR . '|', HTML_PATH, $value));
+            foreach ($images[1] as $key => $path) {
+                $realpath = html_entity_decode($path, ENT_QUOTES);
+                $realpath = preg_replace('|^' . URL_DIR . '|', HTML_PATH, $realpath);
+                $converted = $imageConverter->execute($realpath);
                 if (isset($converted['outputImageName'])) {
-                    $buffer = str_replace($value, MOBILE_IMAGE_URL . '/' . $converted['outputImageName'], $buffer);
+                    $buffer = str_replace($path, MOBILE_IMAGE_URL . '/' . $converted['outputImageName'], $buffer);
                 } else {
                     $buffer = str_replace($images[0][$key], '<!--No image-->', $buffer);
Index: tmp/version-2_5-test/data/class/db/SC_DB_MasterData.php
===================================================================
--- tmp/version-2_5-test/data/class/db/SC_DB_MasterData.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/db/SC_DB_MasterData.php	(revision 18609)
@@ -59,9 +59,7 @@
      *
      * 以下の順序でマスタデータを取得する.
-     * 1. MASTER_DATA_DIR のマスタデータキャッシュを include() で読み込む
-     * 2. 1 で読み込んだ値をチェックし, 値が変数定義されていれば値を返す.
-     *    されていなければ, 次の処理を行う.
-     * 3. 値が未定義の場合は, DBからマスタデータを取得する.
-     * 4. 取得した後, マスタデータのキャッシュを生成し, 値を返す.
+     * 1. MASTER_DATA_DIR にマスタデータキャッシュが存在しない場合、
+     *    DBからマスタデータを取得して、マスタデータキャッシュを生成する。
+     * 2. マスタデータキャッシュを読み込み、変数に格納し返す。
      *
      * 返り値は, key => value 形式の配列である.
@@ -76,17 +74,14 @@
         $columns = $this->getDefaultColumnName($columns);
 
-        // 可変変数を定義
-        $valiable = "_" . $name . "_master";
+        $filepath = MASTER_DATA_DIR . $name . '.serial';
+
+        if (!file_exists($filepath)) {
+            // キャッシュ生成
+            $this->createCache($name, $columns);
+        }
+
         // キャッシュを読み込み
-        @include(MASTER_DATA_DIR . $name . ".php");
-
-        // キャッシュがあれば, キャッシュの値を返す.
-        if (!empty($$valiable)) {
-            return $$valiable;
-        }
-        // マスタデータを取得
-        $masterData = $this->getDbMasterData($name, $columns);
-        // キャッシュ生成
-        $this->createCache($name, $masterData);
+        $masterData = unserialize(file_get_contents($filepath));
+
         return $masterData;
     }
@@ -253,12 +248,16 @@
      * @return bool キャッシュの生成に成功した場合 true
      */
-    function createCache($name, $masterData, $isDefine = false,
+    function createCache($name, $columns = array(), $isDefine = false,
                          $commentColumn = array()) {
 
+        // マスタデータを取得
+        $masterData = $this->getDbMasterData($name, $columns);
+
         // マスタデータを文字列にする
-        $data = "<?php\n";
         // 定数を生成する場合
         if ($isDefine) {
-
+            $path = MASTER_DATA_DIR . $name . '.php';
+
+            $data = "<?php\n";
             // 定数コメントを生成する場合
             if (!empty($commentColumn)) {
@@ -268,13 +267,13 @@
                 $data .= $this->getMasterDataAsDefine($masterData);
             }
+            $data .=  "?>\n";
 
         // 配列を生成する場合
         } else {
-            $data .= $this->getMasterDataAsString($name, $masterData);
-        }
-        $data .=  "?>\n";
+            $path = MASTER_DATA_DIR . $name . '.serial';
+            $data = serialize($masterData);
+        }
 
         // ファイルを書き出しモードで開く
-        $path = MASTER_DATA_DIR . $name . ".php";
         $handle = fopen($path, "w");
         if (!$handle) {
@@ -305,5 +304,7 @@
 
         $this->objQuery = new SC_Query();
-        $this->objQuery->setorder($columns[2]);
+        if (isset($columns[2]) && strlen($columns[2]) >= 1) {
+            $this->objQuery->setorder($columns[2]);
+        }
         $results = $this->objQuery->select($columns[0] . ", " . $columns[1], $name);
 
@@ -337,26 +338,4 @@
             return $this->columns;
         }
-    }
-
-    /**
-     * マスタデータの配列を配列定義の文字列として出力する.
-     *
-     * @access private
-     * @param string $name マスタデータ名
-     * @param array $masterData マスタデータの配列
-     * @return string 配列定義の文字列
-     */
-    function getMasterDataAsString($name, $masterData) {
-        $data = "\$_" . $name . "_master = array(\n";
-        $i = count($masterData);
-        foreach ($masterData as $key => $val) {
-            $data .= "'" . $key . "' => '" . $val . "'";
-            if ($i > 1) {
-                $data .= ",\n";
-            }
-            $i--;
-        }
-        $data .= ");\n";
-        return $data;
     }
 
Index: tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php
===================================================================
--- tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php	(revision 18432)
+++ tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php	(revision 18609)
@@ -46,5 +46,4 @@
     function sfGetDBVersion($dsn = "") {
         $objQuery = new SC_Query($this->getDSN($dsn), true, true);
-        list($db_type) = split(":", $dsn);
         $val = $objQuery->getOne("select version()");
         return "MySQL " . $val;
@@ -71,5 +70,5 @@
         return $sql;
     }
-
+    
     /**
      * 文字コード情報を取得する
@@ -77,10 +76,10 @@
      * @return array 文字コード情報
      */
-     function getCharSet() {
-         $objQuery = new SC_Query();
-         $arrRet = $objQuery->getAll("SHOW VARIABLES LIKE 'char%'");
-         return $arrRet;
-     }
-
+    function getCharSet() {
+        $objQuery = new SC_Query();
+        $arrRet = $objQuery->getAll("SHOW VARIABLES LIKE 'char%'");
+        return $arrRet;
+    }
+    
     /**
      * テーブルの存在チェックを行う SQL 文を返す.
@@ -171,23 +170,4 @@
 
     /**
-     * SQL の中の View の存在をチェックする.
-     *
-     * @access private
-     * @param string $sql SQL 文
-     * @return bool Viewが存在しない場合 false
-     */
-    function sfInArray($sql){
-        $arrView = $this->viewToSubQuery();
-
-        foreach($arrView as $key => $val){
-            if (strcasecmp($sql, $val) == 0){
-                $changesql = eregi_replace("($key)", "$val", $sql);
-                $this->sfInArray($changesql);
-            }
-        }
-        return false;
-    }
-
-    /**
      * View をインラインビューに変換する.
      *
@@ -197,15 +177,15 @@
      */
     function sfChangeView($sql){
-
+        
         $arrViewTmp = $this->viewToSubQuery();
-
-        // viewのwhereを変換
+        
+            // viewのwhereを変換
         foreach($arrViewTmp as $key => $val){
             $arrViewTmp[$key] = strtr($arrViewTmp[$key], $this->getWhereConverter());
         }
-
-        // viewを変換
+            
+            // viewを変換
         $changesql = strtr($sql, $arrViewTmp);
-
+        
         return $changesql;
     }
@@ -246,5 +226,5 @@
         return $changesql;
     }
-
+    
     /**
      * WHERE 句置換用の配列を返す.
@@ -272,211 +252,188 @@
      */
     function viewToSubQuery() {
-        $sql['vw_products_allclass_detail'] =<<< __EOS__
-            (
-                SELECT
-                    dtb_products.product_id,
-                    dtb_products.name,
-                    dtb_products.deliv_fee,
-                    dtb_products.sale_limit,
-                    dtb_products.sale_unlimited,
-                    dtb_products.rank,
-                    dtb_products.status,
-                    dtb_products.product_flag,
-                    dtb_products.point_rate,
-                    dtb_products.comment1,
-                    dtb_products.comment2,
-                    dtb_products.comment3,
-                    dtb_products.comment4,
-                    dtb_products.comment5,
-                    dtb_products.comment6,
-                    dtb_products.note,
-                    dtb_products.file1,
-                    dtb_products.file2,
-                    dtb_products.file3,
-                    dtb_products.file4,
-                    dtb_products.file5,
-                    dtb_products.file6,
-                    dtb_products.main_list_comment,
-                    dtb_products.main_list_image,
-                    dtb_products.main_comment,
-                    dtb_products.main_image,
-                    dtb_products.main_large_image,
-                    dtb_products.sub_title1,
-                    dtb_products.sub_comment1,
-                    dtb_products.sub_image1,
-                    dtb_products.sub_large_image1,
-                    dtb_products.sub_title2,
-                    dtb_products.sub_comment2,
-                    dtb_products.sub_image2,
-                    dtb_products.sub_large_image2,
-                    dtb_products.sub_title3,
-                    dtb_products.sub_comment3,
-                    dtb_products.sub_image3,
-                    dtb_products.sub_large_image3,
-                    dtb_products.sub_title4,
-                    dtb_products.sub_comment4,
-                    dtb_products.sub_image4,
-                    dtb_products.sub_large_image4,
-                    dtb_products.sub_title5,
-                    dtb_products.sub_comment5,
-                    dtb_products.sub_image5,
-                    dtb_products.sub_large_image5,
-                    dtb_products.sub_title6,
-                    dtb_products.sub_comment6,
-                    dtb_products.sub_image6,
-                    dtb_products.sub_large_image6,
-                    dtb_products.del_flg,
-                    dtb_products.creator_id,
-                    dtb_products.create_date,
-                    dtb_products.update_date,
-                    dtb_products.deliv_date_id,
-                    T4.product_code_min,
-                    T4.product_code_max,
-                    T4.price01_min,
-                    T4.price01_max,
-                    T4.price02_min,
-                    T4.price02_max,
-                    T4.stock_min,
-                    T4.stock_max,
-                    T4.stock_unlimited_min,
-                    T4.stock_unlimited_max,
-                    T4.class_count
-                FROM
-                    dtb_products
-                    LEFT JOIN
+
+        static $sql = array();
+
+        if (empty($sql)) {
+
+            $sql['vw_cross_class'] = <<< __EOS__
+                (
+                    SELECT
+                        T1.class_id AS class_id1,
+                        T2.class_id AS class_id2,
+                        T1.classcategory_id AS classcategory_id1,
+                        T2.classcategory_id AS classcategory_id2,
+                        T1.name AS name1,
+                        T2.name AS name2,
+                        T1.rank AS rank1,
+                        T2.rank AS rank2
+                    FROM
+                        dtb_classcategory AS T1,
+                        dtb_classcategory AS T2
+                )
+__EOS__;
+
+            $sql['vw_cross_products_class'] = <<< __EOS__
+                (
+                    SELECT
+                        T1.class_id1,
+                        T1.class_id2,
+                        T1.classcategory_id1,
+                        T1.classcategory_id2,
+                        T2.product_id,
+                        T1.name1,
+                        T1.name2,
+                        T2.product_code,
+                        T2.stock,
+                        T2.price01,
+                        T2.price02,
+                        T1.rank1,
+                        T1.rank2
+                    FROM
+                        {$sql['vw_cross_class']} AS T1
+                        LEFT JOIN dtb_products_class AS T2
+                            ON T1.classcategory_id1 = T2.classcategory_id1
+                            AND T1.classcategory_id2 = T2.classcategory_id2
+                )
+__EOS__;
+
+            $sql['vw_products_nonclass'] = <<< __EOS__
+                (
+                    SELECT *
+                    FROM
+                        dtb_products AS T1
+                        LEFT JOIN
                         (
                             SELECT
-                                product_id,
-                                MIN(product_code) AS product_code_min,
-                                MAX(product_code) AS product_code_max,
-                                MIN(price01) AS price01_min,
-                                MAX(price01) AS price01_max,
-                                MIN(price02) AS price02_min,
-                                MAX(price02) AS price02_max,
-                                MIN(stock) AS stock_min,
-                                MAX(stock) AS stock_max,
-                                MIN(stock_unlimited) AS stock_unlimited_min,
-                                MAX(stock_unlimited) AS stock_unlimited_max,
-                                COUNT(*) as class_count
+                                product_id AS product_id_sub,
+                                product_code,
+                                price01,
+                                price02,
+                                stock,
+                                stock_unlimited,
+                                classcategory_id1,
+                                classcategory_id2
                             FROM dtb_products_class
-                            GROUP BY product_id
-                        ) AS T4
-                        ON dtb_products.product_id = T4.product_id
-            )
-__EOS__;
-
-        return array(
-            "vw_cross_class" => '
-                (SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS classcategory_id1, T2.classcategory_id AS classcategory_id2, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2
-                FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ) ',
-
-            "vw_cross_products_class" =>'
-                (SELECT T1.class_id1, T1.class_id2, T1.classcategory_id1, T1.classcategory_id2, T2.product_id,
-                T1.name1, T1.name2, T2.product_code, T2.stock, T2.price01, T2.price02, T1.rank1, T1.rank2
-                FROM (SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS classcategory_id1, T2.classcategory_id AS classcategory_id2, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2
-                FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ) AS T1 LEFT JOIN dtb_products_class AS T2
-                ON T1.classcategory_id1 = T2.classcategory_id1 AND T1.classcategory_id2 = T2.classcategory_id2) ',
-
-            "vw_products_nonclass" => '
-                (SELECT
-                    T1.product_id,
-                    T1.name,
-                    T1.deliv_fee,
-                    T1.sale_limit,
-                    T1.sale_unlimited,
-                    T1.category_id,
-                    T1.rank,
-                    T1.status,
-                    T1.product_flag,
-                    T1.point_rate,
-                    T1.comment1,
-                    T1.comment2,
-                    T1.comment3,
-                    T1.comment4,
-                    T1.comment5,
-                    T1.comment6,
-                    T1.file1,
-                    T1.file2,
-                    T1.file3,
-                    T1.file4,
-                    T1.file5,
-                    T1.file6,
-                    T1.main_list_comment,
-                    T1.main_list_image,
-                    T1.main_comment,
-                    T1.main_image,
-                    T1.main_large_image,
-                    T1.sub_title1,
-                    T1.sub_comment1,
-                    T1.sub_image1,
-                    T1.sub_large_image1,
-                    T1.sub_title2,
-                    T1.sub_comment2,
-                    T1.sub_image2,
-                    T1.sub_large_image2,
-                    T1.sub_title3,
-                    T1.sub_comment3,
-                    T1.sub_image3,
-                    T1.sub_large_image3,
-                    T1.sub_title4,
-                    T1.sub_comment4,
-                    T1.sub_image4,
-                    T1.sub_large_image4,
-                    T1.sub_title5,
-                    T1.sub_comment5,
-                    T1.sub_image5,
-                    T1.sub_large_image5,
-                    T1.sub_title6,
-                    T1.sub_comment6,
-                    T1.sub_image6,
-                    T1.sub_large_image6,
-                    T1.del_flg,
-                    T1.creator_id,
-                    T1.create_date,
-                    T1.update_date,
-                    T1.note,
-                    T1.deliv_date_id,
-                    T2.product_id_sub,
-                    T2.product_code,
-                    T2.price01,
-                    T2.price02,
-                    T2.stock,
-                    T2.stock_unlimited,
-                    T2.classcategory_id1,
-                    T2.classcategory_id2
-                FROM (SELECT * FROM dtb_products &&noncls_where&&) AS T1 LEFT JOIN
-                (SELECT
-                product_id AS product_id_sub,
-                product_code,
-                price01,
-                price02,
-                stock,
-                stock_unlimited,
-                classcategory_id1,
-                classcategory_id2
-                FROM dtb_products_class WHERE classcategory_id1 = 0 AND classcategory_id2 = 0)
-                AS T2
-                ON T1.product_id = T2.product_id_sub) ',
-
-            "vw_products_allclass" => "
-            (
-                SELECT
-                    alldtl.*,
-                    dtb_category.rank AS category_rank,
-                    T2.category_id,
-                    T2.rank AS product_rank
-                FROM
-                    {$sql['vw_products_allclass_detail']} AS alldtl
-                    LEFT JOIN
-                        dtb_product_categories AS T2
-                        ON alldtl.product_id = T2.product_id
-                    LEFT JOIN
-                        dtb_category
-                        ON T2.category_id = dtb_category.category_id
-            ) ",
-
-            "vw_products_allclass_detail" => $sql['vw_products_allclass_detail'],
-
-            "vw_product_class" => '
+                            WHERE
+                                classcategory_id1 = 0
+                                AND classcategory_id2 = 0
+                        ) AS T2
+                        ON T1.product_id = T2.product_id_sub
+                )
+__EOS__;
+
+            $sql['vw_products_allclass_detail'] = <<< __EOS__
+                (
+                    SELECT
+                        dtb_products.product_id,
+                        dtb_products.name,
+                        dtb_products.deliv_fee,
+                        dtb_products.sale_limit,
+                        dtb_products.maker_id,
+                        dtb_products.rank,
+                        dtb_products.status,
+                        dtb_products.product_flag,
+                        dtb_products.point_rate,
+                        dtb_products.comment1,
+                        dtb_products.comment2,
+                        dtb_products.comment3,
+                        dtb_products.comment4,
+                        dtb_products.comment5,
+                        dtb_products.comment6,
+                        dtb_products.note,
+                        dtb_products.file1,
+                        dtb_products.file2,
+                        dtb_products.file3,
+                        dtb_products.file4,
+                        dtb_products.file5,
+                        dtb_products.file6,
+                        dtb_products.main_list_comment,
+                        dtb_products.main_list_image,
+                        dtb_products.main_comment,
+                        dtb_products.main_image,
+                        dtb_products.main_large_image,
+                        dtb_products.sub_title1,
+                        dtb_products.sub_comment1,
+                        dtb_products.sub_image1,
+                        dtb_products.sub_large_image1,
+                        dtb_products.sub_title2,
+                        dtb_products.sub_comment2,
+                        dtb_products.sub_image2,
+                        dtb_products.sub_large_image2,
+                        dtb_products.sub_title3,
+                        dtb_products.sub_comment3,
+                        dtb_products.sub_image3,
+                        dtb_products.sub_large_image3,
+                        dtb_products.sub_title4,
+                        dtb_products.sub_comment4,
+                        dtb_products.sub_image4,
+                        dtb_products.sub_large_image4,
+                        dtb_products.sub_title5,
+                        dtb_products.sub_comment5,
+                        dtb_products.sub_image5,
+                        dtb_products.sub_large_image5,
+                        dtb_products.sub_title6,
+                        dtb_products.sub_comment6,
+                        dtb_products.sub_image6,
+                        dtb_products.sub_large_image6,
+                        dtb_products.del_flg,
+                        dtb_products.creator_id,
+                        dtb_products.create_date,
+                        dtb_products.update_date,
+                        dtb_products.deliv_date_id,
+                        T4.product_code_min,
+                        T4.product_code_max,
+                        T4.price01_min,
+                        T4.price01_max,
+                        T4.price02_min,
+                        T4.price02_max,
+                        T4.stock_min,
+                        T4.stock_max,
+                        T4.stock_unlimited_min,
+                        T4.stock_unlimited_max,
+                        T4.class_count
+                    FROM
+                        dtb_products
+                        LEFT JOIN
+                            (
+                                SELECT
+                                    product_id,
+                                    MIN(product_code) AS product_code_min,
+                                    MAX(product_code) AS product_code_max,
+                                    MIN(price01) AS price01_min,
+                                    MAX(price01) AS price01_max,
+                                    MIN(price02) AS price02_min,
+                                    MAX(price02) AS price02_max,
+                                    MIN(stock) AS stock_min,
+                                    MAX(stock) AS stock_max,
+                                    MIN(stock_unlimited) AS stock_unlimited_min,
+                                    MAX(stock_unlimited) AS stock_unlimited_max,
+                                    COUNT(*) as class_count
+                                FROM dtb_products_class
+                                GROUP BY product_id
+                            ) AS T4
+                            ON dtb_products.product_id = T4.product_id
+                )
+__EOS__;
+
+            $sql['vw_products_allclass'] = <<< __EOS__
+                (
+                    SELECT
+                        alldtl.*,
+                        dtb_category.rank AS category_rank,
+                        T2.category_id,
+                        T2.rank AS product_rank
+                    FROM
+                        {$sql['vw_products_allclass_detail']} AS alldtl
+                        LEFT JOIN
+                            dtb_product_categories AS T2
+                            ON alldtl.product_id = T2.product_id
+                        LEFT JOIN
+                            dtb_category
+                            ON T2.category_id = dtb_category.category_id
+                )
+__EOS__;
+
+            $sql['vw_product_class'] = <<< __EOS__
                 (SELECT * FROM
                 (SELECT T3.product_class_id, T3.product_id AS product_id_sub, classcategory_id1, classcategory_id2,
@@ -499,11 +456,16 @@
                 AS T3 LEFT JOIN dtb_classcategory AS T4
                 ON T3.classcategory_id2 = T4.classcategory_id) AS T5 LEFT JOIN dtb_products AS T6
-                ON product_id_sub = T6.product_id) ',
-
-            "vw_category_count" => '
+                ON product_id_sub = T6.product_id)
+__EOS__;
+
+            $sql['vw_category_count'] = <<< __EOS__
                 (SELECT T1.category_id, T1.category_name, T1.parent_category_id, T1.level, T1.rank, T2.product_count
                 FROM dtb_category AS T1 LEFT JOIN dtb_category_total_count AS T2
-                ON T1.category_id = T2.category_id) '
-        );
+                ON T1.category_id = T2.category_id)
+__EOS__;
+        }
+
+        return $sql;
+
     }
 }
Index: tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php
===================================================================
--- tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php	(revision 16938)
+++ tmp/version-2_5-test/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php	(revision 18609)
@@ -47,5 +47,4 @@
     function sfGetDBVersion($dsn = "") {
         $objQuery = new SC_Query($this->getDSN($dsn), true, true);
-        list($db_type) = split(":", $dsn);
         $val = $objQuery->getOne("select version()");
         $arrLine = split(" " , $val);
Index: tmp/version-2_5-test/data/class/SC_Image.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Image.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_Image.php	(revision 18609)
@@ -29,5 +29,5 @@
     function SC_Image($tmp_dir) {
         // ヘッダファイル読込
-        if(!ereg("/$", $tmp_dir)) {
+        if (!ereg("/$", $tmp_dir)) {
             $this->tmp_dir = $tmp_dir . "/";
         } else {
@@ -52,6 +52,6 @@
         $from_path = $this->tmp_dir.$filename;
         $to_path = $save_dir."/".$filename;
-        if(file_exists($from_path) && file_exists($save_dir)) {
-            if(copy($from_path , $to_path)) {
+        if (file_exists($from_path) && file_exists($save_dir)) {
+            if (copy($from_path , $to_path)) {
                 unlink($from_path);
             }
@@ -63,5 +63,5 @@
     //---- 指定ファイルを削除
     function deleteImage($filename, $dir) {
-        if(file_exists($dir."/".$filename)) {
+        if (file_exists($dir."/".$filename)) {
             unlink($dir."/".$filename);
         }
@@ -88,21 +88,21 @@
         $PreWord = $head;
 
-            //拡張子取得
-            if (!$ext) {
-                $array_ext = explode(".", $FromImgPath);
-                $ext = $array_ext[count($array_ext) - 1];
-            }
+        //拡張子取得
+        if (!$ext) {
+            $array_ext = explode(".", $FromImgPath);
+            $ext = $array_ext[count($array_ext) - 1];
+        }
 
         $MW = $ThmMaxWidth;
-        if($tmpMW) $MW = $tmpMW; // $MWに最大横幅セット
+        if ($tmpMW) $MW = $tmpMW; // $MWに最大横幅セット
 
         $MH = $ThmMaxHeight;
-        if($tmpMH) $MH = $tmpMH; // $MHに最大縦幅セット
-
-        if(empty($FromImgPath) || empty($ToImgPath)){
+        if ($tmpMH) $MH = $tmpMH; // $MHに最大縦幅セット
+
+        if (empty($FromImgPath) || empty($ToImgPath)){
             return array(0,"出力元画像パス、または出力先フォルダが指定されていません。");
         }
 
-        if(!file_exists($FromImgPath)){
+        if (!file_exists($FromImgPath)){
             return array(0,"出力元画像が見つかりません。");
         }
@@ -111,5 +111,5 @@
         $re_size = $size;
 
-        if(!$size[2] || $size[2] > 3){ // 画像の種類が不明 or swf
+        if (!$size[2] || $size[2] > 3){ // 画像の種類が不明 or swf
             return array(0,"画像形式がサポートされていません。");
         }
@@ -118,16 +118,16 @@
         $tmp_w = $size[0] / $MW;
 
-        if($MH != 0){
+        if ($MH != 0){
             $tmp_h = $size[1] / $MH;
         }
 
-        if($tmp_w > 1 || $tmp_h > 1){
-            if($MH == 0){
-                if($tmp_w > 1){
+        if ($tmp_w > 1 || $tmp_h > 1){
+            if ($MH == 0){
+                if ($tmp_w > 1){
                     $re_size[0] = $MW;
                     $re_size[1] = $size[1] * $MW / $size[0];
                 }
             } else {
-                if($tmp_w > $tmp_h){
+                if ($tmp_w > $tmp_h){
                     $re_size[0] = $MW;
                     $re_size[1] = $size[1] * $MW / $size[0];
@@ -148,6 +148,6 @@
         switch($size[2]) {
         case "1": //gif形式
-            if($tmp_w <= 1 && $tmp_h <= 1){
-                if ( $newFileName ) {
+            if ($tmp_w <= 1 && $tmp_h <= 1){
+                if ($newFileName) {
                     $ToFile = $newFileName;
                 } elseif  ($ext) {
@@ -156,5 +156,5 @@
                     $ToFile .= ".gif";
                 }
-                if(!@copy($FromImgPath , $ToImgPath.$ToFile)) { // エラー処理
+                if (!@copy($FromImgPath , $ToImgPath.$ToFile)) { // エラー処理
                     return array(0,"ファイルのコピーに失敗しました。");
                 }
@@ -169,7 +169,7 @@
             ImageRectangle ($ImgNew,0,0,($re_size[0]-1),($re_size[1]-1),    $black);
 
-            if ( $newFileName ) {
+            if ($newFileName) {
                 $ToFile = $newFileName;
-            } elseif($ext) {
+            } elseif ($ext) {
                 $ToFile .= "." . $ext;
             } else {
@@ -178,5 +178,5 @@
             $TmpPath = $ToImgPath.$ToFile;
             @Imagepng($ImgNew,$TmpPath);
-            if(!@file_exists($TmpPath)){ // 画像が作成されていない場合
+            if (!@file_exists($TmpPath)){ // 画像が作成されていない場合
                 return array(0,"画像の出力に失敗しました。");
             }
@@ -188,5 +188,5 @@
             //ImageCopyResized( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
 
-            if($re_size[0] != $size[0] || $re_size[0] != $size[0]) {
+            if ($re_size[0] != $size[0] || $re_size[0] != $size[0]) {
                 ImageCopyResampled( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
             }
@@ -197,7 +197,7 @@
 
 
-            if ( $newFileName ) {
+            if ($newFileName) {
                 $ToFile = $newFileName;
-            } elseif($ext) {
+            } elseif ($ext) {
                 $ToFile .= "." . $ext;
             } else {
@@ -206,5 +206,5 @@
             $TmpPath = $ToImgPath.$ToFile;
             @ImageJpeg($ImgNew,$TmpPath);
-            if(!@file_exists($TmpPath)){ // 画像が作成されていない場合
+            if (!@file_exists($TmpPath)){ // 画像が作成されていない場合
                 return array(0,"画像の出力に失敗しました。<br>${ImgNew}<br>${TmpPath}");
             }
@@ -217,5 +217,5 @@
             ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
 
-            if ( $newFileName ) {
+            if ($newFileName) {
                 $ToFile = $newFileName;
             } elseif ($ext) {
@@ -226,5 +226,5 @@
             $TmpPath = $ToImgPath.$ToFile;
             @ImagePNG($ImgNew,$TmpPath );
-            if(!@file_exists($TmpPath)){ // 画像が作成されていない場合
+            if (!@file_exists($TmpPath)){ // 画像が作成されていない場合
                 return array(0,"画像の出力に失敗しました。");
             }
Index: tmp/version-2_5-test/data/class/SC_CampaignSession.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_CampaignSession.php	(revision 17591)
+++ tmp/version-2_5-test/data/class/SC_CampaignSession.php	(revision 18609)
@@ -73,14 +73,12 @@
     /* キャンペーンページならフレームを変更 */
     function pageView($objView, $site_frame = SITE_FRAME) {
-        $self_path = explode("/",$_SERVER['PHP_SELF']);
-        $campaign_dir = explode("/",CAMPAIGN_DIR);
-        
-        $is_campaign = array_search( $campaign_dir[0] , $self_path );
-        
-        if( strlen($is_campaign) > 0 ) {
-            $objView->display($site_frame);
-        } else {
-            $objView->display($site_frame);
+        // XXX キャンペーン削除で不具合があったので、応急処置をしています。(テスト不十分)
+        if ($this->getIsCampaign()) {
+            $site_frame_campaign = CAMPAIGN_TEMPLATE_PATH . $this->getCampaignDir()  . "/active/site_frame.tpl";
+            if (file_exists($site_frame_campaign)) {
+                $site_frame = $site_frame_campaign;
+            }
         }
+        $objView->display($site_frame);
     }
 }
Index: tmp/version-2_5-test/data/class/SC_UploadFile.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_UploadFile.php	(revision 18007)
+++ tmp/version-2_5-test/data/class/SC_UploadFile.php	(revision 18609)
@@ -29,14 +29,34 @@
     var $temp_dir;
     var $save_dir;
-    var $keyname;	// ファイルinputタグのname
-    var $width;		// 横サイズ
-    var $height;	// 縦サイズ
-    var $arrExt;	// 指定する拡張子
-    var $temp_file;	// 保存されたファイル名
-    var $save_file; // DBから読み出したファイル名
-    var $disp_name;	// 項目名
-    var $size;		// 制限サイズ
-    var $necessary; // 必須の場合:true
-    var $image;		// 画像の場合:true
+
+    /** ファイルinputタグのname */
+    var $keyname = array();
+
+    /** 横サイズ */
+    var $width = array();
+
+    /** 縦サイズ */
+    var $height = array();
+
+    /** 指定する拡張子 */
+    var $arrExt = array();
+
+    /** 保存されたファイル名 */
+    var $temp_file = array();
+
+    /** DBから読み出したファイル名 */
+    var $save_file = array();
+
+    /** 項目名 */
+    var $disp_name = array();
+
+    /** 制限サイズ */
+    var $size = array();
+
+    /** 必須の場合:true */
+    var $necessary = array();
+
+    /** 画像の場合:true */
+    var $image = array();
 
     // ファイル管理クラス
@@ -338,5 +358,5 @@
      * @param string $rename
      * @param int $keyname
-     * @return strgin $dst_file
+     * @return string
      */
     function lfGetTmpImageName($rename, $keyname = "", $uploadfile = ""){
Index: tmp/version-2_5-test/data/class/SC_CheckError.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_CheckError.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_CheckError.php	(revision 18609)
@@ -28,5 +28,5 @@
  */
 class SC_CheckError {
-    var $arrErr;
+    var $arrErr = array();
     var $arrParam;
 
@@ -296,5 +296,4 @@
         }
 
-        $total_count = 0;
         for($i = 1; $i <= 3; $i++) {
             if(strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $value[4]) {
@@ -303,10 +302,4 @@
                 $this->arrErr[$value[$i]] .= "※ " . $value[0] . $i . "は数字で入力してください。<br />";
             }
-            $total_count += strlen($this->arrParam[$value[$i]]);
-        }
-
-        // 合計値チェック
-        if ($total_count > TEL_LEN) {
-            $this->arrErr[$value[3]] .= "※ " . $value[0] . "は" . TEL_LEN . "文字以内で入力してください。<br />";
         }
     }
@@ -501,5 +494,5 @@
         $count = strlen($this->arrParam[$value[1]]);
         if( ( $count > 0 ) && $value[2] > $count || $value[3] < $count ) {
-            $this->arrErr[$value[1]] =  "※ $value[0]は$value[2]桁〜$value[3]桁で入力して下さい。<br />";
+            $this->arrErr[$value[1]] =  "※ $value[0]は$value[2]桁～$value[3]桁で入力して下さい。<br />";
         }
     }
@@ -525,5 +518,30 @@
         }
         $this->createParam($value);
-        if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^[^@]+@[^.^@]+\..+", $this->arrParam[$value[1]])) {
+
+        $wsp           = '[\x20\x09]';
+        $vchar         = '[\x21-\x7e]';
+        $quoted_pair   = "\\\\(?:$vchar|$wsp)";
+        $qtext         = '[\x21\x23-\x5b\x5d-\x7e]';
+        $qcontent      = "(?:$qtext|$quoted_pair)";
+        $quoted_string = "\"$qcontent*\"";
+        $atext         = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]';
+        $dot_atom_text = "$atext+(?:[.]$atext+)*";
+        $dot_atom      = $dot_atom_text;
+        $local_part    = "(?:$dot_atom|$quoted_string)";
+        $domain        = $dot_atom;
+        $addr_spec     = "${local_part}[@]$domain";
+
+        $dot_atom_loose   = "$atext+(?:[.]|$atext)*";
+        $local_part_loose = "(?:$dot_atom_loose|$quoted_string)";
+        $addr_spec_loose  = "${local_part_loose}[@]$domain";
+
+        if (RFC_COMPLIANT_EMAIL_CHECK) {
+            $regexp = "/\A${addr_spec}\z/";
+		} else {
+            // 携帯メールアドレス用に、..や.@を許容する。
+            $regexp = "/\A${addr_spec_loose}\z/";
+        }
+
+        if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match($regexp, $this->arrParam[$value[1]])) {
             $this->arrErr[$value[1]] = "※ " . $value[0] . "の形式が不正です。<br />";
         }
@@ -723,4 +741,37 @@
             }
         }
+    }
+
+    //誕生日チェック
+    // value[0] = 項目名
+    // value[1] = YYYY
+    // value[2] = MM
+    // value[3] = DD
+    function CHECK_BIRTHDAY($value) {
+        if (isset($this->arrErr[$value[1]])) {
+            return;
+        }
+
+        $this->createParam($value);
+        // 年が入力されている。
+        if ($this->arrParam[$value[1]] > 0) {
+            
+            // 年の数字チェック、最小数値制限チェック
+            $this->doFunc(array($value[0].'(年)', $value[1], START_BIRTH_YEAR), array("NUM_CHECK", "MIN_CHECK"));
+            // 上のチェックでエラーある場合、中断する。
+            if (isset($this->arrErr[$value[1]])) {
+                return;
+            }
+            
+            // 年の最大数値制限チェック
+            $this->doFunc(array($value[0].'(年)', $value[1], date("Y",strtotime("now"))), array("MAX_CHECK"));
+            // 上のチェックでエラーある場合、中断する。
+            if (isset($this->arrErr[$value[1]])) {
+                return;
+            }
+        }
+        
+        // XXX createParam() が二重に呼ばれる問題を抱える
+        $this->CHECK_DATE($value);
     }
 
Index: tmp/version-2_5-test/data/class/SC_Initial.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_Initial.php	(revision 18562)
+++ tmp/version-2_5-test/data/class/SC_Initial.php	(revision 18609)
@@ -38,5 +38,6 @@
 
         /** EC-CUBEのバージョン */
-        define('ECCUBE_VERSION', "2.4.3");
+        // XXX SVNのリビジョンを付加できたら良いと思う。(方法が分からない。)
+        define('ECCUBE_VERSION', "2.4.2-comu");
     }
 
@@ -54,7 +55,10 @@
         $this->defineDSN();
         $this->setErrorReporting();
+        $this->defineDirectoryIndex();
+        $this->defineErrorType();
         $this->defineConstants();
         $this->mbstringInit();
         $this->createCacheDir();
+        $this->resetSuperglobalsRequest();
     }
 
@@ -101,4 +105,8 @@
     function setErrorReporting() {
         error_reporting(E_ALL & ~E_NOTICE);
+        // PHP 5.3.0対応
+        if (error_reporting() > 6143) {
+            error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
+        }
     }
 
@@ -119,6 +127,38 @@
         ini_set("mbstring.detect_order", "auto");
         ini_set("mbstring.substitute_character", "none");
+        
+        mb_language('ja'); // mb_internal_encoding() より前に
+        // TODO 他に mb_language() している箇所の削除を検討
+        // TODO .htaccess の mbstring.language を削除できないか検討
+        
+        mb_internal_encoding(CHAR_CODE); // mb_language() より後で
+        // TODO 上の「ini_set("mbstring.internal_encoding", CHAR_CODE);」を削除できないか検討
+        // TODO .htaccess の mbstring.internal_encoding を削除できないか検討
+        
         //ロケールを明示的に設定
         setlocale(LC_ALL, LOCALE);
+    }
+
+    /**
+     * 定数 DIR_INDEX_URL を設定する.
+     *
+     * @access protected
+     * @return void
+     */
+    function defineDirectoryIndex() {
+        
+        // DirectoryIndex の実ファイル名
+        if (!defined('DIR_INDEX_FILE')) {
+            define('DIR_INDEX_FILE', 'index.php');
+        }
+        
+        // DIR_INDEX_FILE にアクセスする時の URL のファイル名部を定義する
+        if (USE_FILENAME_DIR_INDEX === true) {
+            // ファイル名を使用する
+            define('DIR_INDEX_URL', DIR_INDEX_FILE);
+        } else {
+            // ファイル名を使用しない
+            define('DIR_INDEX_URL', '');
+        }
     }
 
@@ -177,5 +217,5 @@
         if (defined("HTML_PATH")) {
             umask(0);
-        	if (!file_exists(COMPILE_DIR)) {
+            if (!file_exists(COMPILE_DIR)) {
                 mkdir(COMPILE_DIR);
             }
@@ -194,4 +234,82 @@
         }
     }
+
+    /**
+     * エラー種別を定数定義
+     *
+     * @access protected
+     * @return void
+     */
+    function defineErrorType() {
+        // LC_Page_Error用
+        /** 指定商品ページがない */
+        define('PRODUCT_NOT_FOUND', 1);
+        /** カート内が空 */
+        define('CART_EMPTY', 2);
+        /** ページ推移エラー */
+        define('PAGE_ERROR', 3);
+        /** 購入処理中のカート商品追加エラー */
+        define('CART_ADD_ERROR', 4);
+        /** 他にも購入手続きが行われた場合 */
+        define('CANCEL_PURCHASE', 5);
+        /** 指定カテゴリページがない */
+        define('CATEGORY_NOT_FOUND', 6);
+        /** ログインに失敗 */
+        define('SITE_LOGIN_ERROR', 7);
+        /** 会員専用ページへのアクセスエラー */
+        define('CUSTOMER_ERROR', 8);
+        /** 購入時の売り切れエラー */
+        define('SOLD_OUT', 9);
+        /** カート内商品の読込エラー */
+        define('CART_NOT_FOUND', 10);
+        /** ポイントの不足 */
+        define('LACK_POINT', 11);
+        /** 仮登録者がログインに失敗 */
+        define('TEMP_LOGIN_ERROR', 12);
+        /** URLエラー */
+        define('URL_ERROR', 13);
+        /** ファイル解凍エラー */
+        define('EXTRACT_ERROR', 14);
+        /** FTPダウンロードエラー */
+        define('FTP_DOWNLOAD_ERROR', 15);
+        /** FTPログインエラー */
+        define('FTP_LOGIN_ERROR', 16);
+        /** FTP接続エラー */
+        define('FTP_CONNECT_ERROR', 17);
+        /** DB作成エラー */
+        define('CREATE_DB_ERROR', 18);
+        /** DBインポートエラー */
+        define('DB_IMPORT_ERROR', 19);
+        /** 設定ファイル存在エラー */
+        define('FILE_NOT_FOUND', 20);
+        /** 書き込みエラー */
+        define('WRITE_FILE_ERROR', 21);
+        /** DB接続エラー */
+        define('DB_CONNECT_ERROR', 22);
+        /** フリーメッセージ */
+        define('FREE_ERROR_MSG', 999);
+
+        // LC_Page_Error_DispError用
+        /** ログイン失敗 */
+        define('LOGIN_ERROR', 1);
+        /** アクセス失敗（タイムアウト等） */
+        define('ACCESS_ERROR', 2);
+        /** アクセス権限違反 */
+        define('AUTH_ERROR', 3);
+        /** 不正な遷移エラー */
+        define('INVALID_MOVE_ERRORR', 4);
+    }
+
+    /**
+     * スーパーグローバル変数「$_REQUEST」を再セット
+     *
+     * variables_order ディレクティブによる差を吸収する。
+     *
+     * @access protected
+     * @return void
+     */
+    function resetSuperglobalsRequest() {
+        $_REQUEST = array_merge($_GET, $_POST);
+    }
 }
 ?>
Index: tmp/version-2_5-test/data/class/SC_PageNavi.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_PageNavi.php	(revision 16741)
+++ tmp/version-2_5-test/data/class/SC_PageNavi.php	(revision 18609)
@@ -35,17 +35,16 @@
 */
 class SC_PageNavi {
-    var $now_page;		// 現在のページ番号
-    var $max_page;		// 最終のページ番号
-    var $start_row;		// 開始レコード
-    var $strnavi;		// ページ送り文字列
-    var $arrPagenavi = array();	// ページ
+    var $now_page;      // 現在のページ番号
+    var $max_page;      // 最終のページ番号
+    var $start_row;     // 開始レコード
+    var $strnavi;       // ページ送り文字列
+    var $arrPagenavi = array(); // ページ
 
     // コンストラクタ
-    function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX) {
+    function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX, $urlParam = '') {
         $this->arrPagenavi['mode'] = 'search';
-        $ps = htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES);
 
         //現在ページ($now_page)が正しい数値でない場合
-        if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || $now_page == "") {
+        if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || strlen($now_page) == 0) {
             $this->now_page = 1;
         } else {
@@ -58,5 +57,5 @@
 
         // 最終ページよりも現在ページが大きい場合は、最初に戻す。
-        if($this->max_page < $this->now_page) {
+        if ($this->max_page < $this->now_page) {
             $this->now_page = 1;
         }
@@ -69,5 +68,5 @@
         }
 
-        if($all_row > 1) {
+        if ($all_row > 1) {
 
             //「前へ」「次へ」の設定
@@ -75,19 +74,23 @@
             $next = "";
             if ($this->now_page > 1) {
-                $before="<a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) - 1) . "'); return false;\">&lt;&lt;前へ</a> ";
-                $this->arrPagenavi['before'] = ($this->now_page) - 1;
-            }else{
+                $this->arrPagenavi['before'] = $this->now_page - 1;
+                $urlParamThis = str_replace('#page#', $this->arrPagenavi['before'], $urlParam);
+                $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES);
+                $before = "<a href=\"?$urlParamThis\" onclick=\"$func_name('{$this->arrPagenavi['before']}'); return false;\">&lt;&lt;前へ</a> ";
+            } else {
                 $this->arrPagenavi['before'] = $this->now_page;
             }
 
             if ($this->now_page < $this->max_page) {
-                $next=" <a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) + 1) ."'); return false;\">次へ&gt;&gt;</a>";
-                $this->arrPagenavi['next'] = ($this->now_page) + 1;
-            }else{
+                $this->arrPagenavi['next'] = $this->now_page + 1;
+                $urlParamThis = str_replace('#page#', $this->arrPagenavi['next'], $urlParam);
+                $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES);
+                $next = " <a href=\"?$urlParamThis\" onclick=\"$func_name('{$this->arrPagenavi['next']}'); return false;\">次へ&gt;&gt;</a>";
+            } else {
                 $this->arrPagenavi['next'] = $this->now_page;
             }
 
             // 表示する最大ナビ数を決める。
-            if($navi_max == "" || $navi_max > $this->max_page) {
+            if ($navi_max == "" || $navi_max > $this->max_page) {
                 // 制限ナビ数の指定がない。ページ最大数が制限ナビ数より少ない。
                 $disp_max = $this->max_page;
@@ -96,5 +99,5 @@
                 $disp_max = $this->now_page + $navi_max - 1;
                 // ページ最大数を超えている場合は、ページ最大数に合わせる。
-                if($disp_max > $this->max_page) {
+                if ($disp_max > $this->max_page) {
                     $disp_max = $this->max_page;
                 }
@@ -102,5 +105,5 @@
 
             // 表示する最小ナビ数を決める。
-            if($navi_max == "" || $navi_max > $this->now_page) {
+            if ($navi_max == "" || $navi_max > $this->now_page) {
                 // 制限ナビ数の指定がない。現在ページ番号が制限ナビ数より少ない。
                 $disp_min = 1;
@@ -114,5 +117,5 @@
             for ($i=$disp_min; $i <= $disp_max; $i++) {
 
-                if($i != $disp_max) {
+                if ($i != $disp_max) {
                     $sep = " | ";
                 } else {
@@ -123,8 +126,10 @@
                     $page_number .= "<strong>$i</strong>";
                 } else {
-                    $page_number.="<a href=\"".  $ps . "\" onclick=\"$func_name('$i'); return false;\">$i</a>";
+                    $urlParamThis = str_replace('#page#', $i, $urlParam);
+                    $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES);
+                    $page_number .= "<a href=\"?$urlParamThis\" onclick=\"$func_name('$i'); return false;\">$i</a>";
                 }
 
-                $page_number.=$sep;
+                $page_number .= $sep;
 
                 $this->arrPagenavi['arrPageno'][$i] = $i;
@@ -134,5 +139,5 @@
                 $this->strnavi = $before .$page_number .$next;
             }
-        }else{
+        } else {
             $this->arrPagenavi['arrPageno'][0] = 1;
             $this->arrPagenavi['before'] = 1;
Index: tmp/version-2_5-test/data/class/SC_CartSession.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_CartSession.php	(revision 17465)
+++ tmp/version-2_5-test/data/class/SC_CartSession.php	(revision 18609)
@@ -90,6 +90,12 @@
     }
 
-    // 商品ごとの合計価格
-    function getProductTotal($arrInfo, $id) {
+    /**
+     * 商品ごとの合計価格
+     * XXX 実際には、「商品」ではなく、「カートの明細行(≒商品規格)」のような気がします。
+     *
+     * @param integer $id
+     * @return string 商品ごとの合計価格(税込み)
+     */
+    function getProductTotal($id) {
         $max = $this->getMax();
         for($i = 0; $i <= $max; $i++) {
@@ -100,5 +106,5 @@
                 $price = $_SESSION[$this->key][$i]['price'];
                 $quantity = $_SESSION[$this->key][$i]['quantity'];
-                $pre_tax = SC_Utils_Ex::sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+                $pre_tax = SC_Helper_DB_Ex::sfPreTax($price);
                 $total = $pre_tax * $quantity;
                 return $total;
@@ -148,5 +154,5 @@
 
     // 全商品の合計価格
-    function getAllProductsTotal($arrInfo) {
+    function getAllProductsTotal() {
         // 税込み合計
         $total = 0;
@@ -164,5 +170,5 @@
             $quantity = $_SESSION[$this->key][$i]['quantity'];
 
-            $pre_tax = SC_Utils::sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+            $pre_tax = SC_Helper_DB_Ex::sfPreTax($price);
             $total+= ($pre_tax * $quantity);
         }
@@ -171,5 +177,5 @@
 
     // 全商品の合計税金
-    function getAllProductsTax($arrInfo) {
+    function getAllProductsTax() {
         // 税合計
         $total = 0;
@@ -178,5 +184,5 @@
             $price = $_SESSION[$this->key][$i]['price'];
             $quantity = $_SESSION[$this->key][$i]['quantity'];
-            $tax = SC_Utils_Ex::sfTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+            $tax = SC_Helper_DB_Ex::sfTax($price);
             $total+= ($tax * $quantity);
         }
@@ -188,20 +194,22 @@
         // ポイント合計
         $total = 0;
-        $max = $this->getMax();
-        for($i = 0; $i <= $max; $i++) {
-            $price = $_SESSION[$this->key][$i]['price'];
-            $quantity = $_SESSION[$this->key][$i]['quantity'];
-
-            if (!isset($_SESSION[$this->key][$i]['point_rate'])) {
-                $_SESSION[$this->key][$i]['point_rate'] = "";
-            }
-            $point_rate = $_SESSION[$this->key][$i]['point_rate'];
-
-            if (!isset($_SESSION[$this->key][$i]['id'][0])) {
-                $_SESSION[$this->key][$i]['id'][0] = "";
-            }
-            $id = $_SESSION[$this->key][$i]['id'][0];
-            $point = SC_Utils_Ex::sfPrePoint($price, $point_rate, POINT_RULE, $id);
-            $total+= ($point * $quantity);
+        if (USE_POINT !== false) {
+            $max = $this->getMax();
+            for($i = 0; $i <= $max; $i++) {
+                $price = $_SESSION[$this->key][$i]['price'];
+                $quantity = $_SESSION[$this->key][$i]['quantity'];
+
+                if (!isset($_SESSION[$this->key][$i]['point_rate'])) {
+                    $_SESSION[$this->key][$i]['point_rate'] = "";
+                }
+                $point_rate = $_SESSION[$this->key][$i]['point_rate'];
+
+                if (!isset($_SESSION[$this->key][$i]['id'][0])) {
+                    $_SESSION[$this->key][$i]['id'][0] = "";
+                }
+                $id = $_SESSION[$this->key][$i]['id'][0];
+                $point = SC_Utils_Ex::sfPrePoint($price, $point_rate, POINT_RULE, $id);
+                $total+= ($point * $quantity);
+            }
         }
         return $total;
@@ -241,5 +249,4 @@
         // 前頁として記録しないページを指定する。
         $arrExclude = array(
-            "detail_image.php",
             "/shopping/"
         );
@@ -322,5 +329,5 @@
     }
 
-    // 個数の増加
+    // 数量の増加
     function upQuantity($cart_no) {
         $max = $this->getMax();
@@ -334,5 +341,5 @@
     }
 
-    // 個数の減少
+    // 数量の減少
     function downQuantity($cart_no) {
         $max = $this->getMax();
@@ -342,28 +349,4 @@
                     $_SESSION[$this->key][$i]['quantity']--;
                 }
-            }
-        }
-    }
-
-    // 全商品の合計送料
-    function getAllProductsDelivFee() {
-        // ポイント合計
-        $total = 0;
-        $max = $this->getMax();
-        for($i = 0; $i <= $max; $i++) {
-            $deliv_fee = $_SESSION[$this->key][$i]['deliv_fee'];
-            $quantity = $_SESSION[$this->key][$i]['quantity'];
-            $total+= ($deliv_fee * $quantity);
-        }
-        return $total;
-    }
-
-    // カートの中の売り切れチェック
-    function chkSoldOut($arrCartList, $is_mobile = false){
-        foreach($arrCartList as $key => $val){
-            if($val['quantity'] == 0){
-                // 売り切れ商品をカートから削除する
-                $this->delProduct($val['cart_no']);
-                SC_Utils_Ex::sfDispSiteError(SOLD_OUT, "", true, "", $is_mobile);
             }
         }
Index: tmp/version-2_5-test/data/class/SC_SelectSql.php
===================================================================
--- tmp/version-2_5-test/data/class/SC_SelectSql.php	(revision 17473)
+++ tmp/version-2_5-test/data/class/SC_SelectSql.php	(revision 18609)
@@ -106,5 +106,5 @@
         }
 
-        //　開始〜終了
+        //　開始～終了
         if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) &&
             ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) {
