Source for file LC_Page_TrackBack.php
Documentation is available at LC_Page_TrackBack.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH . "pages/LC_Page.php");
* [1]なるべく多くのブログに対応できるように、GET/POST に関わらず受信する
* [2]RSSの要求はGETで__modeパラメータがrssの場合のみ対応する(商品情報を返す)
* [3]文字コードは指定がなければautoで対応する
* [4]スパムは、オリジナル(好み)のアルゴリズムで対応できるようにしておく
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_TrackBack.php 18734 2010-06-22 08:45:33Z nanasess $
if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) {
$afterEncode = mb_internal_encoding();
if (isset ($_POST["charset"])) {
$beforeEncode = $_POST["charset"];
} else if (isset ($_GET["charset"])) {
$beforeEncode = $_GET["charset"];
if (isset ($_POST["blog_name"])) {
$arrData["blog_name"] = trim(mb_convert_encoding($_POST["blog_name"], $afterEncode, $beforeEncode));
} else if (isset ($_GET["blog_name"])) {
$arrData["blog_name"] = trim(mb_convert_encoding($_GET["blog_name"], $afterEncode, $beforeEncode));
if (isset ($_POST["url"])) {
$arrData["url"] = trim(mb_convert_encoding($_POST["url"], $afterEncode, $beforeEncode));
} else if (isset ($_GET["url"])) {
$arrData["url"] = trim(mb_convert_encoding($_GET["url"], $afterEncode, $beforeEncode));
* RSS目的ではないGETリクエストを制御(livedoor blog)
* _rssパラメータでのGETリクエストを制御(Yahoo blog)
if (isset ($_GET["__mode"]) && isset ($_GET["pid"])) {
if ($_GET["__mode"] == "rss") {
if (isset ($_POST["title"])) {
$arrData["title"] = trim(mb_convert_encoding($_POST["title"], $afterEncode, $beforeEncode));
} else if (isset ($_GET["title"])) {
$arrData["title"] = trim(mb_convert_encoding($_GET["title"], $afterEncode, $beforeEncode));
if (isset ($_POST["excerpt"])) {
$arrData["excerpt"] = trim(mb_convert_encoding($_POST["excerpt"], $afterEncode, $beforeEncode));
} else if (isset ($_GET["excerpt"])) {
$arrData["excerpt"] = trim(mb_convert_encoding($_GET["excerpt"], $afterEncode, $beforeEncode));
$log_path = DATA_PATH . "logs/tb_result.log";
GC_Utils_Ex::gfPrintLog("request data start -----", $log_path);
foreach($arrData as $key => $val) {
GC_Utils_Ex::gfPrintLog( "\t" . $key . " => " . $val, $log_path);
GC_Utils_Ex::gfPrintLog("request data end -----", $log_path);
$objFormParam->setParam($arrData);
$objFormParam->convParam();
$arrData = $objFormParam->getHashArray();
// エラーチェック(トラックバックが成り立たないので、URL以外も必須とする)
if(count($this->arrErr) == 0) {
if (isset ($_GET["pid"])) {
$product_id = $_GET["pid"];
$where = "product_id = ?";
$objDb = new SC_Helper_DB_Ex();
// 商品データが存在する場合はトラックバックデータの更新
if ($objDb->sfDataExists($table, $where, array($product_id))) {
$arrData["product_id"] = $product_id;
GC_Utils_Ex::gfPrintLog("--- PRODUCT NOT EXISTS : " . $product_id, $log_path);
foreach($this->arrErr as $key => $val) {
GC_Utils_Ex::gfPrintLog( "\t" . $key . " => " . $val, $log_path);
$objFormParam->addParam("URL", "url", URL_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("ブログタイトル", "blog_name", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("記事タイトル", "title", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("記事内容", "excerpt", MLTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
* @return $objErr->arrErr エラーメッセージ
$arrRet = $objFormParam->getHashArray();
$objErr->arrErr = $objFormParam->checkError();
* @param $arrData トラックバックデータ
$log_path = DATA_PATH . "logs/tb_result.log";
$arrData["status"] = TRACKBACK_STATUS_NOT_VIEW;
$arrData["status"] = TRACKBACK_STATUS_SPAM;
$arrData["create_date"] = "now()";
$arrData["update_date"] = "now()";
if(!isset ($arrData['url'])){
}elseif(!isset ($arrData['excerpt'])){
$arrData['excerpt'] = '';
$table = "dtb_trackback";
$ret = $objQuery->insert($table, $arrData);
* @param $arrData トラックバックデータ
* @param $run フィルターフラグ(true:使用する false:使用しない)
header("Content-type: text/xml");
print ("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
print ("<error>0</error>");
header("Content-type: text/xml");
print ("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
print ("<error>1</error>");
print ("<message>The error message</message>");
* @param $product_id 商品コード
$retProduct = $objQuery->select("*", "dtb_products", "product_id = ?", array($product_id));
if (count($retProduct) > 0) {
header("Content-type: text/xml");
print ("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
print ("<error>0</error>");
print ("<rss version=\"0.91\">");
print ("<title>" . $retProduct[0]["name"] . "</title>");
print (SITE_URL . "products/detail.php?product_id=" . $product_id);
print ($retProduct[0]["main_comment"]);
print ("<language>ja-jp</language>");
Documentation generated on Fri, 24 Feb 2012 13:59:54 +0900 by Seasoft
|