Index: /branches/version-2_12-dev/data/Smarty/templates/admin/contents/recommend.tpl
===================================================================
--- /branches/version-2_12-dev/data/Smarty/templates/admin/contents/recommend.tpl	(revision 21343)
+++ /branches/version-2_12-dev/data/Smarty/templates/admin/contents/recommend.tpl	(revision 21390)
@@ -141,5 +141,5 @@
         <!--{if $arrItems[$smarty.section.cnt.iteration].product_id}-->
         <tr><td colspan="4" class="no-border">
-        <a class="btn-action" href="javascript:;" onclick="return lfnCheckSubmit(document.form<!--{$smarty.section.cnt.iteration}-->);"><span class="btn-next">この内容で登録する</span></a>
+        <a class="btn-action" href="javascript:;" onclick="lfnCheckSubmit(document.form<!--{$smarty.section.cnt.iteration}-->); return false;"><span class="btn-next">この内容で登録する</span></a>
         </td>
         </tr>
Index: /branches/version-2_12-dev/data/Smarty/templates/sphone/cart/index.tpl
===================================================================
--- /branches/version-2_12-dev/data/Smarty/templates/sphone/cart/index.tpl	(revision 21227)
+++ /branches/version-2_12-dev/data/Smarty/templates/sphone/cart/index.tpl	(revision 21390)
@@ -123,5 +123,7 @@
                      </div>
                     <ul>
-                     <li><input type="number" name="quantity" class="cartin_quantity text data-role-none" value="<!--{$item.quantity}-->" max="9" style="" onchange="fnFormModeSubmit('form<!--{$key}-->', 'setQuantity','cart_no','<!--{$item.cart_no}-->');" /></li>
+                      <li class="quantity"><span class="mini">数量:</span><!--{$item.quantity|number_format}--></li>
+                      <li class="quantity_btn"><img src="<!--{$TPL_URLPATH}-->img/button/btn_plus.png" width="22" height="21" alt="＋" onclick="fnFormModeSubmit('form<!--{$key}-->', 'up','cart_no','<!--{$item.cart_no}-->'); return false" /></li>
+                      <li class="quantity_btn"><img src="<!--{$TPL_URLPATH}-->img/button/btn_minus.png" width="22" height="21" alt="-" onclick="fnFormModeSubmit('form<!--{$key}-->', 'down','cart_no','<!--{$item.cart_no}-->'); return false" /></a></li>
                       <li class="result"><span class="mini">小計：</span><!--{$item.total_inctax|number_format}-->円</li>
                     </ul>
Index: /branches/version-2_12-dev/data/class/SC_Initial.php
===================================================================
--- /branches/version-2_12-dev/data/class/SC_Initial.php	(revision 21310)
+++ /branches/version-2_12-dev/data/class/SC_Initial.php	(revision 21390)
@@ -113,12 +113,4 @@
      */
     function phpconfigInit() {
-        // E_DEPRECATED 定数 (for PHP < 5.3)
-        // TODO バージョン互換処理に統合したい。
-        $this->defineIfNotDefined('E_DEPRECATED', 8192);
-
-        // エラーレベル設定
-        // 開発時は E_ALL を推奨
-        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
-
         ini_set('display_errors', '1');
         ini_set('html_errors', '1');
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Customer.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Customer.php	(revision 21221)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Customer.php	(revision 21390)
@@ -276,10 +276,10 @@
      */
     function sfGetUniqSecretKey() {
-        $objQuery   =& SC_Query_Ex::getSingletonInstance();
-        $count      = 1;
-        while ($count != 0) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        do {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId('r');
-            $count  = $objQuery->count("dtb_customer", "secret_key = ?", array($uniqid));
-        }
+            $exists = $objQuery->exists("dtb_customer", "secret_key = ?", array($uniqid));
+        } while ($exists);
         return $uniqid;
     }
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Session.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Session.php	(revision 21194)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Session.php	(revision 21390)
@@ -84,7 +84,7 @@
      {
          $objQuery = new SC_Query_Ex();
-         $count = $objQuery->count("dtb_session", "sess_id = ?", array($id));
+         $exists = $objQuery->exists("dtb_session", "sess_id = ?", array($id));
          $sqlval = array();
-         if($count > 0) {
+         if ($exists) {
              // レコード更新
              $sqlval['sess_data'] = $sess_data;
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php	(revision 21328)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php	(revision 21390)
@@ -99,6 +99,6 @@
      * @param string $where データを検索する WHERE 句
      * @param string $dsn データソース名
-     * @param string $sql データの追加を行う場合の SQL文
-     * @param bool $add データの追加も行う場合 true
+     * @param string $sql @deprecated データの追加を行う場合の SQL文
+     * @param bool $add @deprecated データの追加も行う場合 true
      * @return bool データが存在する場合 true, データの追加に成功した場合 true,
      *               $add == false で, データが存在しない場合 false
@@ -109,13 +109,8 @@
 
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $count = $objQuery->count($table_name, $where, $arrval);
-
-        if($count > 0) {
-            $ret = true;
-        } else {
-            $ret = false;
-        }
+        $exists = $objQuery->exists($table_name, $where, $arrval);
+
         // データを追加する
-        if(!$ret && $add) {
+        if(!$exists && $add) {
             $objQuery->exec($sql);
         }
@@ -158,4 +153,5 @@
      *
      * @return int
+     * @deprecated
      */
     function sfGetBasisCount() {
@@ -163,4 +159,15 @@
 
         return $objQuery->count("dtb_baseinfo");
+    }
+
+    /**
+     * 基本情報の登録有無を取得する
+     *
+     * @return boolean 有無
+     */
+    function sfGetBasisExists() {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        return $objQuery->exists('dtb_baseinfo');
     }
 
@@ -1431,7 +1438,7 @@
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $where = 'product_id = ? AND del_flg = 0 AND class_combination_id IS NOT NULL';
-        $count = $objQuery->count('dtb_products_class', $where, array($product_id));
-
-        return $count >= 1;
+        $exists = $objQuery->exists('dtb_products_class', $where, array($product_id));
+
+        return $exists;
     }
 }
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Mobile.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Mobile.php	(revision 21354)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Mobile.php	(revision 21390)
@@ -384,7 +384,7 @@
             $arrValues['kara_mail_id'] = $objQuery->nextVal('dtb_mobile_kara_mail_kara_mail_id');
             $objQuery->insert('dtb_mobile_kara_mail', $arrValues);
-            $count = $objQuery->count('dtb_mobile_kara_mail', 'token = ?', array($token));
-
-            if ($count == 1) {
+            $exists = $objQuery->exists('dtb_mobile_kara_mail', 'token = ?', array($token));
+
+            if ($exists) {
                 break;
             }
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_PageLayout.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_PageLayout.php	(revision 20970)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_PageLayout.php	(revision 21390)
@@ -210,7 +210,7 @@
          * PHP ファイルは, 複数のデバイスで共有するため, device_type_id を条件に入れない
          */
-        $count = $objQuery->count('dtb_pagelayout', 'filename = ?', array($filename));
-
-        if ($count == 0) {
+        $exists = $objQuery->exists('dtb_pagelayout', 'filename = ?', array($filename));
+
+        if (!$exists) {
             // phpファイルの削除
             $del_php = HTML_REALDIR . $filename . '.php';
Index: /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php
===================================================================
--- /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php	(revision 21303)
+++ /branches/version-2_12-dev/data/class/helper/SC_Helper_Purchase.php	(revision 21390)
@@ -833,6 +833,6 @@
         $arrValues = $objQuery->extractOnlyColsOf($table, $arrParams);
 
-        $exists = $objQuery->count($table, $where, array($order_id));
-        if ($exists > 0) {
+        $exists = $objQuery->exists($table, $where, array($order_id));
+        if ($exists) {
 
             $this->sfUpdateOrderStatus($order_id, $arrValues['status'],
Index: /branches/version-2_12-dev/data/class/SC_Query.php
===================================================================
--- /branches/version-2_12-dev/data/class/SC_Query.php	(revision 21284)
+++ /branches/version-2_12-dev/data/class/SC_Query.php	(revision 21390)
@@ -106,5 +106,5 @@
 
     /**
-     *  エラー判定を行う.
+     * エラー判定を行う.
      *
      * @deprecated PEAR::isError() を使用して下さい
@@ -126,12 +126,21 @@
      * @return integer 件数
      */
-    function count($table, $where = "", $arrWhereVal = array()) {
-        if(strlen($where) <= 0) {
-            $sqlse = "SELECT COUNT(*) FROM $table";
-        } else {
-            $sqlse = "SELECT COUNT(*) FROM $table WHERE $where";
-        }
-        $sqlse = $this->dbFactory->sfChangeMySQL($sqlse);
-        return $this->getOne($sqlse, $arrWhereVal);
+    function count($table, $where = '', $arrWhereVal = array()) {
+        return $this->get('COUNT(*)', $table, $where, $arrWhereVal);
+    }
+
+    /**
+     * EXISTS文を実行する.
+     *
+     * @param string $table テーブル名
+     * @param string $where where句
+     * @param array $arrWhereVal プレースホルダ
+     * @return boolean 有無
+     */
+    function exists($table, $where = '', $arrWhereVal = array()) {
+        $sql_inner = $this->getSql('*', $table, $where, $arrWhereVal);
+        $sql = "SELECT CASE WHEN EXISTS($sql_inner) THEN 1 ELSE 0 END";
+        $res = $this->getOne($sql, $arrWhereVal);
+        return (bool)$res;
     }
 
@@ -270,5 +279,11 @@
         }
 
-        return $affected->fetchAll($fetchmode);
+        // MySQL での不具合対応のため、一旦変数に退避
+        $arrRet = $affected->fetchAll($fetchmode);
+
+        // PREPAREの解放
+        $sth->free();
+
+        return $arrRet;
     }
 
@@ -454,10 +469,13 @@
      * @param string $table テーブル名
      * @param array $sqlval array('カラム名' => '値',...)の連想配列
+     * @param array $arrSql array('カラム名' => 'SQL文',...)の連想配列
+     * @param array $arrSqlVal SQL文の中で使用するプレースホルダ配列
      * @return
      */
-    function insert($table, $sqlval) {
+    function insert($table, $sqlval, $arrSql = array(), $arrSqlVal = array()) {
         $strcol = '';
         $strval = '';
         $find = false;
+        $arrVal = array();
 
         if(count($sqlval) <= 0 ) return false;
@@ -470,8 +488,16 @@
             } else {
                 $strval .= '?,';
-                $arrval[] = $val;
+                $arrVal[] = $val;
             }
             $find = true;
         }
+
+        foreach($arrSql as $key => $val) {
+            $strcol .= $key . ',';
+            $strval .= $val . ',';
+        }
+
+        $arrVal = array_merge($arrVal, $arrSqlVal);
+
         if(!$find) {
             return false;
@@ -482,5 +508,5 @@
         $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
         // INSERT文の実行
-        $ret = $this->query($sqlin, $arrval, false, null, MDB2_PREPARE_MANIP);
+        $ret = $this->query($sqlin, $arrVal, false, null, MDB2_PREPARE_MANIP);
 
         return $ret;
@@ -609,5 +635,11 @@
         }
 
-        return $affected->fetchOne();
+        // MySQL での不具合対応のため、一旦変数に退避
+        $arrRet = $affected->fetchOne();
+
+        // PREPAREの解放
+        $sth->free();
+
+        return $arrRet;
     }
 
@@ -637,5 +669,11 @@
         }
 
-        return $affected->fetchRow($fetchmode);
+        // MySQL での不具合対応のため、一旦変数に退避
+        $arrRet = $affected->fetchRow($fetchmode);
+
+        // PREPAREの解放
+        $sth->free();
+
+        return $arrRet;
     }
 
@@ -663,5 +701,11 @@
         }
 
-        return $affected->fetchCol();
+        // MySQL での不具合対応のため、一旦変数に退避
+        $arrRet = $affected->fetchCol();
+
+        // PREPAREの解放
+        $sth->free();
+
+        return $arrRet;
     }
 
@@ -744,5 +788,5 @@
         }
 
-        //PREPAREの解放
+        // PREPAREの解放
         $sth->free();
 
@@ -973,5 +1017,5 @@
         }
         $arrRet = $result->getColumnNames();
-        //PREPAREの解放
+        // PREPAREの解放
         $sth->free();
 
Index: /branches/version-2_12-dev/data/class/SC_Product.php
===================================================================
--- /branches/version-2_12-dev/data/class/SC_Product.php	(revision 21352)
+++ /branches/version-2_12-dev/data/class/SC_Product.php	(revision 21390)
@@ -74,11 +74,9 @@
     function findProductIdsOrder(&$objQuery, $arrVal = array()) {
         $table = <<< __EOS__
-                 dtb_products AS alldtl
-            JOIN dtb_products_class AS T1
-              ON alldtl.product_id = T1.product_id
-            JOIN dtb_product_categories AS T2
-              ON alldtl.product_id = T2.product_id
-            JOIN dtb_category
-              ON T2.category_id = dtb_category.category_id
+            dtb_products AS alldtl
+            LEFT JOIN dtb_products_class
+                ON alldtl.product_id = dtb_products_class.product_id
+            LEFT JOIN dtb_product_categories
+                ON alldtl.product_id = dtb_product_categories.product_id
 __EOS__;
         $objQuery->setGroupBy('alldtl.product_id');
@@ -119,9 +117,9 @@
     function findProductCount(&$objQuery, $arrVal = array()) {
         $table = <<< __EOS__
-                 dtb_products AS alldtl
-            JOIN dtb_product_categories AS T2
-              ON alldtl.product_id = T2.product_id
-            JOIN dtb_category
-              ON T2.category_id = dtb_category.category_id
+            dtb_products AS alldtl
+            LEFT JOIN dtb_products_class
+                ON alldtl.product_id = dtb_products_class.product_id
+            LEFT JOIN dtb_product_categories
+                ON alldtl.product_id = dtb_product_categories.product_id
 __EOS__;
         $objQuery->setGroupBy('alldtl.product_id');
Index: /branches/version-2_12-dev/data/class/pages/frontparts/LC_Page_FrontParts_LoginCheck.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/frontparts/LC_Page_FrontParts_LoginCheck.php	(revision 21145)
+++ /branches/version-2_12-dev/data/class/pages/frontparts/LC_Page_FrontParts_LoginCheck.php	(revision 21390)
@@ -157,7 +157,7 @@
                     $objQuery = SC_Query_Ex::getSingletonInstance();
                     $where = '(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0';
-                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
+                    $exists = $objQuery->exists("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
                     // ログインエラー表示 TODO リファクタリング
-                    if($ret > 0) {
+                    if ($exists) {
                         if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                             echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR);
Index: /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php	(revision 21126)
+++ /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php	(revision 21390)
@@ -95,5 +95,5 @@
             default:
                 $this->newsCount = $this->lfGetNewsCount();
-                $this->arrNews = $this->lfGetNews();
+                $this->arrNews = $this->lfGetNews(SC_Query_Ex::getSingletonInstance());
                 break;
         }
@@ -126,18 +126,20 @@
      * @return array $arrNewsList 新着情報の配列を返す
      */
-    function lfGetNews(){
-        $objQuery = SC_Query_Ex::getSingletonInstance();
-        $sql = '';
-        $sql .= " SELECT ";
-        $sql .= "   *, ";
-        $sql .= "   cast(news_date as date) as news_date_disp ";
-        $sql .= " FROM ";
-        $sql .= "   dtb_news ";
-        $sql .= " WHERE ";
-        $sql .= "   del_flg = '0' ";
-        $sql .= " ORDER BY ";
-        $sql .= "   rank DESC ";
-
-        $arrNewsList = $objQuery->getAll($sql);
+    function lfGetNews(&$objQuery) {
+        $objQuery->setOrder("rank DESC ");
+        $arrNewsList = $objQuery->select('* , cast(news_date as date) as news_date_disp', 'dtb_news' ,'del_flg = 0');
+
+        // モバイルサイトのセッション保持 (#797)
+        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
+            foreach (array_keys($arrNewsList) as $key) {
+                $arrRow =& $arrNewsList[$key];
+                if (SC_Utils_Ex::isAppInnerUrl($arrRow['news_url'])) {
+                    $netUrl = new Net_URL($arrRow['news_url']);
+                    $netUrl->addQueryString(session_name(), session_id());
+                    $arrRow['news_url'] = $netUrl->getURL();
+                }
+            }
+        }
+
         return $arrNewsList;
     }
@@ -152,7 +154,7 @@
     function lfGetNewsForJson(&$objFormParam){
 
-        $objQuery = SC_Query_Ex::getSingletonInstance();
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
         $arrData = $objFormParam->getHashArray();
-		
+
         $dispNumber = $arrData['disp_number'];
         $pageNo = $arrData['pageno'];
@@ -161,6 +163,5 @@
         }
 
-        $objQuery->setOrder("rank DESC ");
-        $arrNewsList = $objQuery->select(" * , cast(news_date as date) as news_date_disp "," dtb_news "," del_flg = '0' ");
+        $arrNewsList = $this->lfGetNews($objQuery);
 
         //新着情報の最大ページ数をセット
Index: /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 21325)
+++ /branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 21390)
@@ -90,8 +90,8 @@
 
         // おすすめ商品取得
-        $col = 'best_id, best_id, category_id, rank, product_id, title, comment, create_date, update_date';
-        $table = 'dtb_best_products';
-        $where = 'del_flg = 0';
-        $objQuery->setOrder('rank');
+        $col = 'T1.best_id, T1.category_id, T1.rank, T1.product_id, T1.title, T1.comment, T1.create_date, T1.update_date';
+        $table = 'dtb_best_products as T1 INNER JOIN dtb_products as T2 ON T1.product_id = T2.product_id';
+        $where = 'T1.del_flg = 0 and T2.status = 1';
+        $objQuery->setOrder('T1.rank');
         $objQuery->setLimit(RECOMMEND_NUM);
         $arrBestProducts = $objQuery->select($col, $table, $where);
Index: /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 21327)
+++ /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 21390)
@@ -425,5 +425,5 @@
 
         if (strlen($searchCondition["where_category"]) >= 1) {
-            $searchCondition['where'] .= " AND T2.".$searchCondition["where_category"];
+            $searchCondition['where'] .= " AND dtb_product_categories.".$searchCondition["where_category"];
             $searchCondition['arrval'] = array_merge($searchCondition['arrval'], $searchCondition['arrvalCategory']);
         }
Index: /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Review.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Review.php	(revision 21185)
+++ /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Review.php	(revision 21390)
@@ -164,8 +164,8 @@
         $arrForm = $objFormParam->getHashArray();
 
-        //重複メッセージの判定
+        // 重複メッセージの判定
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
-        if ($flag > 0){
+        $exists = $objQuery->exists("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
+        if ($exists) {
             $arrErr['title'] .= "重複したタイトルは登録できません。";
         }
Index: /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 21325)
+++ /branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 21390)
@@ -541,7 +541,7 @@
         } else {
             $objQuery =& SC_Query_Ex::getSingletonInstance();
-            $count = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $favorite_product_id));
-
-            if ($count == 0) {
+            $exists = $objQuery->exists("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $favorite_product_id));
+
+            if (!$exists) {
                 $sqlval['customer_id'] = $customer_id;
                 $sqlval['product_id'] = $favorite_product_id;
Index: /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php	(revision 21012)
+++ /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php	(revision 21390)
@@ -174,6 +174,4 @@
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         return $objQuery->select("*", "dtb_other_deliv", "customer_id = ? AND other_deliv_id = ?", array($customer_id, $other_deliv_id));
-
-         $arrOtherDeliv[0];
     }
 
Index: /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 21368)
+++ /branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 21390)
@@ -177,11 +177,10 @@
     // お気に入り商品削除
     function lfDeleteFavoriteProduct($customer_id, $product_id) {
-        $objQuery       =& SC_Query_Ex::getSingletonInstance();
-        $count      = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
 
-        if ($count > 0) {
-            $objQuery->begin();
+        $exists = $objQuery->exists("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
+
+        if ($exists) {
             $objQuery->delete('dtb_customer_favorite_products', "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
-            $objQuery->commit();
         }
     }
Index: /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping.php	(revision 21295)
+++ /branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping.php	(revision 21390)
@@ -537,6 +537,6 @@
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $where = "email = ? AND status = 1 AND del_flg = 0";
-        $count = $objQuery->count("dtb_customer", $where, array($login_email));
-        return $count > 0;
+        $exists = $objQuery->exists("dtb_customer", $where, array($login_email));
+        return $exists;
     }
 
Index: /branches/version-2_12-dev/data/class/pages/upgrade/LC_Page_Upgrade_Download.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/upgrade/LC_Page_Upgrade_Download.php	(revision 21185)
+++ /branches/version-2_12-dev/data/class/pages/upgrade/LC_Page_Upgrade_Download.php	(revision 21390)
@@ -268,6 +268,6 @@
         $objQuery = new SC_Query_Ex();
 
-        $count = $objQuery->count($table, $where, array($objRet->product_id));
-        if ($count) {
+        $exists = $objQuery->exists($table, $where, array($objRet->product_id));
+        if ($exists) {
             $arrUpdate = array(
                 'module_code' => $objRet->product_code,
Index: /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php	(revision 21185)
+++ /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php	(revision 21390)
@@ -325,6 +325,6 @@
 
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $count = $objQuery->count('dtb_pagelayout', $where, $arrValues);
-        if ($count > 0) {
+        $exists = $objQuery->exists('dtb_pagelayout', $where, $arrValues);
+        if ($exists) {
             $objErr->arrErr['filename'] = '※ 同じURLのデータが存在しています。別のURLを入力してください。<br />';
         }
Index: /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php	(revision 21185)
+++ /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design_UpDown.php	(revision 21390)
@@ -166,6 +166,6 @@
         // DBにすでに登録されていないかチェック
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $count = $objQuery->count("dtb_templates", "template_code = ?", array($template_code));
-        if ($count > 0) {
+        $exists = $objQuery->exists("dtb_templates", "template_code = ?", array($template_code));
+        if ($exists) {
             $arrErr['template_code'] = "※ すでに登録されているテンプレートコードです。<br/>";
         }
Index: /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design.php	(revision 20970)
+++ /branches/version-2_12-dev/data/class/pages/admin/design/LC_Page_Admin_Design.php	(revision 21390)
@@ -274,7 +274,7 @@
             $arrParams['anywhere'] = intval($objFormParam->getValue('anywhere_' . $i));
             if ($arrParams['anywhere'] == 1) {
-                $count = $objQuery->count('dtb_blocposition', 'anywhere = 1 AND bloc_id = ? AND device_type_id = ?',
+                $exists = $objQuery->exists('dtb_blocposition', 'anywhere = 1 AND bloc_id = ? AND device_type_id = ?',
                                           array($id, $device_type_id));
-                if ($count > 0) {
+                if ($exists) {
                     continue;
                 }
Index: /branches/version-2_12-dev/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php	(revision 20970)
+++ /branches/version-2_12-dev/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore_Settings.php	(revision 21390)
@@ -177,7 +177,7 @@
         $table = 'dtb_ownersstore_settings';
         $objQuery = new SC_Query_Ex();
-        $count = $objQuery->count($table);
-
-        if ($count) {
+        $exists = $objQuery->exists($table);
+
+        if ($exists) {
             $objQuery->update($table, $arrSettingsData);
         } else {
Index: /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 21185)
+++ /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 21390)
@@ -82,6 +82,5 @@
         $objDb = new SC_Helper_DB_Ex();
 
-        $cnt = $objDb->sfGetBasisCount();
-        if ($cnt > 0) {
+        if ($objDb->sfGetBasisExists()) {
             $this->tpl_mode = 'update';
         } else {
Index: /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php	(revision 21203)
+++ /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php	(revision 21390)
@@ -76,6 +76,5 @@
         $objFormParam->setParam($_POST);
 
-        $cnt = $objDb->sfGetBasisCount();
-        if ($cnt > 0) {
+        if ($objDb->sfGetBasisExists()) {
             $this->tpl_mode = 'update';
         } else {
Index: /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php	(revision 21203)
+++ /branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php	(revision 21390)
@@ -76,6 +76,5 @@
         $objFormParam->setParam($_POST);
 
-        $cnt = $objDb->sfGetBasisCount();
-        if ($cnt > 0) {
+        if ($objDb->sfGetBasisExists()) {
             $this->tpl_mode = 'update';
         } else {
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 21352)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 21390)
@@ -800,7 +800,6 @@
 
         $objQuery = new SC_Query_Ex();
-        $count = $objQuery->count('dtb_products', $where, $sqlval);
-        if (!$count) return false;
-        return true;
+        $exists = $objQuery->exists('dtb_products', $where, $sqlval);
+        return $exists;
     }
 
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 21317)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 21390)
@@ -391,8 +391,8 @@
             // 同じidが存在すればupdate存在しなければinsert
             $where = "product_id = ?";
-            $product_count = $objQuery->count("dtb_products", $where, array($sqlval['product_id']));
-            if($product_count > 0){
+            $product_exists = $objQuery->exists("dtb_products", $where, array($sqlval['product_id']));
+            if ($product_exists) {
                 $objQuery->update("dtb_products", $sqlval, $where, array($sqlval['product_id']));
-            }else{
+            } else {
                 $sqlval['create_date'] = $arrList['update_date'];
                 // INSERTの実行
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 21357)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 21390)
@@ -205,6 +205,6 @@
         // 子カテゴリのチェック
         $where = "parent_category_id = ? AND del_flg = 0";
-        $count = $objQuery->count("dtb_category", $where, array($category_id));
-        if ($count > 0) {
+        $exists = $objQuery->exists("dtb_category", $where, array($category_id));
+        if ($exists) {
              $this->arrErr['category_name'] = "※ 子カテゴリが存在するため削除できません。<br/>";
              return;
@@ -213,6 +213,6 @@
         $table = "dtb_product_categories AS T1 LEFT JOIN dtb_products AS T2 ON T1.product_id = T2.product_id";
         $where = "T1.category_id = ? AND T2.del_flg = 0";
-        $count = $objQuery->count($table, $where, array($category_id));
-        if ($count > 0) {
+        $exists = $objQuery->exists($table, $where, array($category_id));
+        if ($exists) {
             $this->arrErr['category_name'] = "※ カテゴリ内に商品が存在するため削除できません。<br/>";
             return;
@@ -331,6 +331,6 @@
             $arrWhereVal[] = $category_id;
         }
-        $count = $objQuery->count('dtb_category', $where, $arrWhereVal);
-        if ($count > 0) {
+        $exists = $objQuery->exists('dtb_category', $where, $arrWhereVal);
+        if ($exists) {
             $arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。<br/>";
             return $arrErr;
Index: /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 21317)
+++ /branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 21390)
@@ -374,10 +374,10 @@
             // 同じidが存在すればupdate存在しなければinsert
             $where = "category_id = ?";
-            $category_count = $objQuery->count("dtb_category", $where, array($sqlval['category_id']));
-            if($category_count > 0){
+            $category_exists = $objQuery->exists("dtb_category", $where, array($sqlval['category_id']));
+            if ($category_exists) {
                 // UPDATEの実行
                 $where = "category_id = ?";
                 $objQuery->update("dtb_category", $sqlval, $where, array($sqlval['category_id']));
-            }else{
+            } else {
                 $sqlval['create_date'] = $arrList['update_date'];
                 // 新規登録
@@ -477,10 +477,10 @@
             }
             $where = "parent_category_id = ? AND category_id <> ? AND category_name = ?";
-            $count = $objQuery->count('dtb_category',
+            $exists = $objQuery->exists('dtb_category',
                         $where,
                         array($parent_category_id,
                                 $item['category_id'],
                                 $item['category_name']));
-            if($count > 0) {
+            if ($exists) {
                 $arrErr['category_name'] = "※ 既に同名のカテゴリが存在します。";
             }
Index: /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php	(revision 20970)
+++ /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php	(revision 21390)
@@ -170,5 +170,5 @@
             if($param['indexflag'] != $param['indexflag_new']) {
                 // 入力値がデータにある対象テーブルかのチェック
-                if($objQuery->count('dtb_index_list', 'table_name = ? and column_name = ?', array($param['table_name'], $param['column_name']))) {
+                if ($objQuery->exists('dtb_index_list', 'table_name = ? and column_name = ?', array($param['table_name'], $param['column_name']))) {
                     $arrTarget[] = $param;
                 }
Index: /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Input.php
===================================================================
--- /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 21250)
+++ /branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 21390)
@@ -279,11 +279,10 @@
      */
     function memberDataExists($where, $val) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
         $table = 'dtb_member';
 
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $count = $objQuery->count($table, $where, array($val));
-
-        if ($count > 0) return true;
-        return false;
+        $exists = $objQuery->exists($table, $where, array($val));
+        return $exists;
     }
 
Index: /branches/version-2_12-dev/data/class/SC_Customer.php
===================================================================
--- /branches/version-2_12-dev/data/class/SC_Customer.php	(revision 21259)
+++ /branches/version-2_12-dev/data/class/SC_Customer.php	(revision 21390)
@@ -121,8 +121,7 @@
 
         // 携帯端末IDが一致し、本登録された会員を検索する。
-        $sql = 'SELECT count(*) FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
-        $objQuery = new SC_Query_Ex();
-        $result = $objQuery->count("dtb_customer", "mobile_phone_id = ? AND del_flg = 0 AND status = 2", array($_SESSION['mobile']['phone_id']));
-        return $result > 0;
+        $objQuery = new SC_Query_Ex();
+        $exists = $objQuery->exists("dtb_customer", "mobile_phone_id = ? AND del_flg = 0 AND status = 2", array($_SESSION['mobile']['phone_id']));
+        return $exists;
     }
 
Index: /branches/version-2_12-dev/data/class/util/SC_Utils.php
===================================================================
--- /branches/version-2_12-dev/data/class/util/SC_Utils.php	(revision 21242)
+++ /branches/version-2_12-dev/data/class/util/SC_Utils.php	(revision 21390)
@@ -2163,4 +2163,9 @@
         return is_dir($pathname) || @mkdir($pathname, $mode);
     }
+
+    function isAppInnerUrl($url) {
+        $pattern = '/^(' . preg_quote(HTTP_URL, '/') . '|' . preg_quote(HTTPS_URL, '/') . ')/';
+        return preg_match($pattern, $url) >= 1;
+    }
 }
 ?>
