/**
  * セッションのデータをDBに書き込む.
  *
  * @param string $id セッションID
  * @param string $sess_data セッションデータの値
  * @return bool セッションの書き込みに成功した場合 true
  */
 function sfSessWrite($id, $sess_data)
 {
     if (!$this->objDb->sfTabaleExists("dtb_session")) {
         return false;
     }
     $objQuery = new SC_Query();
     $count = $objQuery->count("dtb_session", "sess_id = ?", array($id));
     $sqlval = array();
     if ($count > 0) {
         // レコード更新
         $sqlval['sess_data'] = $sess_data;
         $sqlval['update_date'] = 'Now()';
         $objQuery->update("dtb_session", $sqlval, "sess_id = ?", array($id));
     } else {
         // セッションデータがある場合は、レコード作成
         if (strlen($sess_data) > 0) {
             $sqlval['sess_id'] = $id;
             $sqlval['sess_data'] = $sess_data;
             $sqlval['update_date'] = 'Now()';
             $sqlval['create_date'] = 'Now()';
             $objQuery->insert("dtb_session", $sqlval);
         }
     }
     return true;
 }
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     $objView = new SC_MobileView();
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     $objDb = new SC_Helper_DB_Ex();
     //不正アクセス判定
     $from = "dtb_order";
     $where = "del_flg = 0 AND customer_id = ? AND order_id = ? ";
     $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']);
     //DBに情報があるか判定
     $cnt = $objQuery->count($from, $where, $arrval);
     //ログインしていない、またはDBに情報が無い場合
     if (!$objCustomer->isLoginSuccess(true) or $cnt == 0) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
     } 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');
     }
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objQuery = new SC_Query();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     $cnt = $objQuery->count("dtb_baseinfo");
     if ($cnt > 0) {
         $this->tpl_mode = "update";
     } else {
         $this->tpl_mode = "insert";
     }
     if (isset($_POST['mode']) && !empty($_POST["mode"])) {
         // POSTデータの引き継ぎ
         $this->arrForm = $_POST;
         // 入力データの変換
         $this->arrForm = $this->lfConvertParam($this->arrForm);
         $this->arrForm['regular_holiday_ids'] = $_POST['regular_holiday_ids'];
         // 定休日情報を付加
         // 入力データのエラーチェック
         $this->arrErr = $this->lfErrorCheck($this->arrForm);
         if (count($this->arrErr) == 0) {
             switch ($_POST['mode']) {
                 case 'update':
                     $this->lfUpdateData($this->arrForm);
                     // 既存編集
                     break;
                 case 'insert':
                     $this->lfInsertData($this->arrForm);
                     // 新規作成
                     break;
                 default:
                     break;
             }
             $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "'); fnCheckLimit('max_download_cnt', 'download_cnt_unlimited', '" . DISABLED_RGB . "'); window.alert('SHOPマスタの登録が完了しました。');";
         }
         if (empty($this->arrForm['regular_holiday_ids'])) {
             $this->arrSel = array();
         } else {
             $this->arrSel = $this->arrForm['regular_holiday_ids'];
         }
     } else {
         $arrCol = $this->lfGetCol();
         $col = SC_Utils_Ex::sfGetCommaList($arrCol);
         $arrRet = $objQuery->select($col, "dtb_baseinfo");
         $this->arrForm = $arrRet[0];
         $regular_holiday_ids = explode('|', $this->arrForm['regular_holiday_ids']);
         $this->arrForm['regular_holiday_ids'] = $regular_holiday_ids;
         $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "'); fnCheckLimit('max_download_cnt', 'download_cnt_unlimited', '" . DISABLED_RGB . "');";
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objQuery = new SC_Query();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     // POST値の取得
     $this->objFormParam->setParam($_POST);
     $cnt = $objQuery->count("dtb_baseinfo");
     if ($cnt > 0) {
         $this->tpl_mode = "update";
     } else {
         $this->tpl_mode = "insert";
     }
     if (isset($_POST['mode']) && !empty($_POST['mode'])) {
         // 入力値の変換
         $this->objFormParam->convParam();
         $this->arrErr = $this->lfCheckError();
         if (count($this->arrErr) == 0) {
             switch ($_POST['mode']) {
                 case 'update':
                     $this->lfUpdateData();
                     // 既存編集
                     break;
                 case 'insert':
                     $this->lfInsertData();
                     // 新規作成
                     break;
                 default:
                     break;
             }
             // 再表示
             //sfReload();
             $this->tpl_onload = "window.alert('特定商取引法の登録が完了しました。');";
         }
     } else {
         $arrCol = $this->objFormParam->getKeyList();
         // キー名一覧を取得
         $col = SC_Utils_Ex::sfGetCommaList($arrCol);
         $arrRet = $objQuery->select($col, "dtb_baseinfo");
         // DB値の取得
         $this->objFormParam->setParam($arrRet[0]);
     }
     $this->arrForm = $this->objFormParam->getFormParamList();
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * 受注一時テーブルへの書き込み処理を行う.
  *
  * @param string $uniqid ユニークID
  * @param array $sqlval SQLの値の配列
  * @return void
  */
 function sfRegistTempOrder($uniqid, $sqlval)
 {
     if ($uniqid != "") {
         // 既存データのチェック
         $objQuery = new SC_Query();
         $where = "order_temp_id = ?";
         $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
         // 既存データがない場合
         if ($cnt == 0) {
             // 初回書き込み時に会員の登録済み情報を取り込む
             $sqlval = $this->sfGetCustomerSqlVal($uniqid, $sqlval);
             $sqlval['create_date'] = "now()";
             $objQuery->insert("dtb_order_temp", $sqlval);
         } else {
             $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
         }
     }
 }
    /**
     * SC_Queryインスタンスに設定された検索条件をもとに対象商品数を取得する.
     *
     * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
     *
     * @param SC_Query $objQuery SC_Query インスタンス
     * @param array $arrVal 検索パラメーターの配列
     * @return array 対象商品ID数
     */
    function findProductCount(&$objQuery, $arrVal = array())
    {
        $table = <<<__EOS__
            dtb_products AS alldtl
__EOS__;
        return $objQuery->count($table, '', $arrVal);
    }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_SiteView(false);
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     $ParentPage = MYPAGE_DELIVADDR_URL;
     // GETでページを指定されている場合には指定ページに戻す
     if (isset($_GET['page'])) {
         $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES);
     } else {
         if (isset($_POST['ParentPage'])) {
             $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES);
         }
     }
     $this->ParentPage = $ParentPage;
     //ログイン判定
     if (!$objCustomer->isLoginSuccess()) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if (!isset($_GET['other_deliv_id'])) {
         $_GET['other_deliv_id'] = "";
     }
     if ($_POST['mode'] == "") {
         $_SESSION['other_deliv_id'] = $_GET['other_deliv_id'];
     }
     if ($_GET['other_deliv_id'] != "") {
         //不正アクセス判定
         $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']));
         if (!$objCustomer->isLoginSuccess() || $flag == 0) {
             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
     }
     //別のお届け先DB登録用カラム配列
     $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"));
     if ($_GET['other_deliv_id'] != "") {
         //別のお届け先情報取得
         $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id']));
         $this->arrForm = $arrOtherDeliv[0];
     }
     switch ($_POST['mode']) {
         case 'edit':
             $_POST = $this->lfConvertParam($_POST, $arrRegistColumn);
             $this->arrErr = $this->lfErrorCheck($_POST);
             if ($this->arrErr) {
                 foreach ($_POST as $key => $val) {
                     if ($val != "") {
                         $this->arrForm[$key] = $val;
                     }
                 }
             } 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);
                 }
             }
             break;
     }
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * SC_Queryインスタンスに設定された検索条件をもとに対象商品数を取得する.
  *
  * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
  *
  * @param  SC_Query $objQuery SC_Query インスタンス
  * @param  array    $arrVal   検索パラメーターの配列
  * @return array    対象商品ID数
  */
 public function findProductCount(&$objQuery, $arrVal = array())
 {
     $table = 'dtb_products AS alldtl';
     return $objQuery->count($table, '', $arrVal);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objDb = new SC_Helper_DB_Ex();
     $objSess = new SC_Session();
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     $this->objFormParam->setParam($_POST);
     $this->objFormParam->splitParamCheckBoxes('search_order_sex');
     $this->objFormParam->splitParamCheckBoxes('search_payment_id');
     // 検索ワードの引き継ぎ
     foreach ($_POST as $key => $val) {
         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;
             }
         }
     }
     // ページ送り用
     $this->arrHidden['search_pageno'] = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if (!isset($arrRet)) {
         $arrRet = array();
     }
     if ($_POST['mode'] == 'delete') {
         if (SC_Utils_Ex::sfIsInt($_POST['order_id'])) {
             $objQuery = new SC_Query();
             $where = "order_id = ?";
             $sqlval['del_flg'] = '1';
             $objQuery->update("dtb_order", $sqlval, $where, array($_POST['order_id']));
         }
     }
     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;
                     }
                     $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;
                                 }
                             }
                             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;
                     }
                 }
                 $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;
     }
     $objDate = new SC_Date();
     // 登録・更新日検索用
     $objDate->setStartYear(RELEASE_YEAR);
     $objDate->setEndYear(DATE("Y"));
     $this->arrRegistYear = $objDate->getYear();
     // 生年月日検索用
     $objDate->setStartYear(BIRTH_YEAR);
     $objDate->setEndYear(DATE("Y"));
     $this->arrBirthYear = $objDate->getYear();
     // 月日の設定
     $this->arrMonth = $objDate->getMonth();
     $this->arrDay = $objDate->getDay();
     // 入力値の取得
     $this->arrForm = $this->objFormParam->getFormParamList();
     // 支払い方法の取得
     $arrRet = $objDb->sfGetPayment();
     $this->arrPayment = SC_Utils_Ex::sfArrKeyValue($arrRet, 'payment_id', 'payment_method');
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objQuery = new SC_Query();
     $objSess = new SC_Session();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     $fp = fopen(ZIP_CSV_FILE_PATH, "r");
     $img_path = USER_URL . "packages/" . TEMPLATE_NAME . "/img/";
     // 一部の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);
             }
             $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";
     }
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDate = new SC_Date();
     $objQuery = new SC_Query();
     // 登録・更新検索開始年
     $objDate->setStartYear(RELEASE_YEAR);
     $objDate->setEndYear(DATE("Y"));
     $this->arrStartYear = $objDate->getYear();
     $this->arrStartMonth = $objDate->getMonth();
     $this->arrStartDay = $objDate->getDay();
     // 登録・更新検索終了年
     $objDate->setStartYear(RELEASE_YEAR);
     $objDate->setEndYear(DATE("Y"));
     $this->arrEndYear = $objDate->getYear();
     $this->arrEndMonth = $objDate->getMonth();
     $this->arrEndDay = $objDate->getDay();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     //レビュー情報のカラムの取得
     $select = "review_id, A.product_id, reviewer_name, sex, recommend_level, ";
     $select .= "reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
     $from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
     // 検索ワードの引き継ぎ
     foreach ($_POST as $key => $val) {
         if (ereg("^search_", $key)) {
             switch ($key) {
                 case 'search_sex':
                     $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
                     if (!is_array($val)) {
                         $this->arrForm[$key] = split("-", $val);
                     }
                     break;
                 default:
                     $this->arrHidden[$key] = $val;
                     break;
             }
         }
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if ($_POST['mode'] == "delete") {
         //レビューの削除
         $objQuery->exec("UPDATE dtb_review SET del_flg=1 WHERE review_id=?", array($_POST['review_id']));
     }
     if ($_POST['mode'] == 'search' || $_POST['mode'] == 'csv' || $_POST['mode'] == 'delete') {
         //削除されていない商品を検索
         $where = "A.del_flg = 0 AND B.del_flg = 0";
         $this->arrForm = $_POST;
         if (isset($_POST['search_sex']) && !is_array($_POST['search_sex'])) {
             $this->arrForm['search_sex'] = split("-", $_POST['search_sex']);
         }
         //エラーチェック
         $this->arrErr = $this->lfCheckError();
         if (!$this->arrErr) {
             foreach ($_POST as $key => $val) {
                 $val = SC_Utils_Ex::sfManualEscape($val);
                 if ($val == "") {
                     continue;
                 }
                 switch ($key) {
                     case 'search_reviewer_name':
                         $val = ereg_replace(" ", "%", $val);
                         $val = ereg_replace(" ", "%", $val);
                         $where .= " AND reviewer_name ILIKE ? ";
                         $arrval[] = "%{$val}%";
                         break;
                     case 'search_reviewer_url':
                         $val = ereg_replace(" ", "%", $val);
                         $val = ereg_replace(" ", "%", $val);
                         $where .= " AND reviewer_url ILIKE ? ";
                         $arrval[] = "%{$val}%";
                         break;
                     case 'search_name':
                         $val = ereg_replace(" ", "%", $val);
                         $val = ereg_replace(" ", "%", $val);
                         $where .= " AND name ILIKE ? ";
                         $arrval[] = "%{$val}%";
                         break;
                     case 'search_product_code':
                         $val = ereg_replace(" ", "%", $val);
                         $val = ereg_replace(" ", "%", $val);
                         $where .= " AND A.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
                         $arrval[] = "%{$val}%";
                         break;
                     case 'search_sex':
                         $tmp_where = "";
                         //$val=配列の中身,$element=各キーの値(1,2)
                         if (is_array($val)) {
                             foreach ($val as $element) {
                                 if ($element != "") {
                                     if ($tmp_where == "") {
                                         $tmp_where .= " AND (sex = ?";
                                     } else {
                                         $tmp_where .= " OR sex = ?";
                                     }
                                     $arrval[] = $element;
                                 }
                             }
                             if ($tmp_where != "") {
                                 $tmp_where .= ")";
                                 $where .= " {$tmp_where} ";
                             }
                         }
                         break;
                     case 'search_recommend_level':
                         $where .= " AND recommend_level = ? ";
                         $arrval[] = $val;
                         break;
                     case 'search_startyear':
                         if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
                             $where .= " AND A.create_date >= ? ";
                             $arrval[] = $date;
                         }
                         break;
                     case 'search_endyear':
                         if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
                             $end_date = date("Y/m/d", strtotime("1 day", strtotime($date)));
                             $where .= " AND A.create_date <= cast('{$end_date}' as date) ";
                         }
                         break;
                 }
             }
         }
         $order = "A.create_date DESC";
         // ページ送りの処理
         if (is_numeric($_POST['search_page_max'])) {
             $page_max = $_POST['search_page_max'];
         } else {
             $page_max = SEARCH_PMAX;
         }
         if (!isset($arrval)) {
             $arrval = array();
         }
         $linemax = $objQuery->count($from, $where, $arrval);
         $this->tpl_linemax = $linemax;
         $this->tpl_pageno = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
         // ページ送りの取得
         $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
         $this->arrPagenavi = $objNavi->arrPagenavi;
         $startno = $objNavi->start_row;
         // 取得範囲の指定(開始行番号、行数のセット)
         $objQuery->setlimitoffset($page_max, $startno);
         // 表示順序
         $objQuery->setorder($order);
         //検索結果の取得
         $this->arrReview = $objQuery->select($select, $from, $where, $arrval);
         //CSVダウンロード
         if ($_POST['mode'] == 'csv') {
             $objCSV = new SC_Helper_CSV_Ex();
             // オプションの指定
             $option = "ORDER BY review_id";
             // CSV出力タイトル行の作成
             $head = SC_Utils_Ex::sfGetCSVList($objCSV->arrREVIEW_CVSTITLE);
             $data = $objCSV->lfGetReviewCSV($where, '', $arrval);
             // CSVを送信する。
             SC_Utils_Ex::sfCSVDownload($head . $data);
             exit;
         }
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * DBへ入力内容を登録する.
  *
  * @param array $arrSettingsData オーナーズストア設定の連想配列
  * @return void
  */
 function registerOwnersStoreSettings($arrSettingsData)
 {
     $table = 'dtb_ownersstore_settings';
     $objQuery = new SC_Query();
     $count = $objQuery->count($table);
     if ($count) {
         $objQuery->update($table, $arrSettingsData);
     } else {
         $objQuery->insert($table, $arrSettingsData);
     }
 }
Beispiel #13
0
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     $objView = new SC_MobileView();
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     // クッキー管理クラス
     $objCookie = new SC_Cookie(COOKIE_EXPIRE);
     // パラメータ管理クラス
     $objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam($objFormParam);
     // POST値の取得
     $objFormParam->setParam($_POST);
     // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
     $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     // ログイン処理
     if ($_POST['mode'] == 'login') {
         $objFormParam->toLower('login_email');
         $arrErr = $objFormParam->checkError();
         $arrForm = $objFormParam->getHashArray();
         // クッキー保存判定
         if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
             $objCookie->setCookie('login_email', $_POST['login_email']);
         } else {
             $objCookie->setCookie('login_email', '');
         }
         if (count($arrErr) == 0) {
             if ($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) || $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
                 // ログインが成功した場合は携帯端末IDを保存する。
                 $objCustomer->updateMobilePhoneId();
                 /*
                  * email がモバイルドメインでは無く,
                  * 携帯メールアドレスが登録されていない場合
                  */
                 $objMobile = new SC_Helper_Mobile_Ex();
                 if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
                     if (!$objCustomer->hasValue('email_mobile')) {
                         $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true);
                         exit;
                     }
                 }
             } else {
                 $objQuery = new SC_Query();
                 $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']));
                 if ($ret > 0) {
                     SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
                 } else {
                     SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
                 }
             }
         }
     }
     /*
      * ログインチェック
      * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする
      */
     if (!$objCustomer->isLoginSuccess(true)) {
         $this->tpl_mainpage = 'mypage/login.tpl';
         $objView->assignArray($objFormParam->getHashArray());
         if (empty($arrErr)) {
             $arrErr = array();
         }
         $objView->assignArray(array("arrErr" => $arrErr));
     } else {
         //マイページトップ顧客情報表示用
         $this->CustomerName1 = $objCustomer->getvalue('name01');
         $this->CustomerName2 = $objCustomer->getvalue('name02');
     }
     $objView->assignobj($this);
     //$objpage内の全てのテンプレート変数をsmartyに格納
     $objView->display(SITE_FRAME);
     //パスとテンプレート変数の呼び出し、実行
 }
function lfDispComplete($objPage)
{
    global $objWebParam;
    global $objDBParam;
    // hiddenに入力値を保持
    $objPage->arrHidden = $objWebParam->getHashArray();
    // hiddenに入力値を保持
    $objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
    $arrDsn = getArrayDsn($objDBParam);
    $sqlval['id'] = 1;
    $sqlval['shop_name'] = $objWebParam->getValue('shop_name');
    $sqlval['email01'] = $objWebParam->getValue('admin_mail');
    $sqlval['email02'] = $objWebParam->getValue('admin_mail');
    $sqlval['email03'] = $objWebParam->getValue('admin_mail');
    $sqlval['email04'] = $objWebParam->getValue('admin_mail');
    $sqlval['email05'] = $objWebParam->getValue('admin_mail');
    $sqlval['top_tpl'] = 'default1';
    $sqlval['product_tpl'] = 'default1';
    $sqlval['detail_tpl'] = 'default1';
    $sqlval['mypage_tpl'] = 'default1';
    $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
    $objQuery = new SC_Query($arrDsn);
    $cnt = $objQuery->count('dtb_baseinfo');
    if ($cnt > 0) {
        $objQuery->update('dtb_baseinfo', $sqlval);
    } else {
        $objQuery->insert('dtb_baseinfo', $sqlval);
    }
    // 管理者登録
    $login_id = $objWebParam->getValue('login_id');
    $salt = SC_Utils_Ex::sfGetRandomString(10);
    $login_pass = SC_Utils_Ex::sfGetHashString($objWebParam->getValue('login_pass'), $salt);
    $arrVal = array('login_id' => $login_id, 'password' => $login_pass, 'salt' => $salt, 'work' => 1, 'del_flg' => 0, 'update_date' => 'CURRENT_TIMESTAMP');
    $member_id = $objQuery->get('member_id', 'dtb_member', 'login_id = ? AND del_flg = 0', array($login_id));
    if (strlen($member_id) == 0) {
        $member_id = $objQuery->nextVal('dtb_member_member_id');
        $arrVal['member_id'] = $member_id;
        $arrVal['name'] = '管理者';
        $arrVal['creator_id'] = 0;
        $arrVal['authority'] = 0;
        $arrVal['rank'] = 1;
        $objQuery->insert('dtb_member', $arrVal);
    } else {
        $objQuery->update('dtb_member', $arrVal, 'member_id = ?', array($member_id));
    }
    $objPage->arrHidden['db_skip'] = $_POST['db_skip'];
    $objPage->tpl_mainpage = 'complete.tpl';
    $objPage->tpl_mode = 'complete';
    $secure_url = $objWebParam->getValue('secure_url');
    // 語尾に'/'をつける
    $secure_url = rtrim($secure_url, '/') . '/';
    $objPage->tpl_sslurl = $secure_url;
    //EC-CUBEオフィシャルサイトからのお知らせURL
    $objPage->install_info_url = INSTALL_INFO_URL;
    return $objPage;
}
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_SiteView();
     $objQuery = new SC_Query();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (!$this->isValidToken()) {
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
         }
     }
     //---- 登録用カラム配列
     $arrRegistColumn = array(array("column" => "review_id", "convert" => "aKV"), array("column" => "product_id", "convert" => "aKV"), array("column" => "reviewer_name", "convert" => "aKV"), array("column" => "reviewer_url", "convert" => "a"), array("column" => "sex", "convert" => "n"), array("column" => "email", "convert" => "a"), array("column" => "recommend_level", "convert" => "n"), array("column" => "title", "convert" => "aKV"), array("column" => "comment", "convert" => "aKV"));
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'confirm':
             $arrForm = $this->lfConvertParam($_POST, $arrRegistColumn);
             $this->arrErr = $this->lfErrorCheck($arrForm);
             //重複メッセージの判定
             $flag = $objQuery->count("dtb_review", "product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
             if ($flag > 0) {
                 $this->arrErr['title'] .= "重複したタイトルは登録できません。";
             }
             //エラーチェック
             if ($this->arrErr == "") {
                 //重複タイトルでない
                 if ($flag == 0) {
                     //商品名の取得
                     $arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));
                     $this->arrForm = $arrForm;
                     $this->tpl_mainpage = 'products/review_confirm.tpl';
                 }
             } else {
                 //商品名の取得
                 $arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));
                 $this->arrForm = $arrForm;
             }
             break;
         case 'return':
             foreach ($_POST as $key => $val) {
                 $this->arrForm[$key] = $val;
             }
             //商品名の取得
             $this->arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($this->arrForm['product_id']));
             if (empty($this->arrForm['name'])) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
             }
             break;
         case 'complete':
             $arrForm = $this->lfConvertParam($_POST, $arrRegistColumn);
             $arrErr = $this->lfErrorCheck($arrForm);
             //重複メッセージの判定
             $flag = $objQuery->count("dtb_review", "product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
             //エラーチェック
             if ($arrErr == "") {
                 //重複タイトルでない
                 if ($flag == 0) {
                     //登録実行
                     $this->lfRegistRecommendData($arrForm, $arrRegistColumn);
                     //レビュー書き込み完了ページへ
                     $this->sendRedirect($this->getLocation("./review_complete.php", array(), true));
                     exit;
                 }
             } else {
                 if ($flag > 0) {
                     SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
                 }
             }
             break;
         default:
             if (SC_Utils_Ex::sfIsInt($_GET['product_id'])) {
                 //商品情報の取得
                 $arrForm = $objQuery->select("product_id, name", "dtb_products", "del_flg = 0 AND status = 1 AND product_id=?", array($_GET['product_id']));
                 if (empty($arrForm)) {
                     SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
                 }
                 $this->arrForm = $arrForm[0];
             }
             break;
     }
     $this->transactionid = $this->getToken();
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 function lfRegistData($uniqid)
 {
     $arrRet = $this->objFormParam->getHashArray();
     $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';
     // 既存データのチェック
     $objQuery = new SC_Query();
     $where = "order_temp_id = ?";
     $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
     // 既存データがない場合
     if ($cnt == 0) {
         $sqlval['create_date'] = 'Now()';
         $objQuery->insert("dtb_order_temp", $sqlval);
     } else {
         $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
     }
 }
 /**
  * 入力チェックを行う.
  *
  * @return void
  */
 function lfCheckError()
 {
     $arrRet = $this->objFormParam->getHashArray();
     $objQuery = new SC_Query();
     $objErr = new SC_CheckError($arrRet);
     $objErr->arrErr = $this->objFormParam->checkError(false);
     // 親カテゴリID設定
     if ($arrRet['parent_category_id'] == 0) {
         $parent_category_id = "0";
     } else {
         $parent_category_id = $arrRet['parent_category_id'];
     }
     // 存在する親カテゴリIDかチェック
     if (count($objErr->arrErr) == 0) {
         if ($parent_category_id != 0) {
             $count = $objQuery->count("dtb_category", "category_id = ?", array($parent_category_id));
             if ($count == 0) {
                 $objErr->arrErr['parent_category_id'] = "※ 指定の親カテゴリID(" . $parent_category_id . ")は、存在しません。";
             }
         }
     }
     // 階層チェック
     if (!isset($objErr->arrErr['category_name']) && !isset($objErr->arrErr['parent_category_id'])) {
         $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($parent_category_id));
         if ($level >= LEVEL_MAX) {
             $objErr->arrErr['category_name'] = "※ " . LEVEL_MAX . "階層以上の登録はできません。<br>";
         }
     }
     // 重複チェック
     if (!isset($objErr->arrErr['category_name']) && !isset($objErr->arrErr['parent_category_id'])) {
         $where = "parent_category_id = ? AND category_name = ?";
         $arrCat = $objQuery->select("category_id, category_name", "dtb_category", $where, array($parent_category_id, $arrRet['category_name']));
         if (empty($arrCat)) {
             $arrCat = array(array("category_id" => "", "category_name" => ""));
         }
         // 編集中のレコード以外に同じ名称が存在する場合
         if ($arrCat[0]['category_id'] != $arrRet['category_id'] && $arrCat[0]['category_name'] == $_POST['category_name']) {
             $objErr->arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。<br>";
         }
     }
     return $objErr->arrErr;
 }
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     define("HISTORY_NUM", 5);
     $objView = new SC_MobileView();
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     $pageNo = isset($_GET['pageno']) ? (int) $_GET['pageno'] : 0;
     // TODO
     // ログインチェック
     if (!isset($_SESSION['customer'])) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
     }
     $col = "order_id, create_date, payment_id, payment_total";
     $from = "dtb_order";
     $where = "del_flg = 0 AND customer_id=?";
     $arrval = array($objCustomer->getvalue('customer_id'));
     $order = "order_id DESC";
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setlimitoffset(HISTORY_NUM, $pageNo);
     // 表示順序
     $objQuery->setorder($order);
     //購入履歴の取得
     $this->arrOrder = $objQuery->select($col, $from, $where, $arrval);
     // next
     if ($pageNo + HISTORY_NUM < $linemax) {
         $next = "<a href='history.php?pageno=" . ($pageNo + HISTORY_NUM) . "'>次へ→</a>";
     } else {
         $next = "";
     }
     // previous
     if ($pageNo - HISTORY_NUM > 0) {
         $previous = "<a href='history.php?pageno=" . ($pageNo - HISTORY_NUM) . "'>←前へ</a>";
     } elseif ($pageNo == 0) {
         $previous = "";
     } else {
         $previous = "<a href='history.php?pageno=0'>←前へ</a>";
     }
     // bar
     if ($next != '' && $previous != '') {
         $bar = " | ";
     } else {
         $bar = "";
     }
     $this->tpl_strnavi = $previous . $bar . $next;
     $objView->assignobj($this);
     //$objpage内の全てのテンプレート変数をsmartyに格納
     $objView->display(SITE_FRAME);
     //パスとテンプレート変数の呼び出し、実行
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objCustomer = new SC_Customer();
     // 不正なURLがPOSTされた場合はエラー表示
     if (!$this->isValidToken()) {
         GC_Utils_Ex::gfPrintLog('invalid access :login_check.php $POST["url"]=' . $_POST['url']);
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
     }
     // クッキー管理クラス
     $objCookie = new SC_Cookie(COOKIE_EXPIRE);
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     //パスワード・Eメールにある空白をトリム
     $_POST["login_email"] = preg_replace('/^[  \\r\\n]*(.*?)[  \\r\\n]*$/u', '$1', $_POST["login_email"]);
     $_POST["login_pass"] = trim($_POST["login_pass"]);
     //認証用
     $_POST["login_pass1"] = $_POST["login_pass"];
     //最小桁数比較用
     $_POST["login_pass2"] = $_POST["login_pass"];
     //最大桁数比較用
     // POST値の取得
     $this->objFormParam->setParam($_POST);
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'login':
             $this->objFormParam->toLower('login_email');
             $arrErr = $this->objFormParam->checkError();
             // エラーの場合はエラー画面に遷移
             if (count($arrErr) > 0) {
                 SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
             }
             $arrForm = $this->objFormParam->getHashArray();
             // クッキー保存判定
             if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
                 $objCookie->setCookie('login_email', $_POST['login_email']);
             } else {
                 $objCookie->setCookie('login_email', '');
             }
             if (count($arrErr) == 0) {
                 if ($objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
                     $this->sendRedirect($this->getLocation(URL_DIR, array(), false));
                     exit;
                 } else {
                     $arrForm['login_email'] = strtolower($arrForm['login_email']);
                     $objQuery = new SC_Query();
                     $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']));
                     if ($ret > 0) {
                         SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     } else {
                         SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                     }
                 }
             } else {
                 // 入力エラーの場合、元のアドレスに戻す。
                 $this->sendRedirect($this->getLocation($_POST['url'], array(), false));
                 exit;
             }
             break;
         case 'logout':
             // ログイン情報の解放
             $objCustomer->EndSession();
             $mypage_url_search = strpos('.' . $_POST['url'], "mypage");
             //マイページログイン中はログイン画面へ移行
             if ($mypage_url_search == 2) {
                 $this->sendRedirect($this->getLocation(URL_DIR . "mypage/login.php", array(), false));
             } else {
                 $this->sendRedirect($this->getLocation(URL_DIR, array(), false));
             }
             exit;
             break;
     }
 }
Beispiel #20
0
 case 'complete':
     // ショップマスタ情報の書き込み
     $arrRet = $objDBParam->getHashArray();
     $dsn = $arrRet['db_type'] . "://" . $arrRet['db_user'] . ":" . $arrRet['db_password'] . "@" . $arrRet['db_server'] . ":" . $arrRet['db_port'] . "/" . $arrRet['db_name'];
     $sqlval['shop_name'] = $objWebParam->getValue('shop_name');
     $sqlval['email01'] = $objWebParam->getValue('admin_mail');
     $sqlval['email02'] = $objWebParam->getValue('admin_mail');
     $sqlval['email03'] = $objWebParam->getValue('admin_mail');
     $sqlval['email04'] = $objWebParam->getValue('admin_mail');
     $sqlval['email05'] = $objWebParam->getValue('admin_mail');
     $sqlval['top_tpl'] = "default1";
     $sqlval['product_tpl'] = "default1";
     $sqlval['detail_tpl'] = "default1";
     $sqlval['mypage_tpl'] = "default1";
     $objQuery = new SC_Query($dsn);
     $cnt = $objQuery->count("dtb_baseinfo");
     if ($cnt > 0) {
         $objQuery->update("dtb_baseinfo", $sqlval);
     } else {
         $objQuery->insert("dtb_baseinfo", $sqlval);
     }
     // 管理者登録
     $login_id = $objWebParam->getValue('login_id');
     $login_pass = sha1($objWebParam->getValue('login_pass') . ":" . AUTH_MAGIC);
     $sql = "DELETE FROM dtb_member WHERE login_id = ?";
     $objQuery->query($sql, array($login_id));
     $sql = "INSERT INTO dtb_member (name, login_id, password, creator_id, authority, work, del_flg, rank, create_date, update_date)\n            VALUES ('管理者',?,?,0,0,1,0,1, now(), now());";
     $objQuery->query($sql, array($login_id, $login_pass));
     global $GLOBAL_ERR;
     $GLOBAL_ERR = "";
     $objPage = lfDispComplete($objPage);
Beispiel #21
0
    /**
     * カテゴリ数の登録を行う.
     *
     *
     * @param  SC_Query $objQuery           SC_Query インスタンス
     * @param  boolean  $is_force_all_count 全カテゴリの集計を強制する場合 true
     * @return void
     */
    public function sfCountCategory($objQuery = NULL, $is_force_all_count = false)
    {
        $objProduct = new SC_Product_Ex();
        if ($objQuery == NULL) {
            $objQuery =& SC_Query_Ex::getSingletonInstance();
        }
        $is_out_trans = false;
        if (!$objQuery->inTransaction()) {
            $objQuery->begin();
            $is_out_trans = true;
        }
        //共通のfrom/where文の構築
        $sql_where = SC_Product_Ex::getProductDispConditions('alldtl');
        // 在庫無し商品の非表示
        if (NOSTOCK_HIDDEN) {
            $where_products_class = '(stock >= 1 OR stock_unlimited = 1)';
            $from = $objProduct->alldtlSQL($where_products_class);
        } else {
            $from = 'dtb_products as alldtl';
        }
        //dtb_category_countの構成
        // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを含まない。
        //まずテーブル内容の元を取得
        if (!$is_force_all_count) {
            $arrCategoryCountOld = $objQuery->select('category_id,product_count', 'dtb_category_count');
        } else {
            $arrCategoryCountOld = array();
        }
        //各カテゴリ内の商品数を数えて取得
        $sql = <<<__EOS__
            SELECT T1.category_id, count(T2.category_id) as product_count
            FROM dtb_category AS T1
                LEFT JOIN dtb_product_categories AS T2
                    ON T1.category_id = T2.category_id
                LEFT JOIN {$from}
                    ON T2.product_id = alldtl.product_id
            WHERE {$sql_where}
            GROUP BY T1.category_id, T2.category_id
__EOS__;
        $arrCategoryCountNew = $objQuery->getAll($sql);
        // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを「含む」。
        //差分を取得して、更新対象カテゴリだけを確認する。
        //各カテゴリ毎のデータ値において以前との差を見る
        //古いデータの構造入れ替え
        $arrOld = array();
        foreach ($arrCategoryCountOld as $item) {
            $arrOld[$item['category_id']] = $item['product_count'];
        }
        //新しいデータの構造入れ替え
        $arrNew = array();
        foreach ($arrCategoryCountNew as $item) {
            $arrNew[$item['category_id']] = $item['product_count'];
        }
        unset($arrCategoryCountOld);
        unset($arrCategoryCountNew);
        $arrDiffCategory_id = array();
        //新しいカテゴリ一覧から見て商品数が異なるデータが無いか確認
        foreach ($arrNew as $cid => $count) {
            if ($arrOld[$cid] != $count) {
                $arrDiffCategory_id[] = $cid;
            }
        }
        //削除カテゴリを想定して、古いカテゴリ一覧から見て商品数が異なるデータが無いか確認。
        foreach ($arrOld as $cid => $count) {
            if ($arrNew[$cid] != $count && $count > 0) {
                $arrDiffCategory_id[] = $cid;
            }
        }
        //対象IDが無ければ終了
        if (count($arrDiffCategory_id) == 0) {
            if ($is_out_trans) {
                $objQuery->commit();
            }
            return;
        }
        //差分対象カテゴリIDの重複を除去
        $arrDiffCategory_id = array_unique($arrDiffCategory_id);
        //dtb_category_countの更新 差分のあったカテゴリだけ更新する。
        foreach ($arrDiffCategory_id as $cid) {
            $sqlval = array();
            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
            $sqlval['product_count'] = (string) $arrNew[$cid];
            if ($sqlval['product_count'] == '') {
                $sqlval['product_count'] = (string) '0';
            }
            if (isset($arrOld[$cid])) {
                $objQuery->update('dtb_category_count', $sqlval, 'category_id = ?', array($cid));
            } else {
                if ($is_force_all_count) {
                    $ret = $objQuery->update('dtb_category_count', $sqlval, 'category_id = ?', array($cid));
                    if ($ret > 0) {
                        continue;
                    }
                }
                $sqlval['category_id'] = $cid;
                $objQuery->insert('dtb_category_count', $sqlval);
            }
        }
        unset($arrOld);
        unset($arrNew);
        //差分があったIDとその親カテゴリIDのリストを取得する
        $arrTgtCategory_id = array();
        foreach ($arrDiffCategory_id as $parent_category_id) {
            $arrTgtCategory_id[] = $parent_category_id;
            $arrParentID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
            $arrTgtCategory_id = array_unique(array_merge($arrTgtCategory_id, $arrParentID));
        }
        unset($arrDiffCategory_id);
        //dtb_category_total_count 集計処理開始
        //更新対象カテゴリIDだけ集計しなおす。
        $arrUpdateData = array();
        $where_products_class = '';
        if (NOSTOCK_HIDDEN) {
            $where_products_class .= '(stock >= 1 OR stock_unlimited = 1)';
        }
        $from = $objProduct->alldtlSQL($where_products_class);
        foreach ($arrTgtCategory_id as $category_id) {
            $arrWhereVal = array();
            list($tmp_where, $arrTmpVal) = $this->sfGetCatWhere($category_id);
            if ($tmp_where != '') {
                $sql_where_product_ids = 'product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ')';
                $arrWhereVal = $arrTmpVal;
            } else {
                $sql_where_product_ids = '0<>0';
                // 一致させない
            }
            $where = "({$sql_where}) AND ({$sql_where_product_ids})";
            $arrUpdateData[$category_id] = $objQuery->count($from, $where, $arrWhereVal);
        }
        unset($arrTgtCategory_id);
        // 更新対象だけを更新。
        foreach ($arrUpdateData as $cid => $count) {
            $sqlval = array();
            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
            $sqlval['product_count'] = $count;
            if ($sqlval['product_count'] == '') {
                $sqlval['product_count'] = (string) '0';
            }
            $ret = $objQuery->update('dtb_category_total_count', $sqlval, 'category_id = ?', array($cid));
            if (!$ret) {
                $sqlval['category_id'] = $cid;
                $objQuery->insert('dtb_category_total_count', $sqlval);
            }
        }
        // トランザクション終了処理
        if ($is_out_trans) {
            $objQuery->commit();
        }
    }
 /**
  * 入力チェックを行う.
  *
  * @return void
  */
 function lfCheckError()
 {
     // 入力データを渡す。
     $arrRet = $this->objFormParam->getHashArray();
     $objErr = new SC_CheckError($arrRet);
     $objErr->arrErr = $this->objFormParam->checkError(false);
     if (count($objErr->arrErr) == 0) {
         $objQuery = new SC_Query();
         // 商品ID、規格IDの存在チェック
         if ($arrRet['product_id'] != "") {
             $count = $objQuery->count("dtb_products", "product_id = ?", array($arrRet['product_id']));
             if ($count == 0) {
                 $objErr->arrErr['product_id'] = "※ 指定の商品IDは、登録されていません。";
             }
         }
         if ($arrRet['product_class_id'] != "") {
             $count = 0;
             if ($arrRet['product_id'] != "") {
                 $count = $objQuery->count("dtb_products_class", "product_id = ? AND product_class_id = ?", array($arrRet['product_id'], $arrRet['product_class_id']));
             }
             if ($count == 0) {
                 $objErr->arrErr['product_class_id'] = "※ 指定の規格IDは、登録されていません。";
             }
         }
         // 存在するカテゴリIDかチェック
         $arrCategory_id = explode("|", $arrRet['category_id']);
         foreach ($arrCategory_id as $category_id) {
             $count = $objQuery->count("dtb_category", "category_id = ?", array($category_id));
             if ($count == 0) {
                 $objErr->arrErr['product_id'] = "※ 指定のカテゴリIDは、登録されていません。";
             }
         }
     }
     return $objErr->arrErr;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     //---- ページ初期設定
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDate = new SC_Date();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_GET['send_id'])) {
         $_GET['send_id'] = "";
     }
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_POST['search_pageno'])) {
         $_POST['search_pageno'] = "";
     }
     // 削除時
     if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && $_GET['mode'] == 'delete') {
         $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?";
         $conn->query($sql, array($_GET['send_id']));
         $_SERVER['QUERY_STRING'] = "";
         $this->reload();
     }
     $col = "*";
     $from = "dtb_send_history";
     $where = " del_flg = ?";
     $arrval[] = "0";
     $objQuery = new SC_Query();
     // 行数の取得
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
     // 表示順序
     $order = "start_date DESC, send_id DESC";
     $objQuery->setorder($order);
     // 検索結果の取得
     $this->arrDataList = $objQuery->select($col, $from, $where, $arrval);
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 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;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDb = new SC_Helper_DB_Ex();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if ($_POST['mode'] == "search") {
         // POST値の引き継ぎ
         $this->arrForm = $_POST;
         // 入力文字の強制変換
         $this->lfConvertParam();
         $where = "del_flg = 0 AND status = 1";
         /* 入力エラーなし */
         foreach ($this->arrForm as $key => $val) {
             if ($val == "") {
                 continue;
             }
             switch ($key) {
                 case 'search_name':
                     $where .= " AND name ILIKE ?";
                     $arrval[] = "%{$val}%";
                     break;
                 case 'search_category_id':
                     list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
                     if ($tmp_where != "") {
                         $where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
                         $arrval = array_merge((array) $arrval, (array) $tmp_arrval);
                     }
                     break;
                 case 'search_product_code':
                     $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
                     $arrval[] = "{$val}%";
                     break;
                 default:
                     break;
             }
         }
         $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 ";
         $objQuery = new SC_Query();
         // 行数の取得
         if (empty($arrval)) {
             $arrval = array();
         }
         $linemax = $objQuery->count("dtb_products", $where, $arrval);
         $this->tpl_linemax = $linemax;
         // 何件が該当しました。表示用
         // ページ送りの処理
         if (isset($_POST['search_page_max']) && is_numeric($_POST['search_page_max'])) {
             $page_max = $_POST['search_page_max'];
         } else {
             $page_max = SEARCH_PMAX;
         }
         // ページ送りの取得
         $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
         $this->tpl_strnavi = $objNavi->strnavi;
         // 表示文字列
         $startno = $objNavi->start_row;
         // 取得範囲の指定(開始行番号、行数のセット)
         $objQuery->setlimitoffset($page_max, $startno);
         // 表示順序
         $objQuery->setorder($order);
         // 検索結果の取得
         $this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
     }
     // カテゴリ取得
     $this->arrCatList = $objDb->sfGetCategoryList();
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDb = new SC_Helper_DB_Ex();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     // POST値の取得
     $this->objFormParam->setParam($_POST);
     // 通常時は親カテゴリを0に設定する。
     $this->arrForm['parent_category_id'] = isset($_POST['parent_category_id']) ? $_POST['parent_category_id'] : "";
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'edit':
             $this->objFormParam->convParam();
             $arrRet = $this->objFormParam->getHashArray();
             $this->arrErr = $this->lfCheckError($arrRet);
             if (count($this->arrErr) == 0) {
                 if ($_POST['category_id'] == "") {
                     $objQuery = new SC_Query();
                     $count = $objQuery->count("dtb_category");
                     if ($count < CATEGORY_MAX) {
                         $this->lfInsertCat($_POST['parent_category_id']);
                     } else {
                         print "カテゴリの登録最大数を超えました。";
                     }
                 } else {
                     $this->lfUpdateCat($_POST['category_id']);
                 }
             } else {
                 $this->arrForm = array_merge($this->arrForm, $this->objFormParam->getHashArray());
                 $this->arrForm['category_id'] = $_POST['category_id'];
             }
             break;
         case 'pre_edit':
             // 編集項目のカテゴリ名をDBより取得する。
             $oquery = new SC_Query();
             $where = "category_id = ?";
             $cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id']));
             $description = $oquery->get("dtb_category", "description", $where, array($_POST['category_id']));
             // 入力項目にカテゴリ名を入力する。
             $this->arrForm['category_name'] = $cat_name;
             $this->arrForm['description'] = $description;
             // POSTデータを引き継ぐ
             $this->arrForm['category_id'] = $_POST['category_id'];
             break;
         case 'delete':
             $objQuery = new SC_Query();
             // 子カテゴリのチェック
             $where = "parent_category_id = ? AND del_flg = 0";
             $count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));
             if ($count != 0) {
                 $this->arrErr['category_name'] = "※ 子カテゴリが存在するため削除できません。<br>";
             }
             // 登録商品のチェック
             $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($_POST['category_id']));
             if ($count != 0) {
                 $this->arrErr['category_name'] = "※ カテゴリ内に商品が存在するため削除できません。<br>";
             }
             if (!isset($this->arrErr['category_name'])) {
                 // ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。)
                 $objDb->sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true);
             }
             break;
         case 'up':
             $objQuery = new SC_Query();
             $objQuery->begin();
             $up_id = $this->lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
             if ($up_id != "") {
                 // 上のグループのrankから減算する数
                 $my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
                 // 自分のグループのrankに加算する数
                 $up_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id);
                 if ($my_count > 0 && $up_count > 0) {
                     // 自分のグループに加算
                     $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count);
                     // 上のグループから減算
                     $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count);
                 }
             }
             $objQuery->commit();
             break;
         case 'down':
             $objQuery = new SC_Query();
             $objQuery->begin();
             $down_id = $this->lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
             if ($down_id != "") {
                 // 下のグループのrankに加算する数
                 $my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
                 // 自分のグループのrankから減算する数
                 $down_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id);
                 if ($my_count > 0 && $down_count > 0) {
                     // 自分のグループから減算
                     $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count);
                     // 下のグループに加算
                     $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count);
                 }
             }
             $objQuery->commit();
             break;
         case 'tree':
             break;
         case 'csv':
             require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
             $objCSV = new SC_Helper_CSV_Ex();
             // オプションの指定
             $option = "ORDER BY rank DESC";
             // CSV出力タイトル行の作成
             $arrOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1"));
             if (count($arrOutput) <= 0) {
                 break;
             }
             $arrOutputCols = $arrOutput['col'];
             $arrOutputTitle = $arrOutput['disp_name'];
             $head = SC_Utils_Ex::sfGetCSVList($arrOutputTitle);
             $where = "del_flg = 0";
             $data = $objCSV->lfGetCategoryCSV($where, $option, $arrval, $arrOutputCols);
             // CSVを送信する。
             SC_Utils_Ex::sfCSVDownload($head . $data, 'category');
             exit;
             break;
         default:
             $this->arrForm['parent_category_id'] = 0;
             break;
     }
     $this->arrList = $this->lfGetCat($this->arrForm['parent_category_id']);
     $this->arrTree = $objDb->sfGetCatTree($this->arrForm['parent_category_id']);
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_AdminView();
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     // 検索パラメータの引き継ぎ
     foreach ($_POST as $key => $val) {
         if (ereg("^search_", $key)) {
             $this->arrSearchHidden[$key] = $val;
         }
     }
     $this->tpl_product_id = isset($_POST['product_id']) ? $_POST['product_id'] : "";
     $this->tpl_pageno = isset($_POST['pageno']) ? $_POST['pageno'] : "";
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         // 規格削除要求
         case 'delete':
             $objQuery = new SC_Query();
             $objQuery->setLimitOffset(1);
             $where = "product_id = ? AND NOT (classcategory_id1 = 0 AND classcategory_id2 = 0)";
             $objQuery->setOrder("rank1 DESC, rank2 DESC");
             $arrRet = $objQuery->select("*", "vw_cross_products_class AS crs_prd", $where, array($_POST['product_id']));
             if (count($arrRet) > 0) {
                 $sqlval['product_id'] = $arrRet[0]['product_id'];
                 $sqlval['classcategory_id1'] = '0';
                 $sqlval['classcategory_id2'] = '0';
                 $sqlval['product_code'] = $arrRet[0]['product_code'];
                 $sqlval['stock'] = $arrRet[0]['stock'];
                 $sqlval['price01'] = $arrRet[0]['price01'];
                 $sqlval['price02'] = $arrRet[0]['price02'];
                 $sqlval['creator_id'] = $_SESSION['member_id'];
                 $sqlval['create_date'] = "now()";
                 $sqlval['update_date'] = "now()";
                 $objQuery->begin();
                 $where = "product_id = ?";
                 $objQuery->delete("dtb_products_class", $where, array($_POST['product_id']));
                 $objQuery->insert("dtb_products_class", $sqlval);
                 $objQuery->commit();
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 編集要求
         // 編集要求
         case 'pre_edit':
             $objQuery = new SC_Query();
             $where = "product_id = ? AND NOT(classcategory_id1 = 0 AND classcategory_id2 = 0) ";
             $ret = $objQuery->count("dtb_products_class", $where, array($_POST['product_id']));
             if ($ret > 0) {
                 // 規格組み合わせ一覧の取得(DBの値を優先する。)
                 $this->arrClassCat = $this->lfGetClassCatListEdit($_POST['product_id']);
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 規格組み合わせ表示
         // 規格組み合わせ表示
         case 'disp':
             $this->arrForm['select_class_id1'] = $_POST['select_class_id1'];
             $this->arrForm['select_class_id2'] = $_POST['select_class_id2'];
             $this->arrErr = $this->lfClassError();
             if (count($this->arrErr) == 0) {
                 // 規格組み合わせ一覧の取得
                 $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['select_class_id1'], $_POST['select_class_id2']);
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 規格登録要求
         // 規格登録要求
         case 'edit':
             // 入力値の変換
             $this->arrForm = $this->lfConvertParam($_POST);
             // エラーチェック
             $this->arrErr = $this->lfProductClassError($this->arrForm);
             if (count($this->arrErr) == 0) {
                 // 確認ページ設定
                 $this->tpl_mainpage = 'products/product_class_confirm.tpl';
                 $this->lfProductConfirmPage();
                 // 確認ページ表示
             } else {
                 // 規格組み合わせ一覧の取得
                 $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
                 $this->lfProductClassPage();
                 // 規格登録ページ
             }
             break;
             // 確認ページからの戻り
         // 確認ページからの戻り
         case 'confirm_return':
             // フォームパラメータの引き継ぎ
             $this->arrForm = $_POST;
             // 規格の選択情報は引き継がない。
             $this->arrForm['select_class_id1'] = "";
             $this->arrForm['select_class_id2'] = "";
             // 規格組み合わせ一覧の取得(デフォルト値は出力しない)
             $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
         case 'complete':
             // 完了ページ設定
             $this->tpl_mainpage = 'products/product_class_complete.tpl';
             // 商品規格の登録
             $this->lfInsertProductClass($_POST, $_POST['product_id']);
             break;
         default:
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * dtb_memberからWHERE句に該当する件数を取得する.
  *
  * @access private
  * @param string $where WHERE句
  * @return integer 件数
  */
 function getMemberCount($where)
 {
     $objQuery = new SC_Query();
     $table = 'dtb_member';
     return $objQuery->count($table, $where);
 }
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     $objView = new SC_MobileView();
     $objCustomer = new SC_Customer();
     $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
     $next = $offset;
     // レイアウトデザインを取得
     $objLayout = new SC_Helper_PageLayout_Ex();
     $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
     // 規約内容の取得
     $objQuery = new SC_Query();
     $count = $objQuery->count("dtb_kiyaku", "del_flg <> 1");
     $objQuery->setorder("rank DESC");
     $objQuery->setlimitoffset(1, $offset);
     $arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "del_flg <> 1");
     if ($count > $offset + 1) {
         $next++;
     } else {
         $next = -1;
     }
     $max = count($arrRet);
     $this->tpl_kiyaku_text = "";
     for ($i = 0; $i < $max; $i++) {
         $this->tpl_kiyaku_text .= $arrRet[$i]['kiyaku_title'] . "\n\n";
         $this->tpl_kiyaku_text .= $arrRet[$i]['kiyaku_text'] . "\n\n";
     }
     $objView->assign("offset", $next);
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }
 /**
  * uploadモードのパラメータ検証を行う.
  *
  * @param object $objForm SC_FormParamのインスタンス
  * @return array エラー情報を格納した連想配列, エラーが無ければ(多分)nullを返す
  */
 function lfValidateUpload($objForm)
 {
     $arrErr = $objForm->checkError();
     if (!empty($arrErr)) {
         return $arrErr;
     }
     $arrForm = $objForm->getHashArray();
     // 同名のフォルダが存在する場合はエラー
     if (file_exists(USER_TEMPLATE_PATH . $arrForm['template_code'])) {
         $arrErr['template_code'] = "※ 同名のファイルがすでに存在します。<br/>";
     }
     // 登録不可の文字列チェック
     $arrIgnoreCode = array('admin', 'mobile', 'default');
     if (in_array($arrForm['template_code'], $arrIgnoreCode)) {
         $arrErr['template_code'] = "※ このテンプレートコードは使用できません。<br/>";
     }
     // DBにすでに登録されていないかチェック
     $objQuery = new SC_Query();
     $ret = $objQuery->count("dtb_templates", "template_code = ?", array($arrForm['template_code']));
     if (!empty($ret)) {
         $arrErr['template_code'] = "※ すでに登録されているテンプレートコードです。<br/>";
     }
     // ファイルの拡張子チェック(.tar/tar.gzのみ許可)
     $errFlag = true;
     $array_ext = explode(".", $_FILES['template_file']['name']);
     $ext = $array_ext[count($array_ext) - 1];
     $ext = strtolower($ext);
     // .tarチェック
     if ($ext == 'tar') {
         $errFlag = false;
     }
     $ext = $array_ext[count($array_ext) - 2] . "." . $ext;
     $ext = strtolower($ext);
     // .tar.gzチェック
     if ($ext == 'tar.gz') {
         $errFlag = false;
     }
     if ($errFlag) {
         $arrErr['template_file'] = "※ アップロードするテンプレートファイルで許可されている形式は、tar/tar.gzです。<br />";
     }
     return $arrErr;
 }