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');
 }
Ejemplo n.º 2
0
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>";
}
Ejemplo n.º 3
0
 /**
  * Page のレスポンス送信.
  *
  * @return void
  */
 public function sendResponse()
 {
     // ループ防止に現在URLを格納
     $location = '';
     $netUrl = new Net_URL();
     $location = $netUrl->getUrl();
     // ログインされていなく、リダイレクト処理
     if (empty($this->isLogin) && !preg_match('/^.*original.*/', $location)) {
         $this->objDisplay->response->sendRedirect('original');
     }
     $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
     // ローカルフックポイントを実行.
     $this->doLocalHookpointAfter($objPlugin);
     // HeadNaviにpluginテンプレートを追加する.
     $objPlugin->setHeadNaviBlocs($this->arrPageLayout['HeadNavi']);
     // スーパーフックポイントを実行.
     $objPlugin->doAction('LC_Page_process', array($this));
     // ページクラス名をテンプレートに渡す
     $arrBacktrace = debug_backtrace();
     if (strlen($this->tpl_page_class_name) === 0) {
         $this->tpl_page_class_name = preg_replace('/_Ex$/', '', $arrBacktrace[1]['class']);
     }
     $this->objDisplay->prepare($this);
     $this->objDisplay->addHeader('Vary', 'User-Agent');
     $this->objDisplay->response->write();
 }
Ejemplo n.º 4
0
 /**
  * インストーラーの 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;
 }
 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;
     }
 }
Ejemplo n.º 7
0
 function convertPath($in_to, $path)
 {
     // it's a // url (eg. use https if already in https mode...)
     if (preg_match('#^//#', $path)) {
         return $path;
     }
     //print_r(array($this->baseURL, $in_to, $path ));
     require_once 'Net/URL.php';
     $a = new Net_URL();
     $path = $a->resolvePath($this->baseURL . '/' . $path);
     // not sure if that's a good idea..
     $to = rtrim($a->resolvePath($in_to), '/');
     //print_r(array($path,$to));
     $path1 = $path ? explode('/', $path) : array();
     $path2 = $to ? explode('/', $to) : array();
     $shared = array();
     // compare paths & strip identical ancestors
     foreach ($path1 as $i => $chunk) {
         if (isset($path2[$i]) && $path1[$i] == $path2[$i]) {
             $shared[] = $chunk;
         } else {
             break;
         }
     }
     $shared = implode('/', $shared);
     //print_r(array($shared));
     $path = mb_substr($path, mb_strlen($shared));
     $to = mb_substr($to, mb_strlen($shared));
     $to = str_repeat('../', mb_substr_count($to, '/'));
     $ret = $to . ltrim($path, '/');
     //print_r(array($ret));
     return $ret;
 }
 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());
 }
Ejemplo n.º 9
0
    /**
    * Builds the request string
    *
    * @access private
    * @return string The request string
    */
    function _buildRequest()
    {
        $separator = ini_get('arg_separator.output');
        ini_set('arg_separator.output', '&');
        $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';
        ini_set('arg_separator.output', $separator);

        $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';
        $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';
        $path = $this->_url->path . $querystring;
        $url  = $host . $port . $path;

        if (!strlen($url)) {
            $url = '/';
        }

        $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";

        if (in_array($this->_method, $this->_bodyDisallowed) ||
            (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
             (empty($this->_postData) && empty($this->_postFiles)))))
        {
            $this->removeHeader('Content-Type');
        } else {
            if (empty($this->_requestHeaders['content-type'])) {
                // Add default content-type
                $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
            } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {
                $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());
                $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);
            }
        }

        // Request Headers
        if (!empty($this->_requestHeaders)) {
            foreach ($this->_requestHeaders as $name => $value) {
                $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
                $request      .= $canonicalName . ': ' . $value . "\r\n";
            }
        }

        // No post data or wrong method, so simply add a final CRLF
        if (in_array($this->_method, $this->_bodyDisallowed) || 
            (HTTP_REQUEST_METHOD_POST != $this->_method && 0 == strlen($this->_body))) {

            $request .= "\r\n";

        // Post data if it's an array
        } elseif (HTTP_REQUEST_METHOD_POST == $this->_method && 
                  (!empty($this->_postData) || !empty($this->_postFiles))) {

            // "normal" POST request
            if (!isset($boundary)) {
                $postdata = implode('&', array_map(
                    create_function('$a', 'return $a[0] . \'=\' . $a[1];'), 
                    $this->_flattenArray('', $this->_postData)
                ));

            // multipart request, probably with file uploads
            } else {
                $postdata = '';
                if (!empty($this->_postData)) {
                    $flatData = $this->_flattenArray('', $this->_postData);
                    foreach ($flatData as $item) {
                        $postdata .= '--' . $boundary . "\r\n";
                        $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';
                        $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";
                    }
                }
                foreach ($this->_postFiles as $name => $value) {
                    if (is_array($value['name'])) {
                        $varname       = $name . ($this->_useBrackets? '[]': '');
                    } else {
                        $varname       = $name;
                        $value['name'] = array($value['name']);
                    }
                    foreach ($value['name'] as $key => $filename) {
                        $fp   = fopen($filename, 'r');
                        $data = fread($fp, filesize($filename));
                        fclose($fp);
                        $basename = basename($filename);
                        $type     = is_array($value['type'])? @$value['type'][$key]: $value['type'];

                        $postdata .= '--' . $boundary . "\r\n";
                        $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';
                        $postdata .= "\r\nContent-Type: " . $type;
                        $postdata .= "\r\n\r\n" . $data . "\r\n";
                    }
                }
                $postdata .= '--' . $boundary . "--\r\n";
            }
            $request .= 'Content-Length: ' .
                        (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .
                        "\r\n\r\n";
            $request .= $postdata;

        // Explicitly set request body
        } elseif (0 < strlen($this->_body)) {

            $request .= 'Content-Length: ' .
                        (HTTP_REQUEST_MBSTRING? mb_strlen($this->_body, 'iso-8859-1'): strlen($this->_body)) .
                        "\r\n\r\n";
            $request .= $this->_body;

        // Terminate headers with CRLF on POST request with no body, too
        } else {

            $request .= "\r\n";
        }
        
        return $request;
    }
Ejemplo n.º 10
0
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");
Ejemplo n.º 11
0
 function meldPersistQuery($sQuery = "", $event = "", $asArray = false)
 {
     if (is_array($sQuery)) {
         $aQuery = $sQuery;
     } else {
         if (!empty($sQuery)) {
             // need an intermediate step here.
             $aQuery = Net_URL::_parseRawQuerystring($sQuery);
         } else {
             $aQuery = array();
         }
     }
     // now try to grab each persisted entry
     // don't overwrite the existing values, if added.
     if (is_array($this->aPersistParams)) {
         foreach ($this->aPersistParams as $k) {
             if (!array_key_exists($k, $aQuery)) {
                 $v = KTUtil::arrayGet($_REQUEST, $k);
                 if (!empty($v)) {
                     $aQuery[$k] = $v;
                 }
             }
             // handle the case where action is passed in already.
         }
     }
     // if it isn't already set
     if (!array_key_exists($this->event_var, $aQuery) && !empty($event)) {
         $aQuery[$this->event_var] = urlencode($event);
     }
     //var_dump($aQuery);
     if ($asArray) {
         return $aQuery;
     }
     // encode and blend.
     $aQueryStrings = array();
     foreach ($aQuery as $k => $v) {
         $aQueryStrings[] = urlencode($k) . "=" . urlencode($v);
     }
     $sQuery = join('&', $aQueryStrings);
     return $sQuery;
 }
 /**
  * 新着情報を取得する.
  *
  * @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;
 }
Ejemplo n.º 13
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();
 }
 /**
  * 新着情報を取得する
  *
  * @return array $arrNews 取得結果を配列で返す
  */
 public function lfGetNews()
 {
     $objNews = new SC_Helper_News_Ex();
     $arrNews = $objNews->getList();
     $objDb = new SC_Helper_DB_Ex();
     $arrInfo = $objDb->sfGetBasisData();
     // RSS用に変換
     foreach (array_keys($arrNews) as $key) {
         $netUrlHttpUrl = new Net_URL(HTTP_URL);
         $row =& $arrNews[$key];
         $row['shop_name'] = $arrInfo['shop_name'];
         $row['email'] = $arrInfo['email04'];
         // 日付
         $row['news_date'] = date('r', strtotime($row['news_date']));
         // 新着情報URL
         if (SC_Utils_Ex::isBlank($row['news_url'])) {
             $row['news_url'] = HTTP_URL;
         } elseif ($row['news_url'][0] == '/') {
             // 変換(絶対パス→URL)
             $netUrl = new Net_URL($row['news_url']);
             $netUrl->protocol = $netUrlHttpUrl->protocol;
             $netUrl->user = $netUrlHttpUrl->user;
             $netUrl->pass = $netUrlHttpUrl->pass;
             $netUrl->host = $netUrlHttpUrl->host;
             $netUrl->port = $netUrlHttpUrl->port;
             $row['news_url'] = $netUrl->getUrl();
         }
     }
     return $arrNews;
 }
	echo "<th>Tytu³</th>";
	if ($ustawieniaGaleriiZdjec->obslugaPolaGaleriaZdjecOpis) {
		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>";
 /**
  * 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));
     }
 }
Ejemplo n.º 17
0
 public function generate($values = array(), $qstring = array(), $anchor = '')
 {
     $path = '';
     foreach ($this->parts as $part) {
         $path .= $part->generate($values);
     }
     $path = '/' . trim(Net_URL::resolvePath($path), '/');
     if (!empty($qstring)) {
         $path .= '?' . http_build_query($qstring);
     }
     if (!empty($anchor)) {
         $path .= '#' . ltrim($anchor, '#');
     }
     return $path;
 }
Ejemplo n.º 18
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;
 }
Ejemplo n.º 19
0
 /**
  * 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;
 }
Ejemplo n.º 20
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;
 }
 /**
  * 
  * 
  * @return void 
  */
 function doDefault()
 {
     // カート「戻るボタン」用に保持
     $netURL = new Net_URL();
     $_SESSION['cart_referer_url'] = $netURL->getURL();
 }
Ejemplo n.º 22
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'on');
require_once '../URL.php';
$url = new Net_URL();
$url->setOption('encode_query_keys', true);
print_r($url->querystring);
Ejemplo n.º 23
0
 /**
  * 新着情報を取得する
  *
  * @param SC_Query $objQuery DB操作クラス
  * @return array $arrNews 取得結果を配列で返す
  */
 function lfGetNews(&$objQuery)
 {
     $col = "";
     $col .= "news_id ";
     // 新着情報ID
     $col .= ",news_title ";
     // 新着情報タイトル
     $col .= ",news_comment ";
     // 新着情報本文
     $col .= ",news_date ";
     // 日付
     $col .= ",news_url ";
     // 新着情報URL
     $col .= ",news_select ";
     // 新着情報の区分(1:URL、2:本文)
     $col .= ",(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";
     // 店名
     $col .= ",(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";
     // 代表Emailアドレス
     $from = "dtb_news";
     $where = "del_flg = '0'";
     $order = "rank DESC";
     $objQuery->setOrder($order);
     $arrNews = $objQuery->select($col, $from, $where);
     // RSS用に変換
     foreach (array_keys($arrNews) as $key) {
         $netUrlHttpUrl = new Net_URL(HTTP_URL);
         $row =& $arrNews[$key];
         // 日付
         $row['news_date'] = date('r', strtotime($row['news_date']));
         // 新着情報URL
         if (SC_Utils_Ex::isBlank($row['news_url'])) {
             $row['news_url'] = HTTP_URL;
         } elseif ($row['news_url'][0] == '/') {
             // 変換(絶対パス→URL)
             $netUrl = new Net_URL($row['news_url']);
             $netUrl->protocol = $netUrlHttpUrl->protocol;
             $netUrl->user = $netUrlHttpUrl->user;
             $netUrl->pass = $netUrlHttpUrl->pass;
             $netUrl->host = $netUrlHttpUrl->host;
             $netUrl->port = $netUrlHttpUrl->port;
             $row['news_url'] = $netUrl->getUrl();
         }
     }
     return $arrNews;
 }
Ejemplo n.º 24
0
 /**
  * Sends the request
  *
  * @access public
  * @param  bool   Whether to store response body in Response object property,
  *                set this to false if downloading a LARGE file and using a Listener
  * @return mixed  PEAR error on error, true otherwise
  */
 function sendRequest($saveBody = true)
 {
     if (@(!is_a($this->_url, 'Net_URL'))) {
         return PEAR::raiseError('No URL given.');
     }
     $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;
     $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;
     // 4.3.0 supports SSL connections using OpenSSL. The function test determines
     // we running on at least 4.3.0
     if (strcasecmp($this->_url->protocol, 'https') == 0 and function_exists('file_get_contents') and extension_loaded('openssl')) {
         if (isset($this->_proxy_host)) {
             return PEAR::raiseError('HTTPS proxies are not supported.');
         }
         $host = 'ssl://' . $host;
     }
     // magic quotes may f**k up file uploads and chunked response processing
     $magicQuotes = ini_get('magic_quotes_runtime');
     ini_set('magic_quotes_runtime', false);
     // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive
     // connection token to a proxy server...
     if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']) {
         $this->removeHeader('connection');
     }
     $keepAlive = HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection']) || !empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection'];
     @($sockets =& PEAR::getStaticProperty('HTTP_Request', 'sockets'));
     $sockKey = $host . ':' . $port;
     unset($this->_sock);
     // There is a connected socket in the "static" property?
     if ($keepAlive && !empty($sockets[$sockKey]) && !empty($sockets[$sockKey]->fp)) {
         $this->_sock =& $sockets[$sockKey];
         $err = null;
     } else {
         $this->_notify('connect');
         $this->_sock =& new Net_Socket();
         $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
     }
     @PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
     if (@(!PEAR::isError($err))) {
         if (!empty($this->_readTimeout)) {
             $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);
         }
         $this->_notify('sentRequest');
         // Read the response
         $this->_response =& new HTTP_Response($this->_sock, $this->_listeners);
         $err = $this->_response->process($this->_saveBody && $saveBody, HTTP_REQUEST_METHOD_HEAD != $this->_method);
         if ($keepAlive) {
             $keepAlive = isset($this->_response->_headers['content-length']) || isset($this->_response->_headers['transfer-encoding']) && strtolower($this->_response->_headers['transfer-encoding']) == 'chunked';
             if ($keepAlive) {
                 if (isset($this->_response->_headers['connection'])) {
                     $keepAlive = strtolower($this->_response->_headers['connection']) == 'keep-alive';
                 } else {
                     $keepAlive = 'HTTP/' . HTTP_REQUEST_HTTP_VER_1_1 == $this->_response->_protocol;
                 }
             }
         }
     }
     ini_set('magic_quotes_runtime', $magicQuotes);
     if (@PEAR::isError($err)) {
         return $err;
     }
     if (!$keepAlive) {
         $this->disconnect();
         // Store the connected socket in "static" property
     } elseif (empty($sockets[$sockKey]) || empty($sockets[$sockKey]->fp)) {
         $sockets[$sockKey] =& $this->_sock;
     }
     // Check for redirection
     if ($this->_allowRedirects and $this->_redirects <= $this->_maxRedirects and $this->getResponseCode() > 300 and $this->getResponseCode() < 399 and !empty($this->_response->_headers['location'])) {
         $redirect = $this->_response->_headers['location'];
         // Absolute URL
         if (preg_match('/^https?:\\/\\//i', $redirect)) {
             $this->_url =& new Net_URL($redirect);
             $this->addHeader('Host', $this->_generateHostHeader());
             // Absolute path
         } elseif ($redirect[0] == '/') {
             $this->_url->path = $redirect;
             // Relative path
         } elseif (substr($redirect, 0, 3) == '../' or substr($redirect, 0, 2) == './') {
             if (substr($this->_url->path, -1) == '/') {
                 $redirect = $this->_url->path . $redirect;
             } else {
                 $redirect = dirname($this->_url->path) . '/' . $redirect;
             }
             $redirect = Net_URL::resolvePath($redirect);
             $this->_url->path = $redirect;
             // Filename, no path
         } else {
             if (substr($this->_url->path, -1) == '/') {
                 $redirect = $this->_url->path . $redirect;
             } else {
                 $redirect = dirname($this->_url->path) . '/' . $redirect;
             }
             $this->_url->path = $redirect;
         }
         $this->_redirects++;
         return $this->sendRequest($saveBody);
         // Too many redirects
     } elseif ($this->_allowRedirects and $this->_redirects > $this->_maxRedirects) {
         return PEAR::raiseError('Too many redirects');
     }
     return true;
 }
Ejemplo n.º 25
0
 /**
  * Sends the request
  *
  * @access public
  * @param  bool   Whether to store response body in Response object property,
  *                set this to false if downloading a LARGE file and using a Listener
  * @return mixed  PEAR error on error, true otherwise
  */
 function sendRequest($saveBody = true)
 {
     if (!is_a($this->_url, 'Net_URL')) {
         return PEAR::raiseError('No URL given.');
     }
     $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;
     $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;
     // 4.3.0 supports SSL connections using OpenSSL. The function test determines
     // we running on at least 4.3.0
     if (strcasecmp($this->_url->protocol, 'https') == 0 and function_exists('file_get_contents') and extension_loaded('openssl')) {
         if (isset($this->_proxy_host)) {
             return PEAR::raiseError('HTTPS proxies are not supported.');
         }
         $host = 'ssl://' . $host;
     }
     // magic quotes may f**k up file uploads and chunked response processing
     $magicQuotes = ini_get('magic_quotes_runtime');
     ini_set('magic_quotes_runtime', false);
     // If this is a second request, we may get away without
     // re-connecting if they're on the same server
     $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
     PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
     if (!PEAR::isError($err)) {
         if (!empty($this->_readTimeout)) {
             $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);
         }
         $this->_notify('sentRequest');
         // Read the response
         $this->_response =& new HTTP_Response($this->_sock, $this->_listeners);
         $err = $this->_response->process($this->_saveBody && $saveBody);
     }
     ini_set('magic_quotes_runtime', $magicQuotes);
     if (PEAR::isError($err)) {
         return $err;
     }
     // Check for redirection
     if ($this->_allowRedirects and $this->_redirects <= $this->_maxRedirects and $this->getResponseCode() > 300 and $this->getResponseCode() < 399 and !empty($this->_response->_headers['location'])) {
         $redirect = $this->_response->_headers['location'];
         // Absolute URL
         if (preg_match('/^https?:\\/\\//i', $redirect)) {
             $this->_url =& new Net_URL($redirect);
             $this->addHeader('Host', $this->_generateHostHeader());
             // Absolute path
         } elseif ($redirect[0] == '/') {
             $this->_url->path = $redirect;
             // Relative path
         } elseif (substr($redirect, 0, 3) == '../' or substr($redirect, 0, 2) == './') {
             if (substr($this->_url->path, -1) == '/') {
                 $redirect = $this->_url->path . $redirect;
             } else {
                 $redirect = dirname($this->_url->path) . '/' . $redirect;
             }
             $redirect = Net_URL::resolvePath($redirect);
             $this->_url->path = $redirect;
             // Filename, no path
         } else {
             if (substr($this->_url->path, -1) == '/') {
                 $redirect = $this->_url->path . $redirect;
             } else {
                 $redirect = dirname($this->_url->path) . '/' . $redirect;
             }
             $this->_url->path = $redirect;
         }
         $this->_redirects++;
         return $this->sendRequest($saveBody);
         // Too many redirects
     } elseif ($this->_allowRedirects and $this->_redirects > $this->_maxRedirects) {
         return PEAR::raiseError('Too many redirects');
     }
     $this->_sock->disconnect();
     return true;
 }
Ejemplo n.º 26
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(); ';
 }
Ejemplo n.º 27
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);
 }
Ejemplo n.º 28
0
 /**
  * ページをリロードする.
  *
  * 引数 $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());
 }
Ejemplo n.º 29
0
 /**
  * Calculates the absolute URL of a redirect
  *  
  * @param    object  Net_Url object containing the request URL
  * @param    string  Value of the 'Location' response header
  * @return   string|null  Absolute URL we are being redirected to, null in case of non-HTTP URL 
  * @access   private
  */
 function _redirectUrl($url, $location)
 {
     // If it begins with a scheme (as defined in RFC 2396) then it is absolute URI
     if (preg_match('/^([a-zA-Z][a-zA-Z0-9+.-]*):/', $location, $matches)) {
         // Bug #5759: we shouldn't try to follow non-HTTP redirects
         if ('http' == strtolower($matches[1]) || 'https' == strtolower($matches[1])) {
             return $location;
         } else {
             return null;
         }
     } else {
         if ('/' == $location[0]) {
             $url->path = Net_URL::resolvePath($location);
         } elseif ('/' == substr($url->path, -1)) {
             $url->path = Net_URL::resolvePath($url->path . $location);
         } else {
             $dirname = DIRECTORY_SEPARATOR == dirname($url->path) ? '/' : dirname($url->path);
             $url->path = Net_URL::resolvePath($dirname . '/' . $location);
         }
         $url->querystring = array();
         $url->anchor = '';
         return $url->getUrl();
     }
 }
Ejemplo n.º 30
0
 /**
  * Calculates the absolute URL of a redirect
  *  
  * @param    object  Net_Url object containing the request URL
  * @param    string  Value of the 'Location' response header
  * @return   string  Absolute URL we are being redirected to
  * @access   private
  */
 function _redirectUrl($url, $location)
 {
     if (preg_match('!^https?://!i', $location)) {
         return $location;
     } else {
         if ('/' == $location[0]) {
             $url->path = Net_URL::resolvePath($location);
         } elseif ('/' == substr($url->path, -1)) {
             $url->path = Net_URL::resolvePath($url->path . $location);
         } else {
             $dirname = DIRECTORY_SEPARATOR == dirname($url->path) ? '/' : dirname($url->path);
             $url->path = Net_URL::resolvePath($dirname . '/' . $location);
         }
         $url->querystring = array();
         $url->anchor = '';
         return $url->getUrl();
     }
 }