コード例 #1
0
ファイル: pager_functions.php プロジェクト: nsahoo/cmssw-1
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>";
}
コード例 #2
0
 function analyze()
 {
     /* Find out the fully-qualified URL of test_feed.html */
     $target = new Net_URL('test_feed.html');
     $url = $target->getURL();
     /* Static values */
     $this->channel = new HTMLToFeed_Channel();
     $this->channel->title = 'Sample RSS feed';
     $this->channel->link = $url;
     $this->channel->description = 'This is a sample RSS feed created from a bogus HTML.';
     $this->channel->language = 'ja';
     try {
         $xml = $this->getXmlObject($url);
     } catch (Exception $e) {
         exit($e->getMessage());
     }
     /* Retrieve and parse LI elements */
     if ($li_elements = $xml->body->ul->li) {
         $this->convertPath($li_elements, array('a' => 'href'));
         foreach ($li_elements as $li) {
             $item = new HTMLToFeed_Item();
             $item->title = (string) $li->a;
             $item->link = $item->guid = (string) $li->a['href'];
             if (preg_match('|(\\d{4})/(\\d{1,2})/(\\d{1,2})|s', $item->title, $matches)) {
                 $item->pubDate = strtotime("{$matches['1']}-{$matches['2']}-{$matches['3']}");
             }
             $this->channel->items[] = $item;
         }
     }
     $this->sortMultiArray($this->channel->items, 'pubDate');
 }
コード例 #3
0
ファイル: SC_Utils.php プロジェクト: casan/eccube-2_13
 /**
  * インストーラーの URL を返す
  *
  * @return string インストーラーの URL
  */
 public static function getInstallerPath()
 {
     $netUrl = new Net_URL();
     $installer = 'install/' . DIR_INDEX_PATH;
     // XXX メソッド名は add で始まるが、実際には置換を行う
     $netUrl->addRawQueryString('');
     $current_url = $netUrl->getURL();
     $current_url = dirname($current_url) . '/';
     // XXX 先頭の / を含まない。
     $urlpath = substr($_SERVER['SCRIPT_FILENAME'], strlen(HTML_REALDIR));
     // / を 0、/foo/ を 1 としたディレクトリー階層数
     $dir_level = substr_count($urlpath, '/');
     $installer_url .= str_repeat('../', $dir_level) . $installer;
     return $installer_url;
 }
コード例 #4
0
 function setReturnTo($key, $mode)
 {
     if (SC_Utils_Ex::isAppInnerUrl($_SERVER["HTTP_REFERER"])) {
         $netUrl = new Net_URL($_SERVER["HTTP_REFERER"]);
         $dir = basename(dirname($netUrl->path));
         $file = basename($netUrl->path);
         if (preg_match("{.*(confirm|complete).php}", $file)) {
             GC_Utils_Ex::gfPrintLog($file);
             return;
         }
         switch ($dir) {
             case "au":
             case "docomo":
             case "softbank":
                 break;
             default:
                 $_SESSION[$key] = $netUrl->getURL();
                 break;
         }
     }
 }
 /**
  * 新着情報を取得する.
  *
  * @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;
     }
 }
コード例 #6
0
ファイル: LC_Page.php プロジェクト: khrisna/eccubedrm
 /**
  * ページをリロードする.
  *
  * 引数 $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());
 }
コード例 #7
0
 /**
  *
  * @param  SC_Product_Ex $objProduct
  * @param SC_FormParam_Ex $objFormParam
  * @return void
  */
 public function doDefault(&$objProduct, &$objFormParam)
 {
     //商品一覧の表示処理
     $strnavi = $this->objNavi->strnavi;
     // 表示文字列
     $this->tpl_strnavi = empty($strnavi) ? '&nbsp;' : $strnavi;
     // 規格1クラス名
     $this->tpl_class_name1 = $objProduct->className1;
     // 規格2クラス名
     $this->tpl_class_name2 = $objProduct->className2;
     // 規格1
     $this->arrClassCat1 = $objProduct->classCats1;
     // 規格1が設定されている
     $this->tpl_classcat_find1 = $objProduct->classCat1_find;
     // 規格2が設定されている
     $this->tpl_classcat_find2 = $objProduct->classCat2_find;
     $this->tpl_stock_find = $objProduct->stock_find;
     $this->tpl_product_class_id = $objProduct->product_class_id;
     $this->tpl_product_type = $objProduct->product_type;
     // 商品ステータスを取得
     $this->productStatus = $this->arrProducts['productStatus'];
     unset($this->arrProducts['productStatus']);
     $this->tpl_javascript .= 'eccube.productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_PC) {
         //onloadスクリプトを設定. 在庫ありの商品のみ出力する
         foreach ($this->arrProducts as $arrProduct) {
             if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) {
                 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";
             }
         }
     }
     //カート処理
     $target_product_id = intval($this->arrForm['product_id']);
     if ($target_product_id > 0) {
         // 商品IDの正当性チェック
         if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', $this->arrForm['product_id'], 'del_flg = 0 AND status = 1')) {
             SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
         }
         // 入力内容のチェック
         $arrErr = $this->lfCheckError($objFormParam);
         if (empty($arrErr)) {
             $this->lfAddCart($this->arrForm);
             // 開いているカテゴリーツリーを維持するためのパラメーター
             $arrQueryString = array('category_id' => $this->arrForm['category_id']);
             SC_Response_Ex::sendRedirect(CART_URL, $arrQueryString);
             SC_Response_Ex::actionExit();
         }
         $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id);
     } else {
         // カート「戻るボタン」用に保持
         $netURL = new Net_URL();
         //該当メソッドが無いため、$_SESSIONに直接セット
         $_SESSION['cart_referer_url'] = $netURL->getURL();
     }
     $this->tpl_javascript .= 'function fnOnLoad() {' . $js_fnOnLoad . '}';
     $this->tpl_onload .= 'fnOnLoad(); ';
 }
コード例 #8
0
 /**
  * 新着情報を取得する.
  *
  * @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;
 }
コード例 #9
0
 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());
 }
コード例 #10
0
 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());
 }
コード例 #11
0
	}
	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>";
		}
コード例 #12
0
 /**
  * Instantiate a new MP3_Playlist object.
  *
  * Expects a reading directory, the output directory where the playlist will
  * be saved and the directory or URL to be used within the playlist.
  *
  * @param   string $dir     The directory to scan
  * @param   string $outdir  The directory where to save the playlist file
  * @param   string $baseurl The base url to append on the playlist file
  * @param   bool   $debug   (optional) Whether print debug message or not, default FALSE
  *
  * @return  TRUE|PEAR_Error
  * @see     MP3_Playlist::fixPath()
  */
 public function __construct($dir, $outdir, $baseurl, $debug = false)
 {
     // Taking the values from the constructor and assigning it to the
     // private variables
     $this->parseDirectory = self::fixPath($dir);
     $this->outputDirectory = self::fixPath($outdir);
     // Fix the URL if needed.
     if (substr($baseurl, -1) != '/') {
         $baseurl .= '/';
     }
     $url = new Net_URL($baseurl);
     if (!empty($url->path)) {
         $dirs = explode('/', $url->path);
         foreach ($dirs as $key => $value) {
             if (!empty($value)) {
                 $dirs[$key] = rawurlencode($value);
             }
         }
         $url->path = Net_URL::resolvePath(implode('/', $dirs));
     }
     $this->baseUrl = $url->getURL();
     $this->list = array();
     // Instantiate the new MP3_If object
     $this->mp3 = new MP3_Id();
     $this->debug = $debug;
     $this->parse();
 }
	/**
	 *
	 * @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>";
		}
	}
コード例 #14
0
 /**
  *
  * @static
  *
  */
 public function reloadSSL($arrQueryString = array(), $removeQueryString = false)
 {
     // 現在の URL を取得
     $netUrl = new Net_URL(GC_Utils_Ex::getUrl());
     if (!$removeQueryString) {
         $arrQueryString = array_merge($netUrl->querystring, $arrQueryString);
     }
     $netUrl->querystring = array();
     SC_Response_Ex::sendRedirect($netUrl->getURL(), $arrQueryString, false, true);
 }
コード例 #15
0
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     $this->arrForm = $_REQUEST;
     //時間が無いのでコレで勘弁してください。 tao_s
     //modeの取得
     $this->mode = $this->getMode();
     //表示条件の取得
     $this->arrSearchData = array('category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])), 'maker_id' => intval($this->arrForm['maker_id']), 'name' => $this->arrForm['name']);
     $this->orderby = $this->arrForm['orderby'];
     //ページング設定
     $this->tpl_pageno = $this->arrForm['pageno'];
     $this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
     // 画面に表示するサブタイトルの設定
     $this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['category_id']);
     // 画面に表示する検索条件を設定
     $this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
     // 商品一覧データの取得
     $arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
     $this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
     $urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
     $this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
     $this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct);
     switch ($this->getMode()) {
         case "json":
             $this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE);
             $this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts);
             // 一覧メイン画像の指定が無い商品のための処理
             foreach ($this->arrProducts as $key => $val) {
                 $this->arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);
             }
             echo SC_Utils_Ex::jsonEncode($this->arrProducts);
             exit;
             break;
         default:
             //商品一覧の表示処理
             $strnavi = $this->objNavi->strnavi;
             // 表示文字列
             $this->tpl_strnavi = empty($strnavi) ? "&nbsp;" : $strnavi;
             // 規格1クラス名
             $this->tpl_class_name1 = $objProduct->className1;
             // 規格2クラス名
             $this->tpl_class_name2 = $objProduct->className2;
             // 規格1
             $this->arrClassCat1 = $objProduct->classCats1;
             // 規格1が設定されている
             $this->tpl_classcat_find1 = $objProduct->classCat1_find;
             // 規格2が設定されている
             $this->tpl_classcat_find2 = $objProduct->classCat2_find;
             $this->tpl_stock_find = $objProduct->stock_find;
             $this->tpl_product_class_id = $objProduct->product_class_id;
             $this->tpl_product_type = $objProduct->product_type;
             // 商品ステータスを取得
             $this->productStatus = $this->arrProducts['productStatus'];
             unset($this->arrProducts['productStatus']);
             $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
             //onloadスクリプトを設定. 在庫ありの商品のみ出力する
             foreach ($this->arrProducts as $arrProduct) {
                 if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) {
                     $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";
                 }
             }
             //カート処理
             $target_product_id = intval($this->arrForm['product_id']);
             if ($target_product_id > 0) {
                 // 商品IDの正当性チェック
                 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !SC_Helper_DB_Ex::sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) {
                     SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
                 }
                 // 入力内容のチェック
                 $arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 if (empty($arrErr)) {
                     $this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']);
                     SC_Response_Ex::sendRedirect(CART_URLPATH);
                     exit;
                 }
                 $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id);
             } else {
                 // カート「戻るボタン」用に保持
                 $netURL = new Net_URL();
                 //該当メソッドが無いため、$_SESSIONに直接セット
                 $_SESSION['cart_referer_url'] = $netURL->getURL();
             }
             $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
             $this->tpl_onload .= 'fnOnLoad(); ';
             break;
     }
     $this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
 }
 /**
  * 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));
     }
 }
コード例 #17
0
ファイル: Pingback.php プロジェクト: Dulciane/jaws
 /**
  * Send a Pingback header to tell this is a pingback-enable resource.
  *
  * @param string $pingbackURI (optional) Pingback URI, if not given URI is
  *                                       the current URI.
  *
  * @return bool|PEAR_Error TRUE on success or PEAR_Error on failure.
  * @access public
  * @static
  */
 function sendPingbackHeader($pingbackURI = null)
 {
     if (headers_sent()) {
         return PEAR::raiseError('Header already sent, cannot sent Pingback header');
     }
     if ($pingbackURI === null) {
         $url = new Net_URL($url);
         $pingbackURI = $url->getURL();
     }
     header('X-Pingback: ' . $pingbackURI);
     return true;
 }
コード例 #18
0
 /**
  * $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();
 }
コード例 #19
0
 /**
  * 
  * 
  * @return void 
  */
 function doDefault()
 {
     // カート「戻るボタン」用に保持
     $netURL = new Net_URL();
     $_SESSION['cart_referer_url'] = $netURL->getURL();
 }
コード例 #20
0
 /**
  * 新着情報を取得する.
  *
  * @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;
 }
コード例 #21
0
ファイル: points.php プロジェクト: RandomEtc/apimaps
$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) {
    case 'php':
        print serialize(compact('count', 'offset', 'total', 'points'));
        break;
コード例 #22
0
 /**
  * 空メール管理テーブルからトークンが一致する行を削除し、
  * 次に遷移させるページの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;
 }
コード例 #23
0
 /**
  * @static
  */
 function reload($arrQueryString = array(), $removeQueryString = false)
 {
     // 現在の URL を取得
     $netUrl = new Net_URL($_SERVER['REQUEST_URI']);
     if (!$removeQueryString) {
         $arrQueryString = array_merge($netUrl->querystring, $arrQueryString);
     }
     $netUrl->querystring = array();
     SC_Response_Ex::sendRedirect($netUrl->getURL(), $arrQueryString);
 }
コード例 #24
0
ファイル: News.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * 新着情報を取得する.
  *
  * @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;
 }