/** * Page のアクション. * * @return void */ function action() { parent::action(); $objQuery = SC_Query_Ex::getSingletonInstance(); if (is_array($this->arrHidden['search_customer_type'])) { $cnt = array_sum($this->arrHidden['search_customer_type']); // tpl表示切換用 $this->search_customer_type = $cnt; } elseif (is_array($this->arrForm['search_customer_type']['value'])) { $cnt = array_sum($this->arrForm['search_customer_type']['value']); // tpl表示切換用 $this->search_customer_type = $cnt; } else { $this->search_customer_type = 1; } if (is_array($this->arrData)) { foreach ($this->arrData as &$customer) { $customer_id = $customer["customer_id"]; if ($this->objDb->sfColumnExists("cp_dtb_customer_docomo_mymenu", "customer_id")) { $customer = array_merge(SC_Helper_Customer_Ex::sfGetCustomerData($customer_id), $customer); $customer["mymenu"] = call_user_func("CarrierPay::getCustomerMymenu", array($customer_id)); } if ($this->objDb->sfColumnExists("cp_dtb_point_history", "id")) { $point = $objQuery->getRow(implode(",", array("sum(add_point ) AS add_point", "sum(use_point ) AS use_point", "sum(lost_point) AS lost_point")), "cp_dtb_point_history", "customer_id = ?", array($customer_id)); foreach ($point as $key => $value) { $customer[$key] = $value; } } if ($this->objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) { $customer["transaction"] = $objQuery->select("*", "cp_dtb_customer_transaction", "customer_id = ? AND del_flg = 0 AND continue_account_id IS NOT NULL", array($customer_id)); } } } }
/** * Page を初期化する. * * @return void */ function init() { parent::init(); $this->sid = session_id(); $masterdata = new SC_DB_MasterData_Ex(); $objDb = new SC_Helper_DB_Ex(); if ($objDb->sfColumnExists("atd_mtb_auto_display_status", "id")) { $this->arrAutoDispStatus = $masterdata->getMasterData("atd_mtb_auto_display_status"); } if ($objDb->sfColumnExists("cp_dtb_character", "character_id")) { $this->arrCharacter = $masterdata->getDbMasterData("cp_dtb_character", array("character_id", "character_name", "rank")); } }
/** * Page のAction. * * @return void */ public function action() { parent::action(); $objProduct = new SC_Product_Ex(); $objDb = new SC_Helper_DB_Ex(); $this->tpl_buy_porduct = array_key_exists($this->tpl_product_id, $this->arrRedownloadProduct); $category_id = $objProduct->getCategoryIds($this->tpl_product_id); $this->arrProduct["category_id"] = array_shift($category_id); $this->arrProduct["category"] = $this->arrCategory[$this->arrProduct["category_id"]]; $this->arrProduct["category_name"] = $this->arrProduct["category"]["category_name"]; if ($objDb->sfColumnExists('dtb_category', 'category_code')) { $this->arrProduct["category_code"] = $this->arrProduct["category"]["category_code"]; $this->arrProduct["category_image1"] = $this->arrProduct["category"]["category_image1"] ?: 0; $this->arrProduct["category_image2"] = $this->arrProduct["category"]["category_image2"] ?: 0; $this->arrProduct["category_image3"] = $this->arrProduct["category"]["category_image3"] ?: 0; $this->arrProduct["category_image4"] = $this->arrProduct["category"]["category_image4"] ?: 0; $this->arrProduct["category_image5"] = $this->arrProduct["category"]["category_image5"] ?: 0; } $config = SC_AuonePayment_Ex::getConfig("free_field2"); $mode = $this->getMode(); $this->mode = $mode; switch ($this->getMode()) { case "download": case "check_buy_and_download": $this->doCheckBuyAndDownload($config); break; case "download_ok": case "check_buy_and_download_ok": $this->doCheckBuyAndDownloadOk($config); break; case "download_ng": case "check_buy_and_download_ng": unset($_SESSION["product_ktc_vid"]); SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "このテーマには対応していません。"); break; } $bgcolor = $this->arrProduct["bgcolor"]; $fgcolor = $this->arrProduct["fgcolor"]; $lkcolor = $this->arrProduct["lkcolor"]; if (strlen($bgcolor) && strlen($fgcolor) && strlen($fgcolor)) { $this->tpl_onload .= "\$('section.cont01:eq(0) ').css({\n 'background-color':'#{$bgcolor}','color':'#{$fgcolor}'\n });"; $this->tpl_onload .= "\$('section.cont01:eq(0) a[href*=\"www.kisekae-touch.com\"]').css({\n 'color':'#{$lkcolor}'\n });"; } switch (basename($_SERVER["SCRIPT_NAME"], ".php")) { case "detail": $this->check_os(); break; case "detail_spass": if (!isset($this->arrProduct["product_code_spass"])) { SC_Utils::sfDispSiteError(PRODUCT_NOT_FOUND); } $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->setWhere("spass_provide_start_date <= NOW()"); $objQuery->andWhere("spass_provide_end_date >= NOW()"); $objQuery->andWhere("product_id = ? "); $this->arrSpassProduct = $objProduct->findProductCount($objQuery, array($this->tpl_product_id)); break; } }
/** * Page のプロセス. * * @return void */ function process() { $objView = new SC_SiteView(); $objCartSess = new SC_CartSession("", false); $objDb = new SC_Helper_DB_Ex(); // 管理ページからの確認の場合は、非公開の商品も表示する。 if (isset($_GET['admim']) && $_GET['admin'] == 'on') { $where = "del_flg = 0"; } else { $where = "del_flg = 0 AND status = 1"; } // 値の正当性チェック if (!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) { SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); } $image_key = $_GET['image']; $objQuery = new SC_Query(); // カラムが存在していなければエラー画面を表示 if (!$objDb->sfColumnExists("dtb_products", $image_key)) { SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); } $col = "name, {$image_key}"; $arrRet = $objQuery->select($col, "dtb_products", "product_id = ?", array($_GET['product_id'])); $image_path = IMAGE_SAVE_DIR . $arrRet[0][$image_key]; if (file_exists($image_path)) { list($width, $height) = getimagesize($image_path); } else { $width = 0; $height = 0; } $this->tpl_width = $width; $this->tpl_height = $height; $this->tpl_table_width = $this->tpl_width + 20; $this->tpl_table_height = $this->tpl_height + 20; $this->tpl_image = $arrRet[0][$image_key]; $this->tpl_name = $arrRet[0]['name']; $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
function lfGetInsParam($sqlVal) { $objDb = new SC_Helper_DB_Ex(); foreach ($_GET as $key => $val) { // カラムの存在チェック if ($objDb->sfColumnExists("dtb_order", $key)) { $sqlVal[$key] = $val; } } return $sqlVal; }
/** * * @param SC_Product_Ex $objProduct */ public function lfGetProductsList($searchCondition, $disp_number, $startno, &$objProduct) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objDb = new SC_Helper_DB_Ex(); $arrOrderVal = array(); // 表示順序 switch ($this->orderby) { // ダウンロード順 case 'download': $status = ORDER_PRE_END; $objProduct->setProductsOrder('count(*)', "(SELECT B.* FROM dtb_order A INNER JOIN dtb_order_detail B USING(order_id) WHERE A.del_flg = 0 AND A.status = {$status})", 'ASC'); break; // 販売価格が安い順 // 販売価格が安い順 case 'price': $objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC'); break; // 新着順 // 新着順 case 'date': if ($objDb->sfColumnExists('dtb_products', 'auto_display_start_date')) { $objProduct->setProductsOrder('auto_display_start_date', 'dtb_products', 'DESC'); } else { $objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC'); } break; default: // FIXME 指定した カラムが損z内下場合はそのカラムをキーとする。 if ($objDb->sfColumnExists('dtb_products', 'auto_display_start_date') && strlen($this->orderby) == 0) { $objProduct->setProductsOrder('auto_display_start_date', 'dtb_products', 'DESC'); } elseif ($objDb->sfColumnExists('dtb_products', $this->orderby)) { $objProduct->setProductsOrder($this->orderby, 'dtb_products', 'DESC'); break; } case "rank": if (strlen($searchCondition['where_category']) >= 1) { $dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE ' . $searchCondition['where_category'] . ')'; $arrOrderVal = $searchCondition['arrvalCategory']; } else { $dtb_product_categories = 'dtb_product_categories'; } $col = 'MAX(T3.rank * 2147483648 + T2.rank)'; $from = "{$dtb_product_categories} T2 JOIN dtb_category T3 ON T2.category_id = T3.category_id"; $where = 'T2.product_id = alldtl.product_id'; $sub_sql = $objQuery->getSql($col, $from, $where); $objQuery->setOrder("({$sub_sql}) DESC ,product_id DESC"); break; } // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset($disp_number, $startno); $objQuery->setWhere($searchCondition['where']); // 表示すべきIDとそのIDの並び順を一気に取得 $arrProductId = $objProduct->findProductIdsOrder($objQuery, array_merge($searchCondition['arrval'], $arrOrderVal)); $objQuery =& SC_Query_Ex::getSingletonInstance(); $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId); // 規格を設定 $objProduct->setProductsClassByProductIds($arrProductId); $arrProducts['productStatus'] = $objProduct->getProductStatus($arrProductId); foreach ($arrProducts as $product_id => &$arrProduct) { if ($product_id == 'productStatus') { continue; } $category_id = $objProduct->getCategoryIds($product_id); $arrProduct["category_id"] = array_shift($category_id); $arrProduct["category"] = $this->arrCategory[$arrProduct["category_id"]]; $arrProduct["category_name"] = $arrProduct["category"]["category_name"]; if ($objDb->sfColumnExists('dtb_category', 'category_code')) { $arrProduct["category_code"] = $arrProduct["category"]["category_code"]; $arrProduct["category_image1"] = $arrProduct["category"]["category_image1"] ?: 0; $arrProduct["category_image2"] = $arrProduct["category"]["category_image2"] ?: 0; $arrProduct["category_image3"] = $arrProduct["category"]["category_image3"] ?: 0; $arrProduct["category_image4"] = $arrProduct["category"]["category_image4"] ?: 0; $arrProduct["category_image5"] = $arrProduct["category"]["category_image5"] ?: 0; } } return $arrProducts; }
/** * 商品画像のパスを取得する * * @param $arrForm * @return string 指定された商品画像のパス */ public function lfGetProductImage($arrForm) { $objQuery = SC_Query_Ex::getSingletonInstance(); $table = 'dtb_products'; $col = $arrForm['image_key']; $product_id = $arrForm['product_id']; //指定されたカラムが存在する場合にのみ商品テーブルからファイル名を取得 if (SC_Helper_DB_Ex::sfColumnExists($table, $col, '', '', false)) { $product_image = $objQuery->get($col, $table, 'product_id = ?', array($product_id)); } else { GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php image_key=' . $col); $product_image = ''; } // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定 $file = SC_Utils_Ex::getSaveImagePath($product_image); return $file; }
/** * 商品登録を行う. * * FIXME: 商品登録の実処理自体は、LC_Page_Admin_Products_Productと共通化して欲しい。 * * @param SC_Query $objQuery * SC_Queryインスタンス * @param string|integer $line * 処理中の行数 * @return void */ public function lfRegistProduct($objQuery, $line = '', &$objFormParam) { // 登録データ対象取得 $arrList = $objFormParam->getDbArray(); // 登録時間を生成(DBのCURRENT_TIMESTAMPだとcommitした際、全て同一の時間になってしまう) $arrList['update_date'] = $this->lfGetDbFormatTimeWithLine($line); // 商品登録情報を生成する。 // 商品テーブルのカラムに存在しているもののうち、Form投入設定されていないデータは上書きしない。 $sqlval = SC_Utils_Ex::sfArrayIntersectKeys($arrList, $this->arrProductColumn); // 必須入力では無い項目だが、空文字では問題のある特殊なカラム値の初期値設定 $sqlval = $this->lfSetProductDefaultData($sqlval); GC_Utils_Ex::gfPrintLog(print_r(array(__LINE__, $sqlval, $arrList), true), DEBUG_LOG_REALFILE); $sqlval = $objQuery->extractOnlyColsOf($this->table, $sqlval); if ($sqlval[$this->id_column] != '') { // 同じidが存在すればupdate存在しなければinsert $where = $this->id_column . ' = ?'; $product_exists = $objQuery->exists($this->table, $where, array($sqlval[$this->id_column])); if ($product_exists) { GC_Utils_Ex::gfPrintLog(print_r(array(__LINE__, $sqlval, $arrList), true), DEBUG_LOG_REALFILE); $objQuery->update($this->table, $sqlval, $where, array($sqlval[$this->id_column])); } else { $sqlval['create_date'] = $arrList['update_date']; // INSERTの実行 GC_Utils_Ex::gfPrintLog(print_r(array(__LINE__, $sqlval, $arrList), true), DEBUG_LOG_REALFILE); $objQuery->insert($this->table, $sqlval); // シーケンスの調整 $seq_count = $objQuery->currVal($this->seq_name); if ($seq_count < $sqlval[$this->id_column]) { $objQuery->setVal($this->seq_name, $sqlval[$this->id_column] + 1); } } $product_id = $sqlval[$this->id_column]; } else { // 新規登録 $sqlval[$this->id_column] = $objQuery->nextVal($this->seq_name); $product_id = $sqlval[$this->id_column]; $sqlval['create_date'] = $arrList['update_date']; // INSERTの実行 GC_Utils_Ex::gfPrintLog(print_r(array(__LINE__, $sqlval, $arrList), true), DEBUG_LOG_REALFILE); $objQuery->insert($this->table, $sqlval); } $objDb = new SC_Helper_DB_Ex(); // カテゴリ登録 if (isset($arrList['category_ids'])) { if ($objDb->sfColumnExists($this->categories_table, $this->id_column)) { $objQuery->delete($this->categories_table, $this->id_column . " = ?", array($sqlval[$this->id_column])); $arrCategory_id = explode(',', $arrList['category_ids']); $rank = 1; foreach ($arrCategory_id as $category_id) { $sqlval2 = array($this->id_column => $sqlval[$this->id_column], "category_id" => $category_id, "rank" => $rank++); $sqlval2 = $objQuery->extractOnlyColsOf($this->categories_table, $sqlval2); $objQuery->insert($this->categories_table, $sqlval2); } } } elseif (count($this->arrCategory) == 1) { if ($objDb->sfColumnExists($this->categories_table, $this->id_column)) { $objQuery->delete($this->categories_table, $this->id_column . " = ?", array($sqlval[$this->id_column])); $keys = array_keys($this->arrCategory); $sqlval2 = array($this->id_column => $sqlval[$this->id_column], "category_id" => $keys[0], "rank" => 1); $sqlval2 = $objQuery->extractOnlyColsOf($this->categories_table, $sqlval2); $objQuery->insert($this->categories_table, $sqlval2); } } }
/** * sfColumnExists() のテストケース. */ function testSfColumnExists() { $objDb = new SC_Helper_DB_Ex(); $this->assertEquals(true, $objDb->sfColumnExists('mtb_zip', 'zipcode')); }
/** * 購入履歴情報の取得 * * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed SC_PageNaviオブジェクト) */ public function lfPurchaseHistory($customer_id, $pageno = 0) { if (SC_Utils_Ex::isBlank($customer_id)) { return array('0', array(), NULL); } $objQuery =& SC_Query_Ex::getSingletonInstance(); $page_max = ADMIN_SEARCH_DEFAULT_NUM; $table = 'dtb_order'; /* * キャンセル、決済処理中を除く */ $where = 'customer_id = ? AND del_flg <> 1 AND status <> ? AND status <> ? '; $arrVal = array($customer_id, ORDER_CANCEL, ORDER_PENDING); // 購入履歴の件数取得 $linemax = $objQuery->count($table, $where, $arrVal); // ページ送りの取得 $objNavi = new SC_PageNavi_Ex($pageno, $linemax, $page_max, 'eccube.moveSecondSearchPage', NAVI_PMAX); // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset($page_max, $objNavi->start_row); // 表示順序 $order = 'order_id DESC'; $objQuery->setOrder($order); // 購入履歴情報の取得 $col = "*"; $objDb = new SC_Helper_DB_Ex(); if ($objDb->sfColumnExists("cp_dtb_point_history", "order_id")) { $col .= ",(SELECT count(*) FROM cp_dtb_point_history WHERE order_id = dtb_order.order_id AND customer_id = dtb_order.customer_id ) AS download_count"; $col .= ",(SELECT min(create_date) FROM cp_dtb_point_history WHERE order_id = dtb_order.order_id AND customer_id = dtb_order.customer_id ) AS min_download_date"; $col .= ",(SELECT max(create_date) FROM cp_dtb_point_history WHERE order_id = dtb_order.order_id AND customer_id = dtb_order.customer_id ) AS max_download_date"; } $arrPurchaseHistory = $objQuery->select($col, $table, $where, $arrVal); $objPurchase = new SC_Helper_Purchase_Ex(); foreach ($arrPurchaseHistory as &$row) { $row["detail"] = $objPurchase->getOrderDetail($row["order_id"]); } return array($linemax, $arrPurchaseHistory, $objNavi); }
public function __construct($array, $mode = '') { $pmode = $mode; if ($mode == "delete_in_customer") { $pmode = "customer"; } parent::__construct($array, $pmode); if ($mode == "delete_in_customer") { strpos($this->where, ' del_flg = 0 '); // 先頭の del_flg = 0 を全ての条件に変える $this->where = preg_replace('/^ del_flg = 0 /', ' del_flg IS NOT NULL ', $this->where); } $objDb = new SC_Helper_DB_Ex(); // query 構築用 $objQuery = SC_Query_Ex::getSingletonInstance(); GC_Utils_Ex::gfPrintLog(print_r($this->arrSql, true), DB_LOG_REALFILE); $having = ""; if (count($this->arrSql["search_status"]) == 1) { switch ($this->arrSql["search_status"][0]) { case 1: $having = "MIN(del_flg) = 1"; break; case 2: $having = "MIN(del_flg) = 0"; break; } } $dt = "cp_dtb_customer_docomo_mymenu"; $at = "cp_dtb_customer_transaction"; $d = $objDb->sfColumnExists($dt, "customer_id"); $a = $objDb->sfColumnExists($at, "customer_id"); $objQuery->setGroupBy("customer_id"); if ($having) { $objQuery->setOption("HAVING {$having}"); } $where = PHP_EOL; $where .= "CASE " . PHP_EOL; $where .= " WHEN 1 = 0 THEN FALSE " . PHP_EOL; // 自動構築時に特定条件で使えなくなることを防ぐ if ($d) { $sub_where = " payment_type IN ( 'USER1','USER10','USER12','USER3')"; // 都度課金を除く if ($this->strlen('search_docomo_site_id') > 0) { $sub_where .= " AND site_id = ?"; $this->arrVal[] = $this->arrSql['search_docomo_site_id']; } if ($this->strlen('search_course') > 0) { $sub_where .= " AND price = ?"; $this->arrVal[] = intval($this->arrSql['search_course']); } $where .= "WHEN carrier = 1 THEN " . PHP_EOL; // docomo $where .= sprintf(" customer_id IN (%s) " . PHP_EOL, $objQuery->getSql("customer_id", $dt, $sub_where)); } if ($a) { $sub_where = "continue_account_id IS NOT NULL"; if ($this->strlen('search_docomo_site_id') > 0) { // サイト ID を指定した場合は 検索対象から除外 $sub_where .= " AND FALSE "; } if ($this->strlen('search_course') > 0) { $sub_where .= " AND amount = ?"; $this->arrVal[] = intval($this->arrSql['search_course']); } $where .= "WHEN carrier = 2 THEN " . PHP_EOL; // au-kddi $where .= sprintf(" customer_id IN (%s) " . PHP_EOL, $objQuery->getSql("customer_id", $at, $sub_where)); } $where .= "ELSE FALSE END" . PHP_EOL; $this->setWhere($where); unset($where); $objQuery->setGroupBy(""); $objQuery->setOption(""); // 有効なメルマガ会員か本登録ユーザー $where = "CASE WHEN email LIKE ? THEN TRUE ELSE mailmaga_flg <> 3 END " . PHP_EOL; $this->arrVal[] = $this->addSearchStr("@" . $_SERVER['SERVER_NAME']); $this->setWhere($where); if ($this->is_array("search_customer_type")) { switch ($this->sum("search_customer_type")) { case "1": $this->setWhere('mailmaga_flg = 3'); break; case "2": $this->setWhere('mailmaga_flg <> 3'); break; } } if ($this->strlen("search_point")) { $this->setWhere('point >= ? ' . PHP_EOL); $this->arrVal[] = intval($this->arrSql['search_point']); } // carrier if ($this->strlen("search_carrier")) { $this->setWhere(' carrier = ? ' . PHP_EOL); $this->arrVal[] = intval($this->arrSql['search_carrier']); } else { } if ($mode == 'customer') { // 登録日を示すカラム $regdate_col = 'dtb_customer.update_date DESC'; $this->setOrder($regdate_col); } elseif ($mode == 'DuplicateSiteId') { if (SC_Helper_DB::sfColumnExists("cp_dtb_customer_docomo_mymenu", "customer_id")) { $arrPaymentType = array("USER1", "USER10", "USER12"); $this->arrVal = array_merge($this->arrVal, $arrPaymentType); $objSql = new SC_SelectSql(); $objSql->setWhere("del_flg = 0"); $objSql->setItemTerm($arrPaymentType, "payment_type"); $objSql->setSelect("SELECT customer_id FROM cp_dtb_customer_docomo_mymenu "); $objSql->setGroup("customer_id HAVING count(site_id) > 1"); $inquery = $objSql->getSql(2); $this->setWhere("customer_id IN ({$inquery})"); } $regdate_col = 'dtb_customer.customer_id DESC'; $this->setOrder($regdate_col); } }
/** * 表示用フォームパラメーター取得 * - 入力画面 * * @param SC_UploadFile_Ex $objUpFile * SC_UploadFileインスタンス * @param SC_UploadFile_Ex $objDownFile * SC_UploadFileインスタンス * @param array $arrForm * フォーム入力パラメーター配列 * @return array 表示用フォームパラメーター配列 */ public function lfSetViewParam_InputPage(SC_UploadFile &$objUpFile, SC_UploadFile &$objDownFile, &$arrForm) { $objProduct = new SC_Product_Ex(); $arrForm = parent::lfSetViewParam_InputPage($objUpFile, $objDownFile, $arrForm); $product_id = $arrForm["product_id"]; $objQuery = SC_Query_Ex::getSingletonInstance(); $objDb = new SC_Helper_DB_Ex(); $check = $objQuery->extractOnlyColsOf("dtb_products", array("auto_display_start_date" => true, "auto_display_end_date" => true, "spass_provide_start_date" => true, "spass_provide_end_date" => true)); $check = array_keys($check); if (count($check) && $objProduct->isValidProductId($product_id, true)) { $arrProduct = $objQuery->getRow(implode(",", $check), "dtb_products", "product_id = ?", (array) $product_id); $arrForm["auto_display_start_date"] = strtotime($arrProduct["auto_display_start_date"]); $arrForm["auto_display_end_date"] = strtotime($arrProduct["auto_display_end_date"]); $arrForm["spass_provide_start_date"] = strtotime($arrProduct["spass_provide_start_date"]); $arrForm["spass_provide_end_date"] = strtotime($arrProduct["spass_provide_end_date"]); GC_Utils_Ex::gfPrintLog(print_r($arrProduct, true), DEBUG_LOG_REALFILE); if ($arrForm["auto_display_start_date"]) { $arrForm["auto_display_start_date_year"] = date("Y", $arrForm["auto_display_start_date"]); $arrForm["auto_display_start_date_month"] = date("m", $arrForm["auto_display_start_date"]); $arrForm["auto_display_start_date_day"] = date("d", $arrForm["auto_display_start_date"]); } unset($arrForm["auto_display_start_date"]); if ($arrForm["auto_display_end_date"]) { $arrForm["auto_display_end_date_year"] = date("Y", $arrForm["auto_display_end_date"]); $arrForm["auto_display_end_date_month"] = date("m", $arrForm["auto_display_end_date"]); $arrForm["auto_display_end_date_day"] = date("d", $arrForm["auto_display_end_date"]); } unset($arrForm["auto_display_end_date"]); // spass_provide_start_date if ($arrForm["spass_provide_start_date"]) { $arrForm["spass_provide_start_date_year"] = date("Y", $arrForm["spass_provide_start_date"]); $arrForm["spass_provide_start_date_month"] = date("m", $arrForm["spass_provide_start_date"]); $arrForm["spass_provide_start_date_day"] = date("d", $arrForm["spass_provide_start_date"]); } unset($arrForm["spass_provide_start_date"]); // spass_provide_end_date if ($arrForm["spass_provide_end_date"]) { $arrForm["spass_provide_end_date_year"] = date("Y", $arrForm["spass_provide_end_date"]); $arrForm["spass_provide_end_date_month"] = date("m", $arrForm["spass_provide_end_date"]); $arrForm["spass_provide_end_date_day"] = date("d", $arrForm["spass_provide_end_date"]); } unset($arrForm["spass_provide_end_date"]); } elseif (count($check)) { $arrForm["auto_display_start_date_year"] = date("Y"); $arrForm["auto_display_start_date_month"] = date("m"); $arrForm["auto_display_start_date_day"] = date("d"); unset($arrForm["auto_display_start_date"]); unset($arrForm["auto_display_end_date"]); unset($arrForm["spass_provide_start_date"]); unset($arrForm["spass_provide_end_date"]); } if ($objDb->sfColumnExists("cp_dtb_product_characters", "product_id")) { $arrForm["character_id"] = $objQuery->getCol("character_id", "cp_dtb_product_characters", "product_id=?", array($product_id)); } // auto_display_end_date_year return $arrForm; }
$objQuery = new SC_Query(); // 前のページで正しく登録手続きが行われた記録があるか判定 SC_Utils::sfIsPrePage($objSiteSess); // SPSモジュール連携用 if (file_exists(MODULE_PATH . 'mdl_sps/inc/include.php') && !$objCartSess->getTotalQuantity()) { require_once MODULE_PATH . 'mdl_sps/inc/include.php'; header("Location: " . ERROR_URL); exit; } // アクセスの正当性の判定 $uniqid = SC_Utils::sfCheckNormalAccess($objSiteSess, $objCartSess); $payment_id = $_SESSION["payment_id"]; // 支払いIDが無い場合にはエラー if ($payment_id == "") { SC_Utils::sfDispSiteError(PAGE_ERROR, "", true); } // 決済情報を取得する $objDB = new SC_Helper_DB_Ex(); if ($objDB->sfColumnExists("dtb_payment", "memo01")) { $sql = "SELECT module_path, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ?"; $arrPayment = $objQuery->getall($sql, array($payment_id)); } if (count($arrPayment) > 0) { $path = $arrPayment[0]['module_path']; if (file_exists($path)) { require_once $path; exit; } else { SC_Utils::sfDispSiteError(FREE_ERROR_MSG, "", true, "モジュールファイルの取得に失敗しました。<br />この手続きは無効となりました。"); } }
function init() { parent::init(); $objCustomer = new SC_Customer_Ex(); if (isset($_GET["sid"]) && isset($_GET["admin"])) { $sid = $_REQUEST["sid"]; $email = $objCustomer->getValue("email"); $osid = session_id(); if ($osid != $sid) { session_destroy(); session_id($sid); session_start(); } $objCustomer->setLogin($email); $get = $_GET; unset($get["sid"]); SC_Response_Ex::reload($get, true); } $objQuery = SC_Query_Ex::getSingletonInstance(); $objProduct = new SC_Product_Ex(); if (GC_Utils_Ex::isFrontFunction() && $this->skip_load_page_layout == false) { $objCustomer = new SC_Customer_Ex(); // 画面更新毎に情報を更新する if ($objCustomer->isLoginSuccess()) { // 初回アクセス時に更新 $objCustomer->updateSession(); $this->tpl_login = true; $this->tpl_point = $objCustomer->getValue("point"); $this->tpl_customer_id = $objCustomer->getValue("customer_id"); $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date"); $this->tpl_carrier = $objCustomer->getValue("carrier"); $downloadable_days = $this->arrSiteInfo["downloadable_days"]; $downloadable_days_unlimited = $this->arrSiteInfo["downloadable_days_unlimited"]; $date = null; if ($downloadable_days_unlimited) { $date = SC_Utils_Ex::sfGetTimestamp(RELEASE_YEAR, 1, 1, false); $date2 = SC_Utils_Ex::sfGetTimestamp(9999, 12, 31, false); } else { $xdate = strtotime("-{$downloadable_days} day"); $date = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false); $xdate = strtotime("+{$downloadable_days} day"); $date2 = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false); } $this->downloadable_days = $date; $this->downloadable_days2 = $date2; $objPurchase = new SC_Helper_Purchase_Ex(); $arrOrderId = $objQuery->getCol("order_id", "dtb_order", "payment_date > ? AND customer_id = ?", array($date, $this->tpl_customer_id)); $this->arrRedownloadProduct = array(); foreach ($arrOrderId as $order_id) { $arrOrderDetail = $objPurchase->getOrderDetail($order_id, true); $this->arrRedownloadProduct = array_merge($this->arrRedownloadProduct, $arrOrderDetail); } // 再ダウンロード可能な商品一覧 $this->arrRedownloadProduct = SC_Utils_Ex::makeArrayIDToKey("product_id", $this->arrRedownloadProduct); foreach ($this->arrRedownloadProduct as $product_id => $row) { $row["product"] = $objProduct->getDetail($product_id); $this->arrRedownloadProduct[$product_id] = $row; } } else { $this->tpl_login = false; $this->tpl_point = 0; $this->tpl_customer_id = 0; $this->tpl_first_buy_date = null; $this->tpl_carrier = 9; $this->arrRedownloadProduct = array(); } $objDb = new SC_Helper_DB_Ex(); if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) { $where = " customer_id = ? AND transaction_status = ? AND continue_account_id IS NOT NULL AND del_flg = 0"; $arrWhereVal = array($this->tpl_customer_id, 40); if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) { // OK } else { switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) { case "au": break; default: if ($objCustomer->isLoginSuccess()) { $objCustomer->EndSession(); SC_Response_Ex::reload(); } break; } } } $objCategory = new SC_Helper_Category_Ex(); $this->arrCommonCategory = $objCategory->getList(true); $this->arrCommonCategoryTree = $objCategory->getTree(); $detect = new Mobile_Detect(); $script_file = $_SERVER["SCRIPT_NAME"]; $script_file = ltrim($script_file, "/"); $script_file2 = str_replace("ios/", "", $script_file); if ($detect->is("iOS")) { if (file_exists(HTML_REALDIR . "ios/{$script_file}")) { SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET); } } elseif (strcmp($script_file, $script_file2) !== 0) { SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET); } $_SESSION["is_android"] = $detect->is("AndroidOS"); if ($detect->isMobile() == false) { // NG $this->device_support = false; } elseif ($detect->is("iOS")) { if ($detect->match("iPhone")) { // OK $this->device_support = true; } elseif ($detect->match("iPod")) { // NG $this->device_support = false; } elseif ($detect->match("iPad")) { // NG $this->device_support = false; } else { // NG $this->device_support = false; } $version = $detect->version("iOS", $detect::VERSION_TYPE_FLOAT); if ($version < 6) { // NG $this->device_support = false; } } elseif ($detect->match("Android") == false) { // NG $this->device_support = false; } elseif (class_exists("SC_DeviceAndroidSelect_Ex", true)) { $useragent = array(); if (preg_match("|.*; ([^;]+) Build/.*|", $_SERVER["HTTP_USER_AGENT"], $useragent)) { $device = new SC_DeviceAndroidSelect_Ex(array("search_device_user_agent_word" => $useragent[1], "search_status" => 1)); $this->device_support = $device->exists(); $this->tpl_device = $device->getOne(); } } elseif ($detect->match("Android")) { // OK $this->device_support = true; } else { // NG $this->device_support = false; } } if ($this->device_support) { GC_Utils_Ex::gfPrintLog("対応端末:" . $_SERVER['HTTP_USER_AGENT']); return; } else { GC_Utils_Ex::gfPrintLog("非対応端末:" . $_SERVER['HTTP_USER_AGENT']); if (is_a($this, "LC_Page_Index")) { SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php"); } elseif (is_a($this, "LC_Page_Unsupported")) { // 非対応端末表示を行わない return; } elseif (is_a($this, "LC_Page_Entry_Kiyaku")) { // 非対応端末表示を行わない return; } elseif ($this->not_unsupported) { // 非対応端末表示を行わない return; } else { SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php"); } } }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objCartSess = new SC_CartSession(); $objSiteInfo = $objView->objSiteInfo; $objSiteSess = new SC_SiteSession(); $objCustomer = new SC_Customer(); $arrInfo = $objSiteInfo->data; $objQuery = new SC_Query(); $objDb = new SC_Helper_DB_Ex(); // 前のページで正しく登録手続きが行われた記録があるか判定 SC_Utils_Ex::sfIsPrePage($objSiteSess, true); // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; // カート集計処理 $objDb->sfTotalCart($this, $objCartSess, $arrInfo); // 一時受注テーブルの読込 $arrData = $objDb->sfGetOrderTemp($uniqid); // カート集計を元に最終計算 $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer); // カート内の商品の売り切れチェック $objCartSess->chkSoldOut($objCartSess->getCartList()); // 会員ログインチェック if ($objCustomer->isLoginSuccess(true)) { $this->tpl_login = '******'; $this->tpl_user_point = $objCustomer->getValue('point'); } // 決済区分を取得する $payment_type = ""; if ($objDb->sfColumnExists("dtb_payment", "memo01")) { // MEMO03に値が入っている場合には、モジュール追加されたものとみなす $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?"; $arrPayment = $objQuery->getall($sql, array($arrData['payment_id'])); $payment_type = $arrPayment[0]["memo03"]; } $this->payment_type = $payment_type; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } switch ($_POST['mode']) { // 前のページに戻る case 'return': // 正常な推移であることを記録しておく $objSiteSess->setRegistFlag(); $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; break; case 'confirm': // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため) // postgresqlとmysqlとで処理を分ける if (DB_TYPE == "pgsql") { $order_id = $objQuery->nextval("dtb_order", "order_id"); } elseif (DB_TYPE == "mysql") { $order_id = $objQuery->get_auto_increment("dtb_order"); } $arrData["order_id"] = $order_id; // セッション情報を保持 $arrData['session'] = serialize($_SESSION); // 集計結果を受注一時テーブルに反映 $objDb->sfRegistTempOrder($uniqid, $arrData); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // 決済方法により画面切替 if ($payment_type != "") { $_SESSION["payment_id"] = $arrData['payment_id']; $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_MODULE), true); } else { $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_COMPLETE), true); } exit; break; default: break; } $this->arrData = $arrData; $this->arrInfo = $arrInfo; $objView->assignobj($this); $objView->display(SITE_FRAME); }