function page_a($url, $page, $text) { $url_obj = new Net_URL($url); $url_obj->addQueryString('page', $page); $newurl = $url_obj->getURL(); return "<a href='{$newurl}'>{$text}</a>"; }
/** * 新着情報を取得する. * * @return array $arrNewsList 新着情報の配列を返す */ function lfGetNews(&$objQuery) { if (DB_TYPE != 'sqlsrv') { return parent::lfGetNews($objQuery); } else { $objQuery->setOrder('rank DESC '); $arrNewsList = $objQuery->select("* ,convert(varchar(4), YEAR(news_date)) + '-' + convert(varchar(2), MONTH(news_date)) + '-' + convert(varchar(10), DAY(news_date)) as news_date_disp", 'dtb_news', 'del_flg = 0'); // モバイルサイトのセッション保持 (#797) if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { foreach (array_keys($arrNewsList) as $key) { $arrRow =& $arrNewsList[$key]; if (SC_Utils_Ex::isAppInnerUrl($arrRow['news_url'])) { $netUrl = new Net_URL($arrRow['news_url']); $netUrl->addQueryString(session_name(), session_id()); $arrRow['news_url'] = $netUrl->getURL(); } } } return $arrNewsList; } }
function doLogin($mode, SC_Customer $objCustomer, SC_Query $objQuery) { $each = false; switch ($mode) { case "pay_cert_for_authory_sold": $each = true; break; default: $each = false; break; } $consumer = $this->getConsumer($objQuery); $netUrl = new Net_URL($_SERVER["SCRIPT_NAME"]); $netUrl->addQueryString("mode", $this->getMode()); $responce = $consumer->complete($netUrl->getURL()); $status = Auth_OpenID_FAILURE; if ($responce) { $status = $responce->status; } else { $responce = "null"; } GC_Utils_Ex::gfPrintLog(print_r(compact("consumer", "responce", "status"), true), DEBUG_LOG_REALFILE); switch ($status) { case Auth_OpenID_CANCEL: SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "処理を中断しました。"); break; default: case Auth_OpenID_FAILURE: $this->doLoginAuone($this->getMode()); $this->sendResponse(); SC_Response_Ex::actionExit(); break; case Auth_OpenID_SUCCESS: $openid = $responce->getDisplayIdentifier(); $customer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId(null, 'au_open_id=? AND status = 2 AND del_flg = 0', array($openid)); GC_Utils_Ex::gfPrintLog(print_r($customer, true), DEBUG_LOG_REALFILE); if (is_array($customer) && isset($customer["email"])) { $objCustomer->setLogin($customer["email"]); } else { GC_Utils_Ex::gfPrintLog(print_r(compact("responce", "status"), true), DEBUG_LOG_REALFILE); if ($each) { // 都度課金時 (ログインルートへ乗せる) SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "未登録または退会済みの会員です。<br/><a href='./login.php'>ログイン・会員登録<a>ボタンより会員登録をしてください。"); // ログインへとばすなら // SC_Response_Ex::sendRedirect ( "login.php" ); // SC_Response_Ex::actionExit (); } else { // 都度課金時以外 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "未登録または退会済みの会員です。"); } } break; } }
/** * 新着情報を取得する. * * @return array $arrNewsList 新着情報の配列を返す */ public function lfGetNews($dispNumber, $pageNo, SC_Helper_News_Ex $objNews) { $arrNewsList = $objNews->getList($dispNumber, $pageNo); // モバイルサイトのセッション保持 (#797) if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { foreach ($arrNewsList as $key => $value) { $arrRow =& $arrNewsList[$key]; if (SC_Utils_Ex::isAppInnerUrl($arrRow['news_url'])) { $netUrl = new Net_URL($arrRow['news_url']); $netUrl->addQueryString(session_name(), session_id()); $arrRow['news_url'] = $netUrl->getURL(); } } } return $arrNewsList; }
/** * 空メール管理テーブルからトークンが一致する行を削除し、 * 次に遷移させるページのURLを返す。 * * メールアドレスは $_SESSION['mobile']['kara_mail_from'] に登録される。 * * @param string $token トークン * @return string|false URLを返す。エラーが発生した場合はfalseを返す。 */ function gfFinishKaraMail($token) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $arrRow = $objQuery->getRow('session_id, next_url, email', 'dtb_mobile_kara_mail', 'token = ? AND email IS NOT NULL AND receive_date >= ?', array($token, date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME)), DB_FETCHMODE_ORDERED); if (!isset($arrRow)) { return false; } $objQuery->delete('dtb_mobile_kara_mail', 'token = ?', array($token)); list($session_id, $next_url, $email) = $arrRow; $objURL = new Net_URL(HTTP_URL . $next_url); $objURL->addQueryString(session_name(), $session_id); $url = $objURL->getURL(); session_id($session_id); session_start(); $_SESSION['mobile']['kara_mail_from'] = $email; session_write_close(); return $url; }
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../lib'); require_once 'init.php'; require_once 'data.php'; $C = new Context(DB_DSN, GUARDIAN_API_KEY, FLICKR_API_KEY, $_COOKIE['visitor']); $C->setCookie(); list($response_format, $response_mime_type) = parse_format($_GET['format'], 'html'); $woe_id = is_numeric($_GET['woe']) ? intval($_GET['woe']) : null; $woe_ids = isset($_GET['woes']) ? intvals($_GET['woes']) : null; $article_id = is_numeric($_GET['article']) ? intval($_GET['article']) : null; $article_ids = isset($_GET['articles']) ? intvals($_GET['articles']) : null; $count = is_numeric($_GET['count']) ? intval($_GET['count']) : null; $offset = is_numeric($_GET['offset']) ? intval($_GET['offset']) : 0; $js_callback = $response_mime_type == 'text/javascript' && $_GET['callback'] ? sanitize_js_callback($_GET['callback']) : null; if ($woe_id && $article_id) { $url = new Net_URL('http://' . get_domain_name() . get_base_dir() . '/point.php'); $url->addQueryString('article', $article_id); $url->addQueryString('woe', $woe_id); $url->addQueryString('format', $response_format); header('Location: ' . $url->getURL()); exit; } elseif (($article_ids || $woe_ids) && ($article_id || $woe_id)) { header('Content-Type: text/plain'); die_with_code(400, "It's not possible to specify both singular and plural article/WOE ID's.\n"); } else { $points = get_points($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids', 'count', 'offset')); $total = get_points_total($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids')); $count = count($points); } $C->close(); header("Content-Type: {$response_mime_type}; charset=UTF-8"); switch ($response_format) {
/** * Adds a querystring parameter * * @param string Querystring parameter name * @param string Querystring parameter value * @param bool Whether the value is already urlencoded or not, default = not * @access public */ function addQueryString($name, $value = '', $preencoded = false) { if (is_array($name)) { foreach ($name as $k => $v) { $this->addQueryString($k, $v, $preencoded); } return; } $this->_url->addQueryString($name, $value, $preencoded); }
/** * Adds a querystring parameter * * @param string Querystring parameter name * @param string Querystring parameter value * @param bool Whether the value is already urlencoded or not, default = not * @access public */ function addQueryString($name, $value, $preencoded = false) { $this->_url->addQueryString($name, $value, $preencoded); }
/** * * @static */ function wyswietlOstatniKomentarz() { $ostatniKomentarz = ZarzadcaKomentarzy::pobierzOstatniKomentarz(); $galeriaZdjec = ZarzadcaGaleriiZdjec::pobierzGalerie($ostatniKomentarz->katalog); $tytulGalerii = ""; if ($galeriaZdjec != null) { $tytulGalerii = $galeriaZdjec->tytulGalerii; } $podpis = $ostatniKomentarz->podpis; $tresc = $ostatniKomentarz->tresc; $ustawieniaGaleriiZdjec = new UstawieniaGaleriiZdjec(); $url = new Net_URL($ustawieniaGaleriiZdjec->linkDoGaleriiZdjec, false); $url->addQueryString("katalog", $ostatniKomentarz->katalog); $url->anchor = $ostatniKomentarz->nazwaPlikuZdjecia; if ($tresc != null && $tresc != "") { echo "<span class=\"ostatniKomentarz\"><a href=\"" . $url->getURL() . "\" title=\"$tytulGalerii\"><b>[$podpis]</b> $tresc</a></span>"; } }
/** * アプリケーション内でリダイレクトする * * 内部で生成する URL の searchpart は、下記の順で上書きしていく。(後勝ち) * 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING'] * 2. $location に含まれる searchpart * 3. 引数 $arrQueryString * * @param string $location * 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。 * @param array $arrQueryString * URL に付加する searchpart * @param bool $inheritQueryString * 現在のリクエストの searchpart を継承するか * @param bool|null $useSsl * true:HTTPSを強制, false:HTTPを強制, null:継承 * @return void * @static * */ public function sendRedirect($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null) { // ローカルフックポイント処理 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); if (is_object($objPlugin)) { $arrBacktrace = debug_backtrace(); if (is_object($arrBacktrace[0]['object'])) { $pattern = '/^[a-zA-Z0-9_]+$/'; if (isset($_REQUEST['mode']) && preg_match($pattern, $_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } $parent_class_name = get_parent_class($arrBacktrace[0]['object']); $class_name = get_class($arrBacktrace[0]['object']); } $objPlugin->doAction($parent_class_name . '_action_' . $mode, array($arrBacktrace[0]['object'])); if ($class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_' . $mode, array($this)); } } // url-path → URL 変換 if ($location[0] === '/') { $netUrl = new Net_URL($location); $url = $netUrl->getUrl(); } elseif (strpos($location, HTTPS_URL) === 0 || strpos($location, HTTP_URL) === 0) { $url = $location; } else { $netUrl = new Net_URL(HTTP_URL); $netUrl->path = dirname($_SERVER['SCRIPT_NAME']) . '/' . $location; $url = $netUrl->getUrl(); } if (!is_bool($useSsl)) { $useSsl = SC_Utils_Ex::sfIsHTTPS(); } if ($useSsl) { $url = str_replace(HTTP_URL, HTTPS_URL, $url); } else { $url = str_replace(HTTPS_URL, HTTP_URL, $url); } // アプリケーション外へのリダイレクトは扱わない if (!SC_Utils_Ex::isAppInnerUrl($url)) { trigger_error('URL IS APP NOT INNER URL', E_USER_ERROR); } $netUrl = new Net_URL($url); if ($inheritQueryString && !empty($_SERVER['QUERY_STRING'])) { $arrQueryStringBackup = $netUrl->querystring; // XXX メソッド名は add で始まるが、実際には置換を行う $netUrl->addRawQueryString($_SERVER['QUERY_STRING']); $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryStringBackup); } $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryString); $session = SC_SessionFactory_Ex::getInstance(); if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE || $session->useCookie() == false) { $netUrl->addQueryString(session_name(), session_id()); } if (GC_Utils_Ex::isAdminFunction()) { // 管理画面またはmode指定時は付与 $netUrl->addQueryString(TRANSACTION_ID_NAME, SC_Helper_Session_Ex::getToken()); } $url = $netUrl->getURL(); header("Location: {$url}"); exit; }
function doCheckBuyAndDownloadOk($config, $re_download = false) { $objCustomer = new SC_Customer_Ex(); $objQuery = SC_Query_Ex::getSingletonInstance(); if (empty($_REQUEST["product_ktc_vid"])) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); } $vid = $_REQUEST["product_ktc_vid"]; $curl = $this->curl_init(KISEKAE_TOUCH_API02); $post = $this->getPost($config, array("contentid" => $this->arrProduct["product_code_min"], "vid" => $vid)); $this->getDs($post, $config); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE); $result = curl_exec($curl); $status = SC_XML::xpath($result, "//status/@value"); switch ($status) { default: SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); break; case "000": case "010": break; } if ($status == "000") { // FIXME 課金処理 // API03 $curl = $this->curl_init(KISEKAE_TOUCH_API03); if ($objCustomer->getValue("buy_to_nopoint") == "1") { $price = $this->arrProduct["price02_min"]; $settlementtype = "998"; $redownloaddate = date("Ymd"); } elseif ($re_download) { $price = 0; $settlementtype = "900"; $redownloaddate = date("Ymd"); } else { $price = $this->arrProduct["price02_min"]; $settlementtype = "001"; $redownloaddate = date("Ymd", strtotime($this->downloadable_days2)); } $contentid = $this->arrProduct["product_code_min"]; $post = compact("contentid", "price", "redownloaddate", "vid", "settlementtype"); $post = $this->getPost($config, $post); $this->getDs($post, $config); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE); $result = curl_exec($curl); $authentication_id = SC_XML::xpath($result, "//authentication/@id"); $objFormParam = new SC_FormParam(); $this->setOrderParam($objFormParam, $vid, $authentication_id); $objFormParam->convParam(); $message = ''; $arrValBef = array(); $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->saveShippingTemp(array()); $order_id = $this->doRegister("", $objPurchase, $objFormParam, $message, $arrValBef); $customer_id = $objCustomer->getValue("customer_id"); $this->addPointHistory($order_id, $customer_id, $objFormParam, $objQuery); } else { $authentication_id = SC_XML::xpath($result, "//authentication/@id"); } $netUrl = new Net_URL(KISEKAE_TOUCH_CST02); $netUrl->addQueryString("aid", $authentication_id); $netUrl->addQueryString("cpid", $post["cpid"]); $netUrl->addQueryString("siteid", $post["siteid"]); $netUrl->addQueryString("contentid", $post["contentid"]); $netUrl->addQueryString("ts", $post["ts"]); $post2 = $netUrl->querystring; $this->getDs($post2, $config); $netUrl->addRawQueryString(http_build_query($post2)); header("Location: " . $netUrl->getURL()); }
/** * 新着情報を取得する. * * @return array $arrNewsList 新着情報の配列を返す */ public function lfGetNews($dispNumber, $pageNo, NewsHelper $objNews) { $arrNewsList = $objNews->getList($dispNumber, $pageNo); // モバイルサイトのセッション保持 (#797) if (Application::alias('eccube.display')->detectDevice() == DEVICE_TYPE_MOBILE) { foreach ($arrNewsList as $key => $value) { $arrRow =& $arrNewsList[$key]; if (Utils::isAppInnerUrl($arrRow['news_url'])) { $netUrl = new \Net_URL($arrRow['news_url']); $netUrl->addQueryString(session_name(), session_id()); $arrRow['news_url'] = $netUrl->getURL(); } } } return $arrNewsList; }
$redirect = preg_match('#^http://#', $_POST['redirect']) ? $_POST['redirect'] : null; $expiration = $_POST['expiration'] ? $_POST['expiration'] : null; $file = is_array($_FILES['file']) ? $_FILES['file'] : null; if (strtotime($expiration) < time()) { die_with_code(401, "Sorry, expiration date {$expiration} has come and gone - " . date('r', strtotime($expiration))); } if ($file['error'] > 0) { die_with_code(400, "Sorry, encountered error #{$file['error']} (see http://us.php.net/manual/en/features.file-upload.errors.php)"); } $posted_signature = $_POST['signature'] ? $_POST['signature'] : null; $expected_signature = sign_post_details($dirname, $expiration, API_PASSWORD); if ($posted_signature != $expected_signature) { die_with_code(401, 'Sorry, bad signature'); } if (is_array($file) && is_uploaded_file($file['tmp_name'])) { $object_id = rtrim($dirname, '/') . '/' . ltrim($file['name'], '/'); $content_bytes = file_get_contents($file['tmp_name']); $url = post_file_local($object_id, $content_bytes); } if ($redirect) { $redirect = new Net_URL($redirect); $redirect->addQueryString('url', $url); $redirect = $redirect->getURL(); } if ($redirect) { header("Location: {$redirect}"); } header('Content-Type: text/plain'); echo "Thanks, I think I handled your file, so thanks.\n"; echo "That's: {$file['name']}\n"; echo "Or? {$file['error']}\n";
/** * ページをリロードする. * * 引数 $queryString に, $_SERVER['QUERY_STRING'] の値を使用してはならない. * この関数は, 内部で LC_Page::sendRedirect() を使用するため, * $_SERVER['QUERY_STRING'] の値は自動的に付与される. * * @param array $queryString QueryString の配列 * @param bool $removeQueryString 付与されていた QueryString を削除する場合 true * @return void * @see Net_URL */ function reload($queryString = array(), $removeQueryString = false) { // 現在の URL を取得 $netURL = new Net_URL(); if ($removeQueryString) { $netURL->querystring = array(); $_SERVER['QUERY_STRING'] = ''; } // QueryString を付与 if (!empty($queryString)) { foreach ($queryString as $key => $val) { $netURL->addQueryString($key, $val); } } $this->sendRedirect($netURL->getURL()); }
echo "<th>Opis</th>"; } if ($ustawieniaGaleriiZdjec->obslugaPolaGaleriaZdjecNowa) { echo "<th>Nowa</th>"; } if ($ustawieniaGaleriiZdjec->obslugaPolaGaleriaZdjecPrawieNowa) { echo "<th>Prawie nowa</th>"; } echo "<th>Akcja</th>"; echo "<tr>\n"; $edytujUrl = new Net_URL($_SERVER['REQUEST_URI'], false); $usunUrl = new Net_URL($_SERVER['REQUEST_URI'], false); $dodajUrl = new Net_URL($_SERVER['REQUEST_URI'], false); $dodajUrl->addQueryString("dodaj", "1"); $dodajLink = $dodajUrl->getURL(); foreach ($galerie as $galeriaZdjec) { $edytujUrl->addQueryString("edytuj", $galeriaZdjec->katalog); $edytujLink = $edytujUrl->getURL(); $usunUrl->addQueryString("usun", $galeriaZdjec->katalog); $usunLink = $usunUrl->getURL(); echo "<tr>"; echo "<td>" . $galeriaZdjec->katalog . "</td>"; echo "<td>" . $galeriaZdjec->data . "</td>"; echo "<td>" . $galeriaZdjec->tytulGalerii . "</td>"; if ($ustawieniaGaleriiZdjec->obslugaPolaGaleriaZdjecOpis) { echo "<td>" . $galeriaZdjec->opisGalerii . "</td>";
/** * アプリケーション内でリダイレクトする * * 内部で生成する URL の searchpart は、下記の順で上書きしていく。(後勝ち) * 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING'] * 2. $location に含まれる searchpart * 3. 引数 $arrQueryString * @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。 * @param array $arrQueryString URL に付加する searchpart * @param bool $inheritQueryString 現在のリクエストの searchpart を継承するか * @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承 * @return void * @static */ function sendRedirect($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null) { // url-path → URL 変換 if ($location[0] === '/') { $netUrl = new Net_URL($location); $location = $netUrl->getUrl(); } // URL の場合 if (preg_match('/^https?:/', $location)) { $url = $location; if (is_bool($useSsl)) { if ($useSsl) { $pattern = '/^' . preg_quote(HTTP_URL, '/') . '(.*)/'; $replacement = HTTPS_URL . '\\1'; $url = preg_replace($pattern, $replacement, $url); } else { $pattern = '/^' . preg_quote(HTTPS_URL, '/') . '(.*)/'; $replacement = HTTP_URL . '\\1'; $url = preg_replace($pattern, $replacement, $url); } } } else { if (!is_bool($useSsl)) { $useSsl = SC_Utils_Ex::sfIsHTTPS(); } $netUrl = new Net_URL($useSsl ? HTTPS_URL : HTTP_URL); $netUrl->path = dirname($_SERVER['PHP_SELF']) . '/' . $location; $url = $netUrl->getUrl(); } $pattern = '/^(' . preg_quote(HTTP_URL, '/') . '|' . preg_quote(HTTPS_URL, '/') . ')/'; // アプリケーション外へのリダイレクトは扱わない if (preg_match($pattern, $url) === 0) { SC_Utils_Ex::sfDispException(); } $netUrl = new Net_URL($url); if ($inheritQueryString && !empty($_SERVER['QUERY_STRING'])) { $arrQueryStringBackup = $netUrl->querystring; // XXX メソッド名は add で始まるが、実際には置換を行う $netUrl->addRawQueryString($_SERVER['QUERY_STRING']); $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryStringBackup); } $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryString); $session = SC_SessionFactory::getInstance(); if (SC_MobileUserAgent_Ex::isMobile() || $session->useCookie() == false) { $netUrl->addQueryString(session_name(), session_id()); } $netUrl->addQueryString(TRANSACTION_ID_NAME, SC_Helper_Session_Ex::getToken()); $url = $netUrl->getURL(); header("Location: {$url}"); exit; }
/** * $path から URL を取得する. * * 以下の順序で 引数 $path から URL を取得する. * 1. realpath($path) で $path の 絶対パスを取得 * 2. $_SERVER['DOCUMENT_ROOT'] と一致する文字列を削除 * 3. $useSSL の値に応じて, HTTP_URL 又は, HTTPS_URL を付与する. * * 返り値に, QUERY_STRING を含めたい場合は, key => value 形式 * の配列を $param へ渡す. * * @access protected * @param string $path 結果を取得するためのパス * @param array $param URL に付与するパラメーターの配列 * @param mixed $useSSL 結果に HTTPS_URL を使用する場合 true, * HTTP_URL を使用する場合 false, * デフォルト 'escape' 現在のスキーマを使用 * @return string $path の存在する http(s):// から始まる絶対パス * @see Net_URL */ function getLocation($path, $param = array(), $useSSL = 'escape') { $rootPath = $this->getRootPath($path); // スキーマを定義 if ($useSSL === true) { $url = HTTPS_URL . $rootPath; } elseif ($useSSL === false) { $url = HTTP_URL . $rootPath; } elseif ($useSSL == 'escape') { if (SC_Utils_Ex::sfIsHTTPS()) { $url = HTTPS_URL . $rootPath; } else { $url = HTTP_URL . $rootPath; } } else { die("[BUG] Illegal Parametor of \$useSSL "); } $netURL = new Net_URL($url); // QUERY_STRING 生成 foreach ($param as $key => $val) { $netURL->addQueryString($key, $val); } return $netURL->getURL(); }
function doCheckBuyAndDownload($config) { $objFormParam = new SC_FormParam(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_REQUEST); $objCustomer = new SC_Customer_Ex(); $objQuery = SC_Query::getSingletonInstance(); $detect = new Mobile_Detect(); $version = $detect->version("iOS", Mobile_Detect::VERSION_TYPE_FLOAT); $contentid = $this->arrProduct["product_code_min"]; $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API01); $post = $this->getPost($config, array("contentid" => $contentid, "device" => $objFormParam->getValue("device_name", "iPhone6"), "version" => floor($version), "apiversion" => null, "operator" => "au", "lang" => "ja")); $this->getDs($post, $config); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE); $result = curl_exec($curl); $status = SC_XML::xpath($result, "//status/@value"); $vid = SC_XML::xpath($result, "//validation/@id"); switch ($status) { default: SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); case "000": GC_Utils_Ex::gfDebugLog($result); $_COOKIE["product_ktc_vid"] = $vid; break; } // API2 $openid = $objCustomer->getValue("au_open_id"); $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API02); $post = $this->getPost($config, array("contentid" => $contentid, "userid" => $openid, "vid" => $vid)); $this->getDs($post, $config); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE); $result = curl_exec($curl); $status = SC_XML::xpath($result, "//status/@value"); switch ($status) { default: SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); break; case "000": case "010": // TEST // /ios/products/detail.php?mode=check_buy_and_download&product_id=13&classcategory_id1=0&classcategory_id2=0&quantity=1&admin=&favorite_product_id=&product_class_id=&device_name=iPhone6Plus&device_height=736&device_width=414&device_rate=3&device_lang=ja&ignore_redownload=1 if ($_GET["ignore_redownload"] == "1") { $status = "000"; } break; } if ($status == "000") { // FIXME 課金処理 // API03 $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API03); if ($objCustomer->getValue("buy_to_nopoint") == "1") { $price = $this->arrProduct["price02_min"]; $settlementtype = "998"; $redownloaddate = date("Ymd"); } else { $price = $this->arrProduct["price02_min"]; $settlementtype = "001"; $redownloaddate = date("Ymd", strtotime($this->downloadable_days2)); } $post = $this->getPost($config, array("contentid" => $contentid, "price" => $price, "redownloaddate" => $redownloaddate, "userid" => $openid, "vid" => $vid, "settlementtype" => $settlementtype)); $this->getDs($post, $config); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE); $result = curl_exec($curl); $authentication_id = SC_XML::xpath($result, "//authentication/@id"); $objFormParam = new SC_FormParam(); $this->setOrderParam($objFormParam, $vid, $authentication_id); $objFormParam->convParam(); $message = ''; $arrValBef = array(); $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->saveShippingTemp(array()); $order_id = $this->doRegister("", $objPurchase, $objFormParam, $message, $arrValBef); $customer_id = $objCustomer->getValue("customer_id"); $this->addPointHistory($order_id, $customer_id, $objFormParam, $objQuery); } else { $authentication_id = SC_XML::xpath($result, "//authentication/@id"); } $netUrl = new Net_URL(KISEKAE_TOUCH_IPHONE_CST02); $netUrl->addQueryString("aid", $authentication_id); $netUrl->addQueryString("cpid", $config["cpid"]); $netUrl->addQueryString("siteid", $config["siteid"]); $netUrl->addQueryString("contentid", $contentid); $netUrl->addQueryString("ts", date("YmdHis")); $post2 = $netUrl->querystring; $this->getDs($post2, $config); $netUrl->addRawQueryString(http_build_query($post2)); GC_Utils_Ex::gfPrintLog(print_r($post2, TRUE), DEBUG_LOG_REALFILE); header("Location: " . $netUrl->getURL()); }
/** * 新着情報を取得する. * * @return array $arrNewsList 新着情報の配列を返す */ function lfGetNews(&$objQuery) { $objQuery->setOrder('rank DESC '); $arrNewsList = $objQuery->select('* , cast(news_date as date) as news_date_disp', 'dtb_news', 'del_flg = 0'); // モバイルサイトのセッション保持 (#797) if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { foreach ($arrNewsList as $key => $value) { $arrRow =& $arrNewsList[$key]; if (SC_Utils_Ex::isAppInnerUrl($arrRow['news_url'])) { $netUrl = new Net_URL($arrRow['news_url']); $netUrl->addQueryString(session_name(), session_id()); $arrRow['news_url'] = $netUrl->getURL(); } } } return $arrNewsList; }
/** * アプリケーション内でリダイレクトする * * 内部で生成する URL の searchpart は、下記の順で上書きしていく。(後勝ち) * 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING'] * 2. $location に含まれる searchpart * 3. 引数 $arrQueryString * @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。 * @param array $arrQueryString URL に付加する searchpart * @param bool $inheritQueryString 現在のリクエストの searchpart を継承するか * @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承 * @return void * @static */ function sendRedirect($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null) { // ローカルフックポイント処理 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); $arrBacktrace = debug_backtrace(); if (is_object($arrBacktrace[0]['object']) && method_exists($arrBacktrace[0]['object'], 'getMode')) { $parent_class_name = get_parent_class($arrBacktrace[0]['object']); $objPlugin->doAction($parent_class_name . '_action_' . $arrBacktrace[0]['object']->getMode(), array($arrBacktrace[0]['object'])); $class_name = get_class($arrBacktrace[0]['object']); if ($class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_' . $arrBacktrace[0]['object']->getMode(), array($this)); } } elseif (is_object($arrBacktrace[0]['object'])) { $pattern = '/^[a-zA-Z0-9_]+$/'; $mode = null; if (isset($_GET['mode']) && preg_match($pattern, $_GET['mode'])) { $mode = $_GET['mode']; } elseif (isset($_POST['mode']) && preg_match($pattern, $_POST['mode'])) { $mode = $_POST['mode']; } $parent_class_name = get_parent_class($arrBacktrace[0]['object']); $objPlugin->doAction($parent_class_name . '_action_' . $mode, array($arrBacktrace[0]['object'])); $class_name = get_class($arrBacktrace[0]['object']); if ($class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_' . $mode, array($this)); } } // url-path → URL 変換 if ($location[0] === '/') { $netUrl = new Net_URL($location); $location = $netUrl->getUrl(); } // URL の場合 if (preg_match('/^https?:/', $location)) { $url = $location; if (is_bool($useSsl)) { if ($useSsl) { $pattern = '/^' . preg_quote(HTTP_URL, '/') . '(.*)/'; $replacement = HTTPS_URL . '\\1'; $url = preg_replace($pattern, $replacement, $url); } else { $pattern = '/^' . preg_quote(HTTPS_URL, '/') . '(.*)/'; $replacement = HTTP_URL . '\\1'; $url = preg_replace($pattern, $replacement, $url); } } } else { if (!is_bool($useSsl)) { $useSsl = SC_Utils_Ex::sfIsHTTPS(); } $netUrl = new Net_URL($useSsl ? HTTPS_URL : HTTP_URL); $netUrl->path = dirname($_SERVER['SCRIPT_NAME']) . '/' . $location; $url = $netUrl->getUrl(); } $pattern = '/^(' . preg_quote(HTTP_URL, '/') . '|' . preg_quote(HTTPS_URL, '/') . ')/'; // アプリケーション外へのリダイレクトは扱わない if (preg_match($pattern, $url) === 0) { trigger_error('', E_USER_ERROR); } $netUrl = new Net_URL($url); if ($inheritQueryString && !empty($_SERVER['QUERY_STRING'])) { $arrQueryStringBackup = $netUrl->querystring; // XXX メソッド名は add で始まるが、実際には置換を行う $netUrl->addRawQueryString($_SERVER['QUERY_STRING']); $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryStringBackup); } $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryString); $session = SC_SessionFactory_Ex::getInstance(); if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE || $session->useCookie() == false) { $netUrl->addQueryString(session_name(), session_id()); } $netUrl->addQueryString(TRANSACTION_ID_NAME, SC_Helper_Session_Ex::getToken()); $url = $netUrl->getURL(); header("Location: {$url}"); exit; }
/** * Page のプロセス(モバイル). * * FIXME スパゲッティ... * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $conn = new SC_DBConn(); $objDb = new SC_Helper_DB_Ex(); //表示件数の選択 if (isset($_REQUEST['disp_number']) && SC_Utils_Ex::sfIsInt($_REQUEST['disp_number'])) { $this->disp_number = $_REQUEST['disp_number']; } else { //最小表示件数を選択 $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX)); } //表示順序の保存 $this->orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : ""; // GETのカテゴリIDを元に正しいカテゴリIDを取得する。 $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']); // タイトル編集 $tpl_subtitle = ""; $tpl_search_mode = false; if (!isset($_GET['mode'])) { $_GET['mode'] = ""; } if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if (!isset($_GET['name'])) { $_GET['name'] = ""; } if (!isset($_REQUEST['orderby'])) { $_REQUEST['orderby'] = ""; } if (empty($arrCategory_id)) { $arrCategory_id = array("0"); } if ($_GET['mode'] == 'search') { $tpl_subtitle = "検索結果"; $tpl_search_mode = true; } elseif (empty($arrCategory_id)) { $tpl_subtitle = "全商品"; } else { $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]); $tpl_subtitle = $arrFirstCat['name']; } $objQuery = new SC_Query(); $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id); // 以下の条件でBEST商品を表示する // ・BEST最大数の商品が登録されている。 // ・カテゴリIDがルートIDである。 // ・検索モードでない。 if ($count >= BEST_MIN && $this->lfIsRootCategory($arrCategory_id[0]) && $_GET['mode'] != 'search') { // 商品TOPの表示処理 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]); $this->BEST_ROOP_MAX = ceil((BEST_MAX - 1) / 2); } else { if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0) { // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す $arrCategory_id = array(""); } // 商品一覧の表示処理 $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_REQUEST['orderby']); // 検索条件を画面に表示 // カテゴリー検索条件 if (strlen($_GET['category_id']) == 0) { $arrSearch['category'] = "指定なし"; } else { $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($category_id)); $arrSearch['category'] = $arrCat; } // 商品名検索条件 if ($_GET['name'] === "") { $arrSearch['name'] = "指定なし"; } else { $arrSearch['name'] = $_GET['name']; } } if ($_POST['mode'] == "cart" && $_POST['product_id'] != "") { // 値の正当性チェック if (!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !SC_Utils_Ex::sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true); } else { // 入力値の変換 $this->arrErr = $this->lfCheckError($_POST['product_id']); if (count($this->arrErr) == 0) { $objCartSess = new SC_CartSession(); $classcategory_id = "classcategory_id" . $_POST['product_id']; $classcategory_id1 = $_POST[$classcategory_id . '_1']; $classcategory_id2 = $_POST[$classcategory_id . '_2']; $quantity = "quantity" . $_POST['product_id']; // 規格1が設定されていない場合 if (!$this->tpl_classcat_find1[$_POST['product_id']]) { $classcategory_id1 = '0'; } // 規格2が設定されていない場合 if (!$this->tpl_classcat_find2[$_POST['product_id']]) { $classcategory_id2 = '0'; } $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); $this->sendRedirect(MOBILE_URL_CART_TOP, array(session_name() => session_id())); exit; } } } // ページ送り機能用のURLを作成する。 $objURL = new Net_URL($_SERVER['PHP_SELF']); foreach ($_REQUEST as $key => $value) { if ($key == session_name() || $key == 'pageno') { continue; } $objURL->addQueryString($key, mb_convert_encoding($value, 'SJIS', CHAR_CODE)); } if ($this->objNavi->now_page > 1) { $objURL->addQueryString('pageno', $this->objNavi->now_page - 1); $this->tpl_previous_page = $objURL->path . '?' . $objURL->getQueryString(); } if ($this->objNavi->now_page < $this->objNavi->max_page) { $objURL->addQueryString('pageno', $this->objNavi->now_page + 1); $this->tpl_next_page = $objURL->path . '?' . $objURL->getQueryString(); } $this->tpl_subtitle = $tpl_subtitle; $this->tpl_search_mode = $tpl_search_mode; // 支払方法の取得 $this->arrPayment = $this->lfGetPayment(); // 入力情報を渡す $this->arrForm = $_POST; $this->category_id = $arrCategory_id[0]; $this->arrSearch = $arrSearch; $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl"; $objView->assignobj($this); $objView->display(SITE_FRAME); }