public function doAction($arrParam) { $arrRequest = $this->doInitParam($arrParam); if (!$this->isParamError()) { $objProduct = new SC_Product_Ex(); switch ($arrRequest['IdType']) { case 'product_code': $search_column = 'product_code'; break; case 'product_class_id': $arrProduct = $objProduct->getDetailAndProductsClass($arrRequest['ItemId']); break; case 'product_id': default: $arrProduct = $objProduct->getDetail($arrRequest['ItemId']); break; } $objProduct->setProductsClassByProductIds(array($arrProduct['product_id'])); if ($arrProduct['del_flg'] == '0' && $arrProduct['status'] == '1') { unset($arrProduct['note']); $this->setResponse('product_id', $arrProduct['product_id']); $this->setResponse('DetailPageURL', HTTP_URL . 'products/detail.php?product_id=' . $arrProduct['product_id']); $this->setResponse('Title', $arrProduct['name']); $this->setResponse('ItemAttributes', $arrProduct); return true; } else { $this->addError('ItemLookup.Error', t('c_* The requested information was not found._01')); } } return false; }
/** * Page のアクション. * * @return void */ function action() { $layout = new SC_Helper_PageLayout_Ex(); $layout->sfGetPageLayout($this, false, $_SERVER['SCRIPT_NAME'], $this->objDisplay->detectDevice()); $this->arrBreadcrumb[0][0] = array(); switch ($this->arrPageLayout['url']) { case 'products/list.php': $category_id = $_GET['category_id']; if ($category_id) { $this->arrBreadcrumb[0] = self::getBreadcrumbByCategoryId(intval($category_id)); } else { if ($_GET['mode'] == 'search') { $this->current_name = '検索結果'; } else { $this->current_name = '全商品'; } } break; case 'products/detail.php': $product_id = $_GET['product_id']; $this->arrBreadcrumb = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id); $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetail($product_id); $this->current_name = $arrProduct['name']; break; case 'index.php': $this->current_name = ''; break; default: $this->current_name = $this->arrPageLayout['page_name']; break; } $this->arrData = self::loadData(); }
/** * Page のAction. * * @return void */ function action() { // 会員クラス $objCustomer = new SC_Customer_Ex(); // パラメーター管理クラス $this->objFormParam = new SC_FormParam_Ex(); // パラメーター情報の初期化 $this->arrForm = $this->lfInitParam($this->objFormParam); // ファイル管理クラス $this->objUpFile = new SC_UploadFile_Ex(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); // ファイル情報の初期化 $this->objUpFile = $this->lfInitFile($this->objUpFile); // プロダクトIDの正当性チェック $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id')); $this->mode = $this->getMode(); if ($_SESSION['customer']['email'] != "") { /*My own query*/ $servername = "localhost"; $username = "******"; $password = "******"; $dbname = "rise_up_shop"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection $sql = "update dtb_products SET view_count=view_count+1 WHERE product_id={$product_id}"; mysqli_query($conn, $sql); } $objProduct = new SC_Product_Ex(); $objProduct->setProductsClassByProductIds(array($product_id)); // 規格1クラス名 $this->tpl_class_name1 = $objProduct->className1[$product_id]; // 規格2クラス名 $this->tpl_class_name2 = $objProduct->className2[$product_id]; // 規格1 $this->arrClassCat1 = $objProduct->classCats1[$product_id]; // 規格1が設定されている $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id]; // 規格2が設定されている $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id]; $this->tpl_stock_find = $objProduct->stock_find[$product_id]; $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_class_id']; $this->tpl_product_type = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_type']; // 在庫が無い場合は、OnLoadしない。(javascriptエラー防止) if ($this->tpl_stock_find) { // 規格選択セレクトボックスの作成 $this->js_lnOnload .= $this->lfMakeSelect(); } $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';'; $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}'; $this->tpl_onload .= 'lnOnLoad();'; // モバイル用 規格選択セレクトボックスの作成 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { $this->lfMakeSelectMobile($this, $product_id, $this->objFormParam->getValue('classcategory_id1')); } // 商品IDをFORM内に保持する $this->tpl_product_id = $product_id; switch ($this->mode) { case 'cart': $this->doCart(); break; case 'add_favorite': $this->doAddFavorite($objCustomer); break; case 'add_favorite_sphone': $this->doAddFavoriteSphone($objCustomer); break; case 'select': case 'select2': case 'selectItem': /** * モバイルの数量指定・規格選択の際に、 * $_SESSION['cart_referer_url'] を上書きさせないために、 * 何もせずbreakする。 */ break; default: $this->doDefault(); break; } // モバイル用 ポストバック処理 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { switch ($this->mode) { case 'select': $this->doMobileSelect(); break; case 'select2': $this->doMobileSelect2(); break; case 'selectItem': $this->doMobileSelectItem(); break; case 'cart': $this->doMobileCart(); break; default: $this->doMobileDefault(); break; } } // 商品詳細を取得 $this->arrProduct = $objProduct->getDetail($product_id); // サブタイトルを取得 $this->tpl_subtitle = $this->arrProduct['name']; // 関連カテゴリを取得 $this->arrRelativeCat = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id); // 商品ステータスを取得 $this->productStatus = $objProduct->getProductStatus($product_id); // 画像ファイル指定がない場合の置換処理 $this->arrProduct['main_image'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']); $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile); //レビュー情報の取得 $this->arrReview = $this->lfGetReviewData($product_id); //関連商品情報表示 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); // ログイン判定 if ($objCustomer->isLoginSuccess() === true) { //お気に入りボタン表示 $this->tpl_login = true; $this->is_favorite = SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id)); } }
/** * Page のAction. * * @return void */ function action() { // 会員クラス $objCustomer = new SC_Customer_Ex(); // パラメーター管理クラス $this->objFormParam = new SC_FormParam_Ex(); // パラメーター情報の初期化 $this->arrForm = $this->lfInitParam($this->objFormParam); // ファイル管理クラス $this->objUpFile = new SC_UploadFile_Ex(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); // ファイル情報の初期化 $this->objUpFile = $this->lfInitFile($this->objUpFile); // プロダクトIDの正当性チェック $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id')); $this->mode = $this->getMode(); $objProduct = new SC_Product_Ex(); $objProduct->setProductsClassByProductIds(array($product_id)); // 規格1クラス名 $this->tpl_class_name1 = $objProduct->className1[$product_id]; // 規格2クラス名 $this->tpl_class_name2 = $objProduct->className2[$product_id]; // 規格1 $this->arrClassCat1 = $objProduct->classCats1[$product_id]; // 規格1が設定されている $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id]; // 規格2が設定されている $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id]; $this->tpl_stock_find = $objProduct->stock_find[$product_id]; $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_class_id']; $this->tpl_product_type = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_type']; // 在庫が無い場合は、OnLoadしない。(javascriptエラー防止) if ($this->tpl_stock_find) { // 規格選択セレクトボックスの作成 $this->js_lnOnload .= $this->lfMakeSelect(); } $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';'; $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}'; $this->tpl_onload .= 'lnOnLoad();'; // モバイル用 規格選択セレクトボックスの作成 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { $this->lfMakeSelectMobile($this, $product_id, $this->objFormParam->getValue('classcategory_id1')); } // 商品IDをFORM内に保持する $this->tpl_product_id = $product_id; switch ($this->mode) { case 'cart': $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2); if (count($this->arrErr) == 0) { $objCartSess = new SC_CartSession_Ex(); $product_class_id = $this->objFormParam->getValue('product_class_id'); $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity')); SC_Response_Ex::sendRedirect(CART_URLPATH); SC_Response_Ex::actionExit(); } break; case 'add_favorite': // ログイン中のユーザが商品をお気に入りにいれる処理 if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam); if (count($this->arrErr) == 0) { if (!$this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) { $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite', array($this)); SC_Response_Ex::actionExit(); } } } break; case 'add_favorite_sphone': // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用) if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam); if (count($this->arrErr) == 0) { if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) { $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this)); print 'true'; SC_Response_Ex::actionExit(); } } print 'error'; SC_Response_Ex::actionExit(); } break; case 'select': case 'select2': case 'selectItem': /** * モバイルの数量指定・規格選択の際に、 * $_SESSION['cart_referer_url'] を上書きさせないために、 * 何もせずbreakする。 */ break; default: // カート「戻るボタン」用に保持 $netURL = new Net_URL(); $_SESSION['cart_referer_url'] = $netURL->getURL(); break; } // モバイル用 ポストバック処理 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { switch ($this->mode) { case 'select': // 規格1が設定されている場合 if ($this->tpl_classcat_find1) { // templateの変更 $this->tpl_mainpage = 'products/select_find1.tpl'; break; } // 数量の入力を行う $this->tpl_mainpage = 'products/select_item.tpl'; break; case 'select2': $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2); // 規格1が設定されていて、エラーを検出した場合 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { // templateの変更 $this->tpl_mainpage = 'products/select_find1.tpl'; break; } // 規格2が設定されている場合 if ($this->tpl_classcat_find2) { $this->arrErr = array(); $this->tpl_mainpage = 'products/select_find2.tpl'; break; } case 'selectItem': $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2); // 規格2が設定されていて、エラーを検出した場合 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { // templateの変更 $this->tpl_mainpage = 'products/select_find2.tpl'; break; } $value1 = $this->objFormParam->getValue('classcategory_id1'); // 規格2が設定されている場合. if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false) { $value2 = '#' . $this->objFormParam->getValue('classcategory_id2'); } else { $value2 = '#0'; } if (strlen($value1) === 0) { $value1 = '__unselected'; } $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id']; // この段階では、数量の入力チェックエラーを出させない。 unset($this->arrErr['quantity']); // 数量の入力を行う $this->tpl_mainpage = 'products/select_item.tpl'; break; case 'cart': // この段階でエラーが出る場合は、数量の入力エラーのはず if (count($this->arrErr)) { // 数量の入力を行う $this->tpl_mainpage = 'products/select_item.tpl'; } break; default: $this->tpl_mainpage = 'products/detail.tpl'; break; } } // 商品詳細を取得 $this->arrProduct = $objProduct->getDetail($product_id); // サブタイトルを取得 $this->tpl_subtitle = $this->arrProduct['name']; // 関連カテゴリを取得 $this->arrRelativeCat = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id); // 商品ステータスを取得 $this->productStatus = $objProduct->getProductStatus($product_id); // 画像ファイル指定がない場合の置換処理 $this->arrProduct['main_image'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']); $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile); //レビュー情報の取得 $this->arrReview = $this->lfGetReviewData($product_id); //関連商品情報表示 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); // ログイン判定 if ($objCustomer->isLoginSuccess() === true) { //お気に入りボタン表示 $this->tpl_login = true; $this->is_favorite = SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id)); } }
/** * 商品情報を取得する * @param Integer $product_id 商品ID * @return Array $return 商品のデータを格納した配列 */ public function getProduct($product_id) { $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetail($product_id); $return = array('product_id' => $arrProduct['product_id'], 'main_list_image' => $arrProduct['main_list_image'], 'name' => $arrProduct['name']); return $return; }
/** * 関連商品データ表示用配列を取得する * * @param string $arrForm フォーム入力パラメーター配列 * @return array 関連商品データ配列 */ function lfGetRecommendProducts(&$arrForm) { $arrRecommend = array(); for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) { $keyname = 'recommend_id' . $i; $delkey = 'recommend_delete' . $i; $commentkey = 'recommend_comment' . $i; if (!isset($arrForm[$delkey])) { $arrForm[$delkey] = null; } if (isset($arrForm[$keyname]) && !empty($arrForm[$keyname]) && $arrForm[$delkey] != 1) { $objProduct = new SC_Product_Ex(); $arrRecommend[$i] = $objProduct->getDetail($arrForm[$keyname]); $arrRecommend[$i]['product_id'] = $arrForm[$keyname]; $arrRecommend[$i]['comment'] = $arrForm[$commentkey]; } } return $arrRecommend; }
/** * DBに商品データを登録する * * @param SC_UploadFile_Ex $objUpFile * SC_UploadFileインスタンス * @param SC_UploadFile_Ex $objDownFile * SC_UploadFileインスタンス * @param array $arrList * フォーム入力パラメーター配列 * @return integer 登録商品ID */ public function lfRegistProduct(SC_UploadFile &$objUpFile, SC_UploadFile &$objDownFile, $arrList) { $product_id = parent::lfRegistProduct($objUpFile, $objDownFile, $arrList); $objQuery = SC_Query_Ex::getSingletonInstance(); $objDb = new SC_Helper_DB_Ex(); // auto_display_ $arrList["auto_display_start_date"] = $this->sfGetTimestamp($arrList, "auto_display_start_date"); $arrList["auto_display_end_date"] = $this->sfGetTimestamp($arrList, "auto_display_end_date", true); // spass_provide_ $arrList["spass_provide_start_date"] = $this->sfGetTimestamp($arrList, "spass_provide_start_date"); $arrList["spass_provide_end_date"] = $this->sfGetTimestamp($arrList, "spass_provide_end_date", true); // FIXME 画像のリネーム $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetail($product_id); $objUpFile->setDBFileList($arrProduct); $arrTemp = $objUpFile->getDBFileList(); GC_Utils_Ex::gfPrintLog(print_r($arrProduct, true), DEBUG_LOG_REALFILE); GC_Utils_Ex::gfPrintLog(print_r($arrTemp, true), DEBUG_LOG_REALFILE); $arrRet = SC_Utils_Ex::sfArrayIntersectKeys($arrList, array("kisekae_provider_id", "kisekae_site_id", "kisekae_contents_id", "auto_display_status", "auto_display_start_date", "auto_display_end_date", "spass_provide_start_date", "spass_provide_end_date", "bgcolor", "fgcolor", "lkcolor", "product_code_spass", "kisekae_contents_spass_id")); GC_Utils_Ex::gfPrintLog(print_r($arrTemp, true), DEBUG_LOG_REALFILE); $arrTemp = array_filter($arrTemp, function ($filename) { $filename_realpath = IMAGE_SAVE_REALDIR . $filename; list($width, $height) = getimagesize($filename_realpath); return is_file($filename_realpath) && $width > 0 && $height > 0; }); GC_Utils_Ex::gfPrintLog(print_r($arrTemp, true), DEBUG_LOG_REALFILE); foreach ($arrTemp as $key => $filename) { GC_Utils_Ex::gfPrintLog(print_r(array($key => $filename), true), DEBUG_LOG_REALFILE); $filename_realpath = IMAGE_SAVE_REALDIR . $filename; list($width, $height) = getimagesize($filename_realpath); $extension = pathinfo($filename_realpath, PATHINFO_EXTENSION); $pattern = "p%010d_%s_%04dx%04d.%s"; $rename = sprintf($pattern, $product_id, $key, $width, $height, $extension); $rename_realpath = IMAGE_SAVE_REALDIR . $rename; if (copy($filename_realpath, $rename_realpath)) { $arrRet[$key] = $rename; } } GC_Utils_Ex::gfPrintLog(print_r($arrRet, true), DEBUG_LOG_REALFILE); $arrRet = $objQuery->extractOnlyColsOf("dtb_products", $arrRet); GC_Utils_Ex::gfPrintLog(print_r($arrRet, true), DEBUG_LOG_REALFILE); if (count($arrRet) && $objProduct->isValidProductId($product_id, true)) { $objQuery->update("dtb_products", $arrRet, "product_id=?", array($product_id)); } if ($objDb->sfColumnExists("cp_dtb_product_characters", "product_id")) { $objQuery->delete("cp_dtb_product_characters", "product_id=?", array($product_id)); $character_ids = $arrList["character_id"]; if (!is_null($character_ids) && (is_array($character_ids) || is_numeric($character_ids))) { if (is_numeric($character_ids)) { $character_ids = array($character_ids); } $character_ids = array_unique($character_ids); foreach ($character_ids as $character_id) { $objQuery->insert("cp_dtb_product_characters", compact("product_id", "character_id")); } } } return $product_id; }
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"); } } }