네이버 신디케이션 적용 및 기타 오류 수정

This commit is contained in:
chicpro
2014-07-09 10:01:21 +09:00
parent 288da7f9e1
commit 4d8500be02
22 changed files with 136 additions and 113 deletions

4
.gitignore vendored
View File

@ -10,3 +10,7 @@ cheditor*/
ckeditor43/
log/
g5_tree/
<<<<<<< HEAD
=======
naver*.html
>>>>>>> g5

View File

@ -10,7 +10,6 @@ $menu['menu100'] = array (
array('100900', '캐시파일 일괄삭제',G5_ADMIN_URL.'/cache_file_delete.php', 'cf_cache', 1),
array('100910', '캡챠파일 일괄삭제',G5_ADMIN_URL.'/captcha_file_delete.php', 'cf_captcha', 1),
array('100920', '썸네일파일 일괄삭제',G5_ADMIN_URL.'/thumbnail_file_delete.php', 'cf_thumbnail', 1),
array('100930', '네이버 신디케이션 핑',G5_SYNDI_URL.'/ping.php', 'cf_syndi_ping', 1),
array('100500', 'phpinfo()', G5_ADMIN_URL.'/phpinfo.php', 'cf_phpinfo')
);
?>

View File

@ -30,8 +30,4 @@ delete_cache_latest($tmp_bo_table);
// 게시판 폴더 전체 삭제
rm_rf(G5_DATA_PATH.'/file/'.$tmp_bo_table);
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.adm.board_delete.inc.php';
?>

View File

@ -385,9 +385,5 @@ if ($all_fields) {
delete_cache_latest($bo_table);
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.adm.board_form_update.php';
goto_url("./board_form.php?w=u&bo_table={$bo_table}&amp;{$qstr}");
?>

View File

@ -65,9 +65,5 @@ if ($w == '') {
alert('제대로 된 값이 넘어오지 않았습니다.');
}
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.adm.boardgroup_form_update.php';
goto_url('./boardgroup_form.php?w=u&amp;gr_id='.$gr_id.'&amp;'.$qstr);
?>

View File

@ -130,6 +130,16 @@ if(!isset($config['cf_add_meta'])) {
ADD `cf_add_meta` TEXT NOT NULL AFTER `cf_analytics` ", true);
}
if (!isset($config['cf_syndi_token'])) {
sql_query(" ALTER TABLE `{$g5['config_table']}`
ADD `cf_syndi_token` VARCHAR(255) NOT NULL AFTER `cf_add_meta` ", true);
}
if (!isset($config['cf_syndi_except'])) {
sql_query(" ALTER TABLE `{$g5['config_table']}`
ADD `cf_syndi_except` TEXT NOT NULL AFTER `cf_syndi_token` ", true);
}
if(!isset($config['cf_sms_use'])) {
sql_query(" ALTER TABLE `{$g5['config_table']}`
ADD `cf_sms_use` varchar(255) NOT NULL DEFAULT '' AFTER `cf_cert_limit`,
@ -503,6 +513,21 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
<textarea name="cf_add_meta" id="cf_add_meta"><?php echo $config['cf_add_meta']; ?></textarea>
</td>
</tr>
<tr>
<th scope="row"><label for="cf_syndi_token">네이버 신디케이션 연동키</label></th>
<td colspan="3">
<?php if (!function_exists('curl_init')) echo help('<b>경고) curl이 지원되지 않아 네이버 신디케이션을 사용할수 없습니다.</b>'); ?>
<?php echo help('네이버 신디케이션 연동키(token)을 입력하면 네이버 신디케이션을 사용할 수 있습니다.<br>연동키는 <a href="http://webmastertool.naver.com/" target="_blank"><u>네이버 웹마스터도구</u></a> -> 네이버 신디케이션에서 발급할 수 있습니다.') ?>
<input type="text" name="cf_syndi_token" value="<?php echo $config['cf_syndi_token'] ?>" id="cf_syndi_token" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_syndi_except">네이버 신디케이션 제외게시판</label></th>
<td colspan="3">
<?php echo help('네이버 신디케이션 수집에서 제외할 게시판 아이디를 | 로 구분하여 입력하십시오. 예) notice|adult<br>참고로 그룹접근사용 게시판, 글읽기 권한 2 이상 게시판, 비밀글은 신디케이션 수집에서 제외됩니다.') ?>
<input type="text" name="cf_syndi_except" value="<?php echo $config['cf_syndi_except'] ?>" id="cf_syndi_except" class="frm_input" size="70">
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -53,6 +53,8 @@ $sql = " update {$g5['config_table']}
cf_intercept_ip = '".trim($_POST['cf_intercept_ip'])."',
cf_analytics = '{$_POST['cf_analytics']}',
cf_add_meta = '{$_POST['cf_add_meta']}',
cf_syndi_token = '{$_POST['cf_syndi_token']}',
cf_syndi_except = '{$_POST['cf_syndi_except']}',
cf_member_skin = '{$_POST['cf_member_skin']}',
cf_use_homepage = '{$_POST['cf_use_homepage']}',
cf_req_homepage = '{$_POST['cf_req_homepage']}',

View File

@ -43,7 +43,7 @@ if($error) {
alert("<?php echo strip_tags($msg); ?>");
//document.location.href = "<?php echo $url; ?>";
<?php if ($url) { ?>
document.location.replace("<?php echo $url; ?>");
document.location.replace("<?php echo str_replace('&amp;', '&', $url); ?>");
<?php } else { ?>
//alert('history.back();');
history.back();

View File

@ -93,10 +93,6 @@ while ($row = sql_fetch_array($result))
// 파일테이블 행 삭제
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.bbs.delete.php';
$count_write++;
}
else

View File

@ -106,10 +106,6 @@ for ($i=count($tmp_array)-1; $i>=0; $i--)
// 파일테이블 행 삭제
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.bbs.delete_all.php';
$count_write++;
}
else

View File

@ -16,7 +16,7 @@ $sql = " update {$g5['member_table']} set mb_leave_date = '{$date}' where mb_id
sql_query($sql);
// 3.09 수정 (로그아웃)
session_unregister("ss_mb_id");
unset($_SESSION['ss_mb_id']);
if (!$url)
$url = G5_URL;

View File

@ -195,10 +195,6 @@ if ($sw == 'move')
sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$save_count_write', bo_count_comment = bo_count_comment - '$save_count_comment' where bo_table = '$bo_table' ");
}
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.bbs.move_update.php';
$msg = '해당 게시물을 선택한 게시판으로 '.$act.' 하였습니다.';
$opener_href = './board.php?bo_table='.$bo_table.'&amp;page='.$page.'&amp;'.$qstr;

View File

@ -83,7 +83,7 @@ if ($w == '' || $w == 'u') {
// 본인확인 체크
if($config['cf_cert_use'] && $config['cf_cert_req']) {
if(trim($_POST['cert_no']) != $_SESSION['ss_cert_no'])
if(trim($_POST['cert_no']) != $_SESSION['ss_cert_no'] || !$_SESSION['ss_cert_no'])
alert("회원가입을 위해서는 본인확인을 해주셔야 합니다.");
}

View File

@ -1,5 +1,6 @@
<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/naver_syndi.lib.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
$g5['title'] = '게시글 저장';
@ -476,9 +477,10 @@ if ($w == '' || $w == 'r') {
sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
}
// syndication ping
if(G5_SYNDI_USE)
include G5_SYNDI_PATH.'/include/include.bbs.write_update.php';
// 게시판그룹접근사용을 하지 않아야 하고 비회원 글읽기가 가능해야 하며 비밀글이 아니어야 합니다.
if (!$group['gr_use_access'] && $board['bO_read_level'] < 2 && !$secret) {
naver_syndi_ping($bo_table, $wr_id);
}
//------------------------------------------------------------------------------
// 가변 파일 업로드

View File

@ -117,7 +117,6 @@ define('G5_PHPMAILER_PATH', G5_PLUGIN_PATH.'/'.G5_PHPMAILER_DIR);
define('G5_USE_MOBILE', true); // 모바일 홈페이지를 사용하지 않을 경우 false 로 설정
define('G5_USE_CACHE', true); // 최신글등에 cache 기능 사용 여부
define('G5_SYNDI_USE', true); // Syndication 기능 사용 여부
/********************

View File

@ -664,22 +664,6 @@ CREATE TABLE IF NOT EXISTS `g5_uniqid` (
-- --------------------------------------------------------
--
-- Table structure for table `g5_syndi_log`
--
DROP TABLE IF EXISTS `g5_syndi_log`;
CREATE TABLE IF NOT EXISTS `g5_syndi_log` (
`content_id` int(11) NOT NULL,
`bbs_id` varchar(50) NOT NULL,
`title` text NOT NULL,
`link_alternative` varchar(250) NOT NULL,
`delete_date` varchar(14) NOT NULL,
PRIMARY KEY (`content_id`,`bbs_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `g5_autosave`
--

View File

@ -245,7 +245,6 @@ fwrite($f, "\$g5['scrap_table'] = G5_TABLE_PREFIX.'scrap'; // 게시글 스크
fwrite($f, "\$g5['visit_table'] = G5_TABLE_PREFIX.'visit'; // 방문자 테이블\n");
fwrite($f, "\$g5['visit_sum_table'] = G5_TABLE_PREFIX.'visit_sum'; // 방문자 합계 테이블\n");
fwrite($f, "\$g5['uniqid_table'] = G5_TABLE_PREFIX.'uniqid'; // 유니크한 값을 만드는 테이블\n");
fwrite($f, "\$g5['syndi_log_table'] = G5_TABLE_PREFIX.'syndi_log'; // 네이버 신디케이션 컨텐츠 삭제 로그 테이블\n");
fwrite($f, "\$g5['autosave_table'] = G5_TABLE_PREFIX.'autosave'; // 게시글 작성시 일정시간마다 글을 임시 저장하는 테이블\n");
fwrite($f, "\$g5['cert_history_table'] = G5_TABLE_PREFIX.'cert_history'; // 인증내역 테이블\n");
fwrite($f, "\$g5['qa_config_table'] = G5_TABLE_PREFIX.'qa_config'; // 1:1문의 설정테이블\n");

43
lib/naver_syndi.lib.php Normal file
View File

@ -0,0 +1,43 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// 네이버 신디케이션에 ping url 을 curl 로 전달합니다.
function naver_syndi_ping($bo_table, $wr_id)
{
global $config;
$token = trim($config['cf_syndi_token']);
// 토큰값이 없다면 네이버 신디케이션 사용안함
if ($token == '') return 0;
// 토큰의 길이는 112 글자입니다.
if (strlen($token) != 112) return -1;
// 신디케이션 수집 제외게시판
if (preg_match('#^('.$config['cf_syndi_except'].')$#', $bo_table)) return -2;
// curl library 가 지원되어야 합니다.
if (!function_exists('curl_init')) return -3;
$ping_auth_header = "Authorization: Bearer " . $token;
$ping_url = urlencode( G5_SYNDI_URL . "/ping.php?bo_table={$bo_table}&wr_id={$wr_id}" );
$ping_client_opt = array(
CURLOPT_URL => "https://apis.naver.com/crawl/nsyndi/v2",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => "ping_url=" . $ping_url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => array("Host: apis.naver.com", "Pragma: no-cache", "Accept: */*", $ping_auth_header)
);
//print_r2($ping_client_opt); exit;
$ping = curl_init();
curl_setopt_array($ping, $ping_client_opt);
$response = curl_exec($ping);
curl_close($ping);
return $response;
}
?>

View File

@ -61,7 +61,7 @@ $LGD_HASHDATA = md5($LGD_MID.$LGD_BUYERSSN.$LGD_TIMESTAMP.$LGD_MERTKEY);
<title>LG유플러스 전자결제 본인확인서비스</title>
<!-- 고객사 사이트가 https인 경우는 아래 http://을 https:// 으로 변경하시면 됩니다. -->
<link rel="stylesheet" href="<?php echo G5_CSS_URL;?>/default.css">
<script language="javascript" src="//xpay.uplus.co.kr/xpay/js/xpay_authonly.js" type="text/javascript"></script>
<script language="javascript" src="//xpay.uplus.co.kr/xpay/js/xpay_authonly.js" type="text/javascript" charset="EUC-KR"></script>
<script>
function do_Authonly() {
ret = xpay_authonly_check(document.getElementById("LGD_PAYINFO"), document.getElementById("CST_PLATFORM").value);

0
plugin/okname/bin/okname_x64 Normal file → Executable file
View File

View File

@ -7,10 +7,6 @@ $sns_msg = urlencode(str_replace('\"', '"', $view['subject']));
//$sns_url = googl_short_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
//$msg_url = $sns_msg.' : '.$sns_url;
// 카카오톡 매뉴얼 : https://github.com/kakao/kakaolink-web
$kakao_appid = $_SERVER['HTTP_HOST']; // Mobile Site Domain 정확히 입력하지 않을 경우 이용이 제한될 수 있습니다.
$kakao_appname = urlencode(str_replace('\"', '"', $g5['title']));
/*
$facebook_url = 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]='.$sns_url.'&p[title]='.$sns_msg;
$twitter_url = 'http://twitter.com/home?status='.$msg_url;
@ -29,12 +25,4 @@ $gplus_url = $sns_send.'&amp;sns=gplus';
<li><a href="<?php echo $facebook_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/facebook.png" alt="페이스북으로 보내기"></a></li>
<li><a href="<?php echo $twitter_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/twitter.png" alt="트위터로 보내기"></a></li>
<li><a href="<?php echo $gplus_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/gplus.png" alt="구글플러스로 보내기"></a></li>
<?php
if (G5_IS_MOBILE) {
$kakao_url = 'kakaolink://sendurl?msg='.$sns_msg.'&amp;url='.$sns_url.'&amp;appid='.$kakao_appid.'&amp;appver=1.0&amp;type=link&amp;appname='.$kakao_appname.'&amp;apiver=2.0';
?>
<li><a href="<?php echo $kakao_url; ?>" target="_blank"><img src="<?php echo G5_SNS_URL; ?>/icon/kakaotalk.png" alt="카카오톡으로 보내기"></a></li>
<?php
}
?>
</ul>

View File

@ -1,62 +1,64 @@
<?php
include_once('./_common.php');
<?
include_once("./_common.php");
header('Content-Type: text/html; charset=UTF-8');
header('Pragma: no-cache');
if (!$write)
die("게시글이 없습니다.");
if(version_compare(PHP_VERSION, '5.3.0') >= 0)
{
date_default_timezone_set(@date_default_timezone_get());
}
if ($group['gr_use_access'])
die("게시판그룹에서 접근사용을 해제하여 주십시오.");
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
if ($board['bo_read_level'] > 1)
die("비회원 읽기가 가능한 게시판만 신디케이션을 지원합니다.");
$syndi_path = dirname(__FILE__);
if (strstr($write['wr_option'], 'secret'))
die("비밀글은 신디케이션을 지원하지 않습니다.");
include $syndi_path . '/config/site.config.php';
if (preg_match('#^('.$config['cf_syndi_except'].')$#', $bo_table))
die("신디케이션에서 제외된 게시판입니다.");
$sql = " select bo_table from " . $g5['board_table'] . " b, ". $g5['group_table'] . " g where b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id order by b.gr_id, b.bo_table limit 1 ";
$channel = sql_fetch($sql);
$title = htmlspecialchars($write['wr_subject']);
$author = htmlspecialchars($write['wr_name']);
$published = date('Y-m-d\TH:i:s\+09:00', strtotime($write['wr_datetime']));
$updated = $published;
$link_href = G5_BBS_URL . "/board.php?bo_table={$bo_table}";
$id = $link_href . htmlspecialchars("&wr_id={$wr_id}");
$link_title = $board['bo_subject'];
$feed_updated = date('Y-m-d\TH:i:s\+09:00', G5_SERVER_TIME);
if (!$channel) die("게시판이 존재하지 않습니다. 게시판 생성후 실행하시기 바랍니다.");
$sql = " select wr_id from {$g5['write_prefix']}{$channel['bo_table']} where wr_is_comment = 0 order by wr_num, wr_reply desc limit 1 ";
$article = sql_fetch($sql);
?>
$find = array('&amp;', '&nbsp;'); # 찾아서
$replace = array('&', ' '); # 바꾼다
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>네이버 신디케이션 핑</title>
<style>
body {background:#f5f6fa;color:#000}
h1 {padding:20px 0 0;text-align:center}
ul {margin:30px;padding:0;border:1px solid #aaa;border:1px solid #aaa;list-style:none;zoom:1}
ul:after {display:block;visibility:hidden;clear:both;content:""}
li {float:left;width:50%;border-bottom:1px solid #e9e9e9}
a {display:block;padding:1em;height:2em;background:#fff;color:#000;font-weight:bold;text-decoration:none}
a:focus, a:hover {background:#333;color:#fff;text-decoration:none}
.left_line {border-left:1px solid #e9e9e9}
.no_bottom_line {border-bottom:0 !important}
.bg {background:#f7f7f7}
</style>
</head>
$content = str_replace( $find, $replace, $write['wr_content'] );
$summary = str_replace( $find, $replace, strip_tags($write['wr_content']) );
<body>
<h1>네이버 신디케이션 핑 (Naver Syndication PING)</h1>
Header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
<ul>
<li><a href="http://developer.naver.com/wiki/pages/SyndicationAPI">Syndication API</a></li>
<li><a href="http://syndication.openapi.naver.com/status/?site=<?php echo $syndi_tag_domain; ?>" class="left_line">Naver Syndication 연결확인</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:site&amp;type=site" class="bg">사이트 정보</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:channel:<?php echo $channel['bo_table']; ?>&type=channel" class="bg left_line">특정 채널 정보</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:site&type=channel" class="bg">채널 목록</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:site&type=article" class="left_line">사이트의 모든 문서 목록</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:channel:<?php echo $channel['bo_table']; ?>&type=article">특정 채널의 문서 목록</a></li>
<li><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:article:<?php echo $channel['bo_table']; ?>-<?php echo $article['wr_id']; ?>&type=article" class="left_line">특정 문서 정보</a></li>
<li class="no_bottom_line"><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:site&amp;type=deleted" class="bg">사이트의 모든 삭제문서 목록</a></li>
<li class="no_bottom_line"><a href="<?php echo G5_SYNDI_URL; ?>/syndi_echo.php?id=tag:<?php echo $syndi_tag_domain.','.$syndi_tag_year; ?>:channel:<?php echo $channel['bo_table']; ?>&type=deleted" class="bg left_line">특정 채널의 삭제 문서 목록</a></li>
</ul>
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<feed xmlns=\"http://webmastertool.naver.com\">\n";
echo "<id>" . G5_URL . "</id>\n";
echo "<title>naver syndication feed document</title>\n";
echo "<author>\n";
echo "<name>webmaster</name>\n";
echo "</author>\n";
</body>
</html>
echo "<updated>{$feed_updated}</updated>\n";
echo "<link rel=\"site\" href=\"" . G5_URL . "\" title=\"{$config['cf_title']}\" />\n";
echo "<entry>\n";
echo "<id>{$id}</id>\n";
echo "<title><![CDATA[{$title}]]></title>\n";
echo "<author>\n";
echo "<name>{$author}</name>\n";
echo "</author>\n";
echo "<updated>{$updated}</updated>\n";
echo "<published>{$published}</published>\n";
echo "<link rel=\"via\" href=\"{$link_href}\" title=\"{$link_title}\" />\n";
echo "<link rel=\"mobile\" href=\"{$id}\" />\n";
echo "<content type=\"html\"><![CDATA[{$content}]]></content>\n";
echo "<summary type=\"text\"><![CDATA[{$summary}]]></summary>\n";
echo "<category term=\"{$bo_table}\" label=\"{$link_title}\" />\n";
echo "</entry>\n";
echo "</feed>";
?>