gitignore 충돌 수정

This commit is contained in:
chicpro
2014-07-09 09:59:17 +09:00
43 changed files with 133 additions and 1860 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ cheditor*/
ckeditor43/
log/
g5_tree/
naver*.html

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}&{$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&gr_id='.$gr_id.'&'.$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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

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,19 +0,0 @@
<?php
// 타임존
$GLOBALS['syndi_time_zone'] = '+09:00';
// 데이타 인코딩
$GLOBALS['syndi_from_encoding'] = 'utf-8';
// 도메인 (http:// 제외, 마지막 / 제외)
$GLOBALS['syndi_tag_domain'] = $_SERVER['HTTP_HOST']; // 도메인을 직접 입력하시는게 좋습니다. (예: 'gnuboard.com')
// 도메인 연결 날짜(년도)
$GLOBALS['syndi_tag_year'] = '2010';
// 홈페이지 제목
$GLOBALS['syndi_homepage_title'] = $config['cf_title'];
// Syndication 출력 url (syndi_echo.php의 웹경로)
$GLOBALS['syndi_echo_url'] = G5_SYNDI_URL.'/syndi_echo.php';
?>

View File

@ -1,438 +0,0 @@
<?php
/**
* @file plugin/syndi/func/site.func.php
* @author sol (ngleader@gmail.com)
* @brief syndication client functions for gnuboard5
*
* Syndi_getSiteInfo : 사이트 정보
* Syndi_getChannelList : 사이트의 게시판
* Syndi_getArticleList : 게시물
* Syndi_getDeletedList : 삭제 게시물
* Syndi_getChannelNextPage : Syndi_getChannelList 의 페이징시 다음 페이지
* Syndi_getArticleNextPage : Syndi_getArticleList 의 페이징시 다음 페이지
* Syndi_getDeletedNextPage : Syndi_getDeletedList 의 페이징시 다음 페이지
*/
// include gnuboard config & lib
//include G5_PATH.'/config.php';
//include G5_LIB_PATH.'/common.lib.php';
//include G5_DATA_PATH.'/dbconfig.php';
$connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD);
if(!$connect_db) return;
$GLOBALS['connect_db'] = $connect_db;
sql_select_db(G5_MYSQL_DB, $connect_db);
/**
* @brief 사이트 정보
**/
function Syndi_getSiteInfo($args)
{
$title = $GLOBALS['syndi_homepage_title'];
$tag = SyndicationHandler::getTag('site');
$oSite = new SyndicationSite;
$oSite->setId($tag);
$oSite->setTitle($title);
$oSite->setUpdated(date('YmdHis'));
// 홈페이지 주소
$link_alternative = sprintf('%s', G5_URL);
$oSite->setLinkAlternative($link_alternative);
$link_self = sprintf('%s?id=%s&type=%s',$GLOBALS['syndi_echo_url'],$tag,$args->type);
$oSite->setLinkSelf($link_self);
return $oSite;
}
/**
* @brief Channel(게시판) 목록
**/
function Syndi_getChannelList($args)
{
global $g5;
$where = '';
if($args->target_channel_id) $where .= " and b.bo_table='". mysql_real_escape_string($args->target_channel_id) . "'";
$sql = "select b.bo_table,b.bo_subject 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 ". $where;
$sql .= " order by b.gr_id,b.bo_table";
if($args->type=='channel')
{
$sql .= sprintf(" limit %s,%s", ($args->page-1)*$args->max_entry, $args->max_entry);
}
$result = sql_query($sql);
$channel_list = array();
while($row = sql_fetch_array($result))
{
$row['bo_subject'] = $row['bo_subject']?$row['bo_subject']:$row['bo_table'];
$tag = SyndicationHandler::getTag('channel',$row['bo_table']);
$oChannel = new SyndicationChannel;
$oChannel->setId($tag);
$oChannel->setTitle($row['bo_subject']);
$oChannel->setType('web');
$oChannel->setUpdated(date('YmdHis'));
$link_self = sprintf('%s?id=%s&type=%s',$GLOBALS['syndi_echo_url'],$tag,$args->type);
$oChannel->setLinkSelf($link_self);
// 게시판 웹주소
$link_alternative = sprintf('%s/bbs/board.php?bo_table=%s', G5_URL, $row['bo_table']);
$oChannel->setLinkAlternative($link_alternative);
$channel_list[] = $oChannel;
}
sql_free_result($result);
return $channel_list;
}
/**
* @brief 모든 게시판의 게시물을 가져올때, 다음 게시판을 가져옴
**/
function _Syndi_getNextChannelId($channel_id=null)
{
global $g5;
if(!$channel_id)
{
$sql = "select b.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";
$sql .= " order by b.bo_table limit 1";
$row = sql_fetch($sql);
return $row['bo_table'];
}
$channel_id = mysql_real_escape_string($channel_id);
$sql = "select b.bo_table from " . $g5['board_table'] . " b, ". $g5['group_table'] . " g where b.bo_table>'$channel_id' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id";
$sql .= " order by b.bo_table limit 1";
$result = sql_query($sql);
if(mysql_num_rows($result)==0) return false;
$row = sql_fetch_array($result);
sql_free_result($result);
return $row['bo_table'];
}
/**
* @brief 게시물 목록
**/
function Syndi_getArticleList($args)
{
global $g5;
/*
$args->target_content_id //게시물 번호
$args->target_channel_id //게시판 번호
$args->start_time //기간
$args->end_time
$args->max_entry //출력 목록당 개수
$args->page //페이지 번호
$args->channel_id //모든 글 출력시 해당 게시판
*/
// all channel articles mysql 3.X, 4.0.X 에서는 sub query가 되지 않는다.
if(!$args->target_channel_id)
{
// $args->channel_id 가 없을 경우 첫번째 게시판을 가져온다.
if(!$args->channel_id) $args->channel_id = _Syndi_getNextChannelId();
$args->target_channel_id = $args->channel_id;
$article_list = Syndi_getArticleList($args);
unset($args->target_channel_id);
if(count($article_list)>0) return $article_list;
return array();
}
return _Syndi_getArticleList($args);
}
/**
* @brief 게시물 목록
**/
function _Syndi_getArticleList($args)
{
global $g5;
/*
$args->target_content_id //게시물 번호
$args->target_channel_id //게시판 번호
$args->start_time //기간
$args->end_time
$args->max_entry //출력 목록당 개수
$args->page //페이지 번호
*/
$sql = "select count(*) as cnt from " . $g5['board_table'] . " b, ". $g5['group_table'] . " g where b.bo_table='" . mysql_real_escape_string($args->target_channel_id). "' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id";
$row = sql_fetch_array(sql_query($sql));
if($row['cnt']<1) return array();
$content_table = $t_board.'_'. $args->target_channel_id;
$category_table = $t_category.'_'. $args->target_channel_id;
// get article list
$where = " and wr_is_comment=0 ";
if($args->target_content_id) $where .= ' and wr_id='. mysql_real_escape_string($args->target_content_id);
if($args->start_time) $where .= ' and wr_datetime >= '. _getTime($args->start_time);
if($args->end_time) $where .= ' and wr_datetime <= '. _getTime($args->end_time);
$sql = "select wr_id, ca_name, wr_subject, wr_content, mb_id, wr_name, wr_homepage, wr_email, wr_datetime, wr_last from " . $g5['write_prefix'] . $args->target_channel_id . " where 1=1" . $where;
$sql .= " order by wr_id desc ";
$sql .= sprintf(" limit %s,%s", ($args->page-1)*$args->max_entry, $args->max_entry);
$result = sql_query($sql);
$article_list = array();
while($row = sql_fetch_array($result))
{
$oArticle = new SyndicationArticle;
$tag = SyndicationHandler::getTag('article', $args->target_channel_id, $row['wr_id']);
$oArticle->setId($tag);
$oArticle->setTitle($row['wr_subject']);
$oArticle->setContent($row['wr_content']);
$oArticle->setType('web');
$oArticle->setCategory($row['ca_name']);
$oArticle->setName($row['wr_name']);
$oArticle->setEmail($row['wr_email']);
$oArticle->setUrl($row['wr_homepage']);
$oArticle->setPublished(date('YmdHis',_getTime($row['wr_datetime'])));
if($row['wr_last']) $oArticle->setUpdated(date('YmdHis',_getTime($row['wr_last'])));
// 게시판 웹주소
$link_channel_alternative = sprintf('%s/bbs/board.php?bo_table=%s',G5_URL,$args->target_channel_id);
// 게시물 웹주소
$link_alternative = $link_channel_alternative . '&wr_id=' . $row['wr_id'];
$oArticle->setLinkChannel($tag);
$oArticle->setLinkAlternative($link_alternative);
$oArticle->setLinkChannelAlternative($link_channel_alternative);
// add list
$article_list[] = $oArticle;
}
sql_free_result($result);
return $article_list;
}
/**
* @brief 삭제 게시물 목록
* 삭제된 게시물에 대해 logging이 필요
**/
function Syndi_getDeletedList($args)
{
global $g5;
$table = $g5['syndi_log_table'];
// get delete article list
$where = '';
if($args->target_content_id) $where .= " and content_id='" . mysql_real_escape_string($args->target_content_id) . "'";
if($args->target_channel_id) $where .= " and bbs_id='" . mysql_real_escape_string($args->target_channel_id) . "'";
if($args->start_time) $where .= ' and delete_date >= '. $args->start_time;
if($args->end_time) $where .= ' and delete_date <= '. $args->end_time;
$sql = "select content_id, bbs_id, title, link_alternative, delete_date from $table where 1=1" . $where;
$sql .= " order by delete_date desc ";
$sql .= sprintf(" limit %s,%s", ($args->page-1)*$args->max_entry, $args->max_entry);
$result = sql_query($sql);
$deleted_list = array();
while($row = sql_fetch_array($result))
{
$oDeleted = new SyndicationDeleted;
$tag = SyndicationHandler::getTag('article', $row['bbs_id'], $row['content_id']);
$oDeleted->setId($tag);
$oDeleted->setTitle($row['title']);
$oDeleted->setUpdated($row['delete_date']);
$oDeleted->setDeleted($row['delete_date']);
if(substr($row['link_alternative'],0,2)=='./')
{
$row['link_alternative'] = G5_URL . substr($row['link_alternative'],1);
}
$oDeleted->setLinkAlternative($row['link_alternative']);
$deleted_list[] = $oDeleted;
}
sql_free_result($result);
return $deleted_list;
}
/**
* @brief Channel 목록 출력시 다음 페이지 번호
* return array('page'=>다음 페이지);
**/
function Syndi_getChannelNextPage($args)
{
global $g5;
$where = '';
if($args->target_channel_id) $where .= " and bo_table='". mysql_real_escape_string($args->target_channel_id) . "'";
$count_sql = "select count(*) as cnt from " . $g5['board_table'] . " where bo_read_level=1 and bo_list_level=1 " .$where;
$result = sql_query($count_sql);
$row = sql_fetch_array($result);
sql_free_result($result);
$total_count = $row['cnt'];
$total_page = ceil($total_count / $args->max_entry);
if($args->page >= $total_page)
{
return false;
}
else
{
return array('page'=>$args->page+1);
}
}
/**
* @brief 게시물 목록 출력시 다음 페이지
* return array('page'=>다음 페이지, 'channel_id'=>다음 게시판)
**/
function Syndi_getArticleNextPage($args)
{
global $g5;
// 사이트 모든 글
if(!$args->target_channel_id)
{
// channel_id 라는 변수로 게시판id를 받는다 (mysql 3.x,4.0.x을 위해)
if(!$args->channel_id)
{
$args->channel_id = _Syndi_getNextChannelId();
$args->all_channel = true;
}
$args->target_channel_id = $args->channel_id;
$obj = _Syndi_getArticleNextPage($args);
unset($args->target_channel_id, $args->all_channel);
return $obj;
}
else
{
return _Syndi_getArticleNextPage($args);
}
}
function _Syndi_getArticleNextPage($args)
{
global $g5;
$sql = "select count(*) as cnt from " . $g5['board_table'] . " b, ". $g5['group_table'] . " g where b.bo_table='" . mysql_real_escape_string($args->target_channel_id). "' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id";
if($row['cnt']==0) return false;
// get article list
$where = " and wr_is_comment=0 ";
if($args->target_content_id) $where .= ' and wr_id='. mysql_real_escape_string($args->target_content_id);
if($args->start_time) $where .= ' and wr_datetime >= '. _getTime($args->start_time);
if($args->end_time) $where .= ' and wr_datetime <= '. _getTime($args->end_time);
$count_sql = "select count(*) as cnt from " . $g5['write_prefix'] . $args->target_channel_id . " where 1=1 " .$where;
$result = sql_query($count_sql);
$row = sql_fetch_array($result);
sql_free_result($result);
$total_count = $row['cnt'];
$total_page = ceil($total_count / $args->max_entry);
if($args->page >= $total_page)
{
if($args->all_channel)
{
$next_channel_id = _Syndi_getNextChannelId($args->target_channel_id);
if(!$next_channel_id) return false;
return array('page'=>1, 'channel_id'=>$next_channel_id);
}
else
{
return false;
}
}
else
{
return array('page'=>$args->page+1);
}
}
/**
* @brief 게시물 삭제 목록 출력시 다음 페이지 번호
**/
function Syndi_getDeletedNextPage($args)
{
global $g5;
$table = $g5['syndi_log_table'];
// get delete article list
$where = '';
if($args->target_content_id) $where .= " and no='" . mysql_real_escape_string($args->target_content_id) . "'";
if($args->target_channel_id) $where .= " and bbs_id='" . mysql_real_escape_string($args->target_channel_id) . "'";
if($args->start_time) $where .= ' and delete_date >= '. $args->start_time;
if($args->end_time) $where .= ' and delete_date <= '. $args->end_time;
$count_sql = "select count(*) as cnt from $table where 1=1" .$where;
$result = sql_query($count_sql);
$row = sql_fetch_array($result);
sql_free_result($result);
$total_count = $row['cnt'];
$total_page = ceil($total_count / $args->max_entry);
if($args->page >= $total_page)
{
return array('page'=>0);
}
else
{
return array('page'=>$args->page+1);
}
}
function _getTime($date)
{
return strtotime($date);
}
$oSyndicationHandler = &SyndicationHandler::getInstance();
$oSyndicationHandler->registerFunction('site_info','Syndi_getSiteInfo');
$oSyndicationHandler->registerFunction('channel_list','Syndi_getChannelList');
$oSyndicationHandler->registerFunction('channel_next_page','Syndi_getChannelNextPage');
$oSyndicationHandler->registerFunction('article_list','Syndi_getArticleList');
$oSyndicationHandler->registerFunction('article_next_page','Syndi_getArticleNextPage');
$oSyndicationHandler->registerFunction('deleted_list','Syndi_getDeletedList');
$oSyndicationHandler->registerFunction('deleted_next_page','Syndi_getDeletedNextPage');
?>

View File

@ -1,29 +0,0 @@
<?php
/**
* @file include.adm.board_delete.inc.php
* @author sol (ngleader@gmail.com)
* @brief 게시판 삭제시 Syndication Ping
* gnuboard5/adm/board_delete.inc.php 파일에 추가
* include '../syndi/include/include.adm.board_delete.inc.php';
*/
if(!defined('_GNUBOARD_')) return;
if(!$tmp_bo_table) return;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('site'));
$oPing->setType('channel');
// delete log
$_sql = "delete from {$g5['syndi_log_table']} where bbs_id='%s'";
sql_query(sprintf($_sql, $tmp_bo_table));
$oPing->request();
?>

View File

@ -1,23 +0,0 @@
<?php
/**
* @file include.adm.board_form_update.php
* @author sol (ngleader@gmail.com)
* @brief 게시판 삭제시 Syndication Ping
* gnuboard5/adm/board_form_update.php 파일에 추가
* include '../syndi/include/include.adm.board_form_update.php';
*/
if(!defined('_GNUBOARD_')) return;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('site'));
$oPing->setType('channel');
$oPing->request();
?>

View File

@ -1,27 +0,0 @@
<?php
/**
* @file include.adm.boardgroup_form_update.php
* @author sol (ngleader@gmail.com)
* @brief 게시판 삭제시 Syndication Ping
* gnuboard5/adm/board_delete.inc.php 파일에 추가
* include '../syndi/include/gnuboard5_euckr/include.adm.boardgroup_form_update.php';
*/
if(!defined('_GNUBOARD_')) return;
// group 수정이 아니면
if(!$_POST[gr_id]) return;
if($w!='u') return;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('site'));
$oPing->setType('channel');
$oPing->request();
?>

View File

@ -1,37 +0,0 @@
<?php
/**
* @file include.bbs.delete.php
* @author sol (ngleader@gmail.com)
* @brief 글 삭제시 Syndication Ping
* gnuboard5/bbs/bbs.delete.php 파일에 추가
* include '../syndi/include/include.bbs.delete.php';
*/
if(!defined('_GNUBOARD_')) return;
if(!$write || !$row) return;
// 비회원 access가 불가능 한 게시판이면 pass
$sql = "select count(*) as cnt from " . $g5['board_table'] . " b, ". $g5['group_table'] . " g where b.bo_table='". $bo_table ."' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id";
$cnt_row = sql_fetch($sql);
if($cnt_row['cnt']<1) return;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
$sql = "select wr_subject from $write_table where wr_id='" .$row['wr_id'] ."'";
$subject_row = sql_fetch($sql);
$_link = './bbs/board.php?bo_table=%s&wr_id=%s';
$_sql = "insert into {$g5['syndi_log_table']} (content_id, bbs_id, title, link_alternative, delete_date) values('%s','%s','%s','%s','%s')";
sql_query(sprintf($_sql, $row['wr_id'], $bo_table, addslashes($subject_row['wr_subject']), sprintf($_link, $bo_table, $row['wr_id']), date('YmdHis')), false);
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('channel', $bo_table));
$oPing->setType('deleted');
$oPing->request();
?>

View File

@ -1,36 +0,0 @@
<?php
/**
* @file include.bbs.delete_all.php
* @author sol (ngleader@gmail.com)
* @brief 글 삭제시 Syndication Ping
* gnuboard5/bbs/bbs.delete_all.php 파일에 추가
* include '../syndi/include/include.bbs.delete_all.php';
*/
if(!defined('_GNUBOARD_')) return;
if(!$write || !$row) return;
// 비회원 access가 불가능 한 게시판이면 pass
$sql = 'select count(*) as cnt from ' . $g5['board_table'] . ' b, '. $g5['group_table'] . ' g where b.bo_table=\''. $bo_table .'\' and b.bo_read_level=1 and b.bo_list_level=1 and g.gr_use_access=0 and g.gr_id = b.gr_id';
$cnt_row = sql_fetch($sql);
if($cnt_row['cnt']<1) return;;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
$sql = "select wr_subject from $write_table where wr_id='" .$row['wr_id'] ."'";
$subject_row = sql_fetch($sql);
$_link = './bbs/board.php?bo_table=%s&wr_id=%s';
$_sql = "insert into {$g5['syndi_log_table']} (content_id, bbs_id, title, link_alternative, delete_date) values('%s','%s','%s','%s','%s')";
sql_query(sprintf($_sql, $row['wr_id'], $bo_table, addslashes($subject_row['wr_subject']), sprintf($_link, $bo_table, $row['wr_id']), date('YmdHis')), false);
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('channel', $bo_table));
$oPing->setType('deleted');
$oPing->request();
?>

View File

@ -1,39 +0,0 @@
<?php
/**
* @file include.bbs.move_update.php
* @author sol (ngleader@gmail.com)
* @brief 글 등록/수정시 Syndication Ping
* gnuboard5/bbs/move_update.php 파일에 추가
* include '../syndi/include/include.bbs.move_update.php';
*/
if(!defined('_GNUBOARD_')) return;
if($sw != 'move' && $sw != 'copy') return;
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include_once $syndi_dir . '/config/site.config.php';
include_once $syndi_dir . '/libs/SyndicationHandler.class.php';
include_once $syndi_dir . '/libs/SyndicationPing.class.php';
if($sw == "copy")
{
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('channel', $bo_table));
$oPing->setType('article');
$oPing->request();
unset($oPing);
}
for($i=0, $c=count($_POST['chk_bo_table']); $i<$c; $i++)
{
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('channel', $_POST['chk_bo_table'][$i]));
$oPing->setType('article');
$oPing->request();
unset($oPing);
}
?>

View File

@ -1,42 +0,0 @@
<?php
/**
* @file include.bbs.write_update.php
* @author sol (ngleader@gmail.com)
* @brief 글 등록/수정시 Syndication Ping
* gnuboard5/bbs/write_update.php 파일에 추가
* include '../syndi/include/include.bbs.write_update.php';
*/
if(!defined('_GNUBOARD_')) return;
if(!$board) return;
// 비밀 게시판이면 pass
if($board['bo_use_secret'] && $secret) return;
// 비회원 사용자가 볼 수 없다면 pass
if($board['bo_list_level']>1 || $board['bo_view_level']>1) return;
if($w == 'u' && $wr && !$wr['wr_id']) return;
// 수정 대상 또는 신규 입력한 id가 있다면 ping을 보냄
if($wr['wr_id'] || $wr_id)
{
$syndi_dir = realpath(dirname(__FILE__) .'/../');
// include config & Syndication Ping class
include $syndi_dir . '/config/site.config.php';
include $syndi_dir . '/libs/SyndicationHandler.class.php';
include $syndi_dir . '/libs/SyndicationPing.class.php';
$oPing = new SyndicationPing;
$oPing->setId(SyndicationHandler::getTag('channel', $board['bo_table']));
$oPing->setType('article');
// if deleted
$_sql = "delete from {$g5['syndi_log_table']} where content_id='%s' and bbs_id='%s'";
sql_query(sprintf($_sql, $wr_id ? $wr_id : $wr[wr_id], $board['bo_table']));
$oPing->request();
}
?>

View File

@ -1,12 +0,0 @@
<?php
include_once('./_common.php');
if ($is_admin != 'super') {
alert('최고관리자만 설치가 가능합니다.');
}
$sql = " CREATE TABLE IF NOT EXISTS `{$g5['syndi_log_table']}` ( `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 ";
sql_query($sql, false);
alert('신디케이션 로그 테이블을 생성했습니다.', G5_URL);
?>

View File

@ -1,137 +0,0 @@
<?php
/**
* @class SyndicationArticle
* @author sol (ngleader@gmail.com)
* @brief Syndication Article 데이타 클래스
**/
class SyndicationArticle extends SyndicationObject
{
var $node = array('id','author','category','title','content','published','updated','link_alternative','link_channel','link_channel_alternative');
/**
* @brief URI Tag
**/
function setId($id)
{
$this->id = $id;
}
/**
* @brief Author name
**/
function setName($name)
{
$this->name = $name;
}
/**
* @brief Author email
**/
function setEmail($email)
{
$this->email = $email;
}
/**
* @brief Author homepage or blog
**/
function setUrl($url)
{
$this->url = $url;
}
/**
* @brief category or tag of content
**/
function setCategory($category)
{
$this->category = $category;
}
/**
* @brief Title of content
**/
function setTitle($title)
{
$this->title = $title;
}
/**
* @brief content
**/
function setContent($content)
{
$this->content = $content;
}
/**
* @brief Syndication Content Type으로 blog 경우'blog', 일반사이트 경우 'web'
**/
function setType($type='web')
{
$this->type = $type;
}
/**
* @brief Syndication Ping Url
**/
function setLinkSelf($link_self)
{
$this->link_self = $link_self;
}
/**
* @brief Channel Syndication Ping Url
**/
function setLinkChannel($link_channel)
{
$this->link_channel = $link_channel;
}
/**
* @brief Article(게시물) 접근 Url
**/
function setLinkAlternative($link_alternative)
{
$this->link_alternative = $link_alternative;
}
/**
* @brief Channel(게시판) 접근 Url
**/
function setLinkChannelAlternative($link_channel_alternative)
{
$this->link_channel_alternative = $link_channel_alternative;
}
/**
* @brief published time
* 'YYYYMMDDHHIISS' type
**/
function setPublished($published)
{
$this->published = $published;
}
/**
* @brief update time
* 'YYYYMMDDHHIISS' type
**/
function setUpdated($updated)
{
$this->updated = $updated;
}
function __toString()
{
$str = '';
foreach($this->node as $node){
$str .= $this->get($node);
}
return $str;
}
}
?>

View File

@ -1,98 +0,0 @@
<?php
/**
* @class SyndicationChannel
* @author sol (ngleader@gmail.com)
* @brief Syndication Channel(게시판) 데이타 클래스
**/
class SyndicationChannel extends SyndicationObject
{
var $node = array('id','title','type','summary','updated','link_rss','link_alternative','link_self','link_next_in_thread');
/**
* @brief URI Tag
**/
function setId($id)
{
$this->id = $id;
}
/**
* @brief Title of Channel
**/
function setTitle($title)
{
$this->title = $title;
}
/**
* @brief Type of Channel, web or blog
* blog 일경우 setLinkRss()를 등록해야 함
**/
function setType($type='web')
{
$this->type = $type;
}
/**
* @brief Summary of Channel
**/
function setSummary($summary)
{
$this->summary = $summary;
}
/**
* @brief Syndication Ping Url
**/
function setLinkSelf($link_self)
{
$this->link_self = $link_self;
}
/**
* @brief Channel(게시판) 접근 Url
**/
function setLinkAlternative($link_alternative)
{
$this->link_alternative = $link_alternative;
}
/**
* @brief Channel RSS Url (type이 blog면 필수)
**/
function setLinkRss($link_rss)
{
$this->link_rss = $link_rss;
}
/**
* @brief 다음 페이지 Url
**/
function setNextPage($obj)
{
if(!$obj) return;
if($obj['page']>0) $this->link_next_in_thread = $this->link_self . '&page='. $obj['page'];
}
/**
* @brief update time
* 'YYYYMMDDHHIISS' type
**/
function setUpdated($updated)
{
$this->updated = $updated;
}
function __toString()
{
$str = '';
foreach($this->node as $node){
$str .= $this->get($node);
}
return $str;
}
}
?>

View File

@ -1,65 +0,0 @@
<?php
/**
* @class SyndicationDeleted
* @author sol (ngleader@gmail.com)
* @brief Syndication Delete(Article) 데이타 클래스
**/
class SyndicationDeleted extends SyndicationObject
{
var $node = array('id','title','deleted','updated','link_alternative');
/**
* @brief URI Tag
**/
function setId($id)
{
$this->id = $id;
}
/**
* @brief Title of content
**/
function setTitle($title)
{
$this->title = $title;
}
/**
* @brief update time
* 'YYYYMMDDHHIISS' type
**/
function setUpdated($updated)
{
$this->updated = $updated;
}
/**
* @brief deleted time
* 'YYYYMMDDHHIISS' type
**/
function setDeleted($deleted)
{
$this->deleted = $deleted;
}
/**
* @brief Article(게시물) 접근 Url
**/
function setLinkAlternative($link_alternative)
{
$this->link_alternative = $link_alternative;
}
function __toString()
{
$str = '';
foreach($this->node as $node){
$str .= $this->get($node);
}
return $str;
}
}
?>

View File

@ -1,346 +0,0 @@
<?php
/**
* @class SyndicationHandler
* @author sol (ngleader@gmail.com)
* @brief Syndication 데이타 출력 핸들러
**/
class SyndicationHandler
{
var $param; // GET value
var $type; // 출력 내용 : article, deleted, channel, site
var $target; // 출력 대상 : article, channel, site
var $target_channel_id; // 출력 대상 channel(게시판) 번호 또는 유닉한 문자열
var $target_content_id; // 출력 대상 article(게시물) 번호 또는 유닉한 문자열
var $register_function = array();
function &getInstance()
{
if(!$GLOBALS['__SyndicationHandler__'])
{
$GLOBALS['__SyndicationHandler__'] = new SyndicationHandler();
}
return $GLOBALS['__SyndicationHandler__'];
}
/**
* @brief initialization.
**/
function SyndicationHandler()
{
}
/**
* @brief register function
* site_info
* article_list
* deleted_list
* channel_list
* article_next_page
* deleted_next_page
* channel_next_page
**/
function checkRegisteredFunctions()
{
$ids = array('site_info','article_list','deleted_list','channel_list','article_next_page','deleted_next_page','channel_next_page');
if(count($this->register_function) != count($ids)) return false;
foreach($this->register_function as $id => $func)
{
if(!in_array($id, $ids) || !is_callable($func))
{
return false;
}
}
return true;
}
function registerFunction($id, $func)
{
$this->register_function[$id] = $func;
}
function callFunction($id)
{
if(!isset($this->register_function[$id]) || !is_callable($this->register_function[$id])) return false;
return call_user_func($this->register_function[$id], $this->param);
}
/**
* @brief set GET Value.
**/
function setArgument($args=null)
{
if(!$args) $args = $_GET;
$obj = new stdClass;
$obj->id = $args['id'];
if($args['start-time']) $obj->start_time = SyndicationHandler::getDate($args['start-time']);
if($args['end-time']) $obj->end_time = SyndicationHandler::getDate($args['end-time']);
$obj->max_entry = $args['max_entry'];
if(!$obj->max_entry) $obj->max_entry = 100;
$obj->page = $args['page'];
if(!$obj->page) $obj->page = 1;
$obj->type = $args['type'];
// for getting all article on mysql 3.X, 4.0.X
if($args['channel_id']) $obj->channel_id = $args['channel_id'];
$this->param = $obj;
$this->parseTag();
}
/**
* @brief parsing id value(Tag URI)
**/
function parseTag()
{
// tag:domain,{YYYY}:site:
// tag:domain,{YYYY}:channel:{channel_id}
// tag:domain,{YYYY}:article:{channel_id}-{$article_id}
if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$this->param->id,$matches)) return;
$this->target = $matches[3];
$id = $matches[4];
if($id && $id{0}==':') $id = substr($id, 1);
switch($this->target)
{
case 'site':
break;
case 'channel':
if(!$id)
{
$this->target = $this->target_channel_id = $this->target_content_id = null;
return;
}
$this->target_channel_id = $id;
break;
case 'article':
if($id && strpos($id,'-')!==false)
{
list($this->target_channel_id, $this->target_content_id) = explode('-',$id);
if(!$this->target_content_id)
{
$this->target = $this->target_channel_id = $this->target_content_id = null;
return;
}
}
else
{
$this->target = $this->target_channel_id = $this->target_content_id = null;
return;
}
break;
}
if($this->target_channel_id) $this->param->target_channel_id = $this->target_channel_id;
if($this->target_content_id) $this->param->target_content_id = $this->target_content_id;
}
/**
* @brief xml for Syndication Server
**/
function getXML()
{
if(!$this->checkRegisteredFunctions()) return '';
switch($this->target)
{
// in site
case 'site':
// get Site info
$oSite = $this->callFunction('site_info');
if(!$oSite) return '';
$list_xml = '';
if(in_array($this->param->type,array('article','deleted','channel')))
{
$list = $this->callFunction($this->param->type . '_list');
if(!$list) $list = array();
$obj = $this->callFunction($this->param->type . '_next_page');
if($obj) $oSite->setNextPage($obj);
foreach($list as $oObject)
{
$list_xml .= $oObject->wrapEntry($oObject->__toString());
}
$xml = $oSite->__toString();
$xml = $oSite->wrapFeed($xml . $list_xml);
}
else
{
$xml = $oSite->__toString();
$xml = $oSite->wrapEntry($xml . $list_xml, true);
}
break;
// in channel
case 'channel':
// get Channel info
$oChannelList = $this->callFunction('channel_list');
if(!is_array($oChannelList) || count($oChannelList)==0) return '';
$oChannel = $oChannelList[0];
$list_xml = '';
if($this->target_channel_id && in_array($this->param->type,array('article','deleted')))
{
$list = $this->callFunction($this->param->type . '_list');
if(is_array($list) && count($list))
{
$obj = $this->callFunction($this->param->type . '_next_page');
if($obj) $oChannel->setNextPage($obj);
foreach($list as $oObject)
{
$list_xml .= $oObject->wrapEntry($oObject->__toString());
}
}
$xml = $oChannel->__toString();
$xml = $oChannel->wrapFeed($xml . $list_xml);
}
else
{
$xml = $oChannel->__toString();
$xml = $oChannel->wrapEntry($xml . $list_xml, true);
}
break;
// article info
case 'article':
if(in_array($this->param->type,array('article','deleted')))
{
$list = $this->callFunction($this->param->type . '_list');
}
if(!is_array($list) || count($list)==0) return '';
$oObject = $list[0];
$xml = $oObject->__toString();
$xml = $oObject->wrapEntry($xml, true);
break;
}
if(!$GLOBALS['syndi_from_encoding']) $GLOBALS['syndi_from_encoding'] = 'utf-8';
if($xml && strtolower($GLOBALS['syndi_from_encoding']) != 'utf-8' && function_exists('iconv'))
{
$xml = iconv($GLOBALS['syndi_from_encoding'], 'utf-8//IGNORE', $xml);
}
return $xml;
}
/**
* @brief Tag URI
**/
function getTag($type, $channel_id=null, $article_id=null)
{
$tag = sprintf('tag:%s,%s:%s'
,$GLOBALS['syndi_tag_domain']
,$GLOBALS['syndi_tag_year']
,$type);
if($type=='channel' && $channel_id)
{
$tag .= ':' . $channel_id;
}
else if($type=='article' && $channel_id && $article_id)
{
$tag .= ':' .$channel_id .'-' . $article_id;
}
return $tag;
}
/**
* @brief Timestamp 로 YYYYMMDDHHIISS 변환
**/
function getDate($timestamp)
{
$time = strtotime($timestamp);
if($time == -1) $time = SyndicationHandler::ztime(str_replace(array('-','T',':'),'',$timestamp));
return date('YmdHis', $time);
}
/**
* @brief YYYYMMDDHHIISS에서 Timestamp로 변환
**/
function getTimestamp($date)
{
$time = mktime(substr($date,8,2),substr($date,10,2),substr($date,12,2),substr($date,4,2),substr($date,6,2),substr($date,0,4));
$timestamp = date("Y-m-d\\TH:i:s", $time). $GLOBALS['syndi_time_zone'];
return $timestamp;
}
function ztime($str)
{
if(!$str) return;
$hour = (int)substr($str,8,2);
$min = (int)substr($str,10,2);
$sec = (int)substr($str,12,2);
$year = (int)substr($str,0,4);
$month = (int)substr($str,4,2);
$day = (int)substr($str,6,2);
if(strlen($str) <= 8)
{
$gap = 0;
}
else
{
$gap = SyndicationHandler::zgap();
}
return mktime($hour, $min, $sec, $month?$month:1, $day?$day:1, $year)+$gap;
}
function zgap()
{
$time_zone = $GLOBALS['syndi_time_zone'];
if($time_zone < 0) $to = -1; else $to = 1;
$t_hour = substr($time_zone, 1, 2) * $to;
$t_min = substr($time_zone, 3, 2) * $to;
$server_time_zone = date("O");
if($server_time_zone < 0) $so = -1; else $so = 1;
$c_hour = substr($server_time_zone, 1, 2) * $so;
$c_min = substr($server_time_zone, 3, 2) * $so;
$g_min = $t_min - $c_min;
$g_hour = $t_hour - $c_hour;
$gap = $g_min*60 + $g_hour*60*60;
return $gap;
}
function error($msg)
{
echo $msg;
exit;
}
}
?>

View File

@ -1,104 +0,0 @@
<?php
/**
* @class SyndicationObject
* @author sol (ngleader@gmail.com)
* @brief Syndication 데이타 타입의 상위 클래스
**/
class SyndicationObject
{
var $id;
var $title;
var $content;
var $summary;
var $author;
var $name;
var $email;
var $url;
var $published;
var $updated;
var $deleted;
var $type;
var $link_self;
var $link_alternative;
var $link_rss;
var $link_channel;
var $link_channel_alternative;
var $link_next_in_thread;
function SyndicationXml()
{
}
function get($node_name)
{
$node = array('id','author','name','email','url','title','type','summary','content','published','deleted','updated','link_rss','link_alternative','link_self','link_channel','link_channel_alternative','link_next_in_thread');
if(!in_array($node_name, $node)) return '';
if($node_name == 'author')
{
$str = "<author>\n";
$str .= $this->get('name');
$str .= $this->get('email');
$str .= $this->get('url');
$str .= "</author>\n";
return $str;
}
$value = $this->{$node_name};
if(!$value) return '';
if(strpos($node_name,'link_')!==false)
{
$type = str_replace('_','-',substr($node_name, strlen('link_')));
return "<link rel=\"".$type."\" href=\"".htmlspecialchars($value)."\" />\n";
}
if(in_array($node_name,array('published','deleted','updated')))
{
$value = $this->_getTime($value);
}
return sprintf("<%s>%s</%s>\n", $node_name, htmlspecialchars($value) ,$node_name);
}
function _getTime($time)
{
return SyndicationHandler::getTimestamp($time);
}
function wrapFeed($str)
{
$return = '<?xml version="1.0" encoding="utf-8"?>';
$return .= "\n";
$return .= '<feed xmlns="http://www.w3.org/2005/Atom">';
$return .= "\n";
$return .= $str;
$return .= "</feed>";
return $return;
}
function wrapEntry($str, $xml_info=false)
{
if($xml_info)
{
$return = '<?xml version="1.0" encoding="utf-8"?>';
$return .= "\n";
$return .= '<entry xmlns="http://www.w3.org/2005/Atom">';
$return .= "\n";
}
else
{
$return .= "<entry>\n";
}
$return .= $str;
$return .= "</entry>\n";
return $return;
}
}
?>

View File

@ -1,105 +0,0 @@
<?php
/**
* @class SyndicationPing
* @author sol (ngleader@gmail.com)
* @brief Syndication Ping Request 클래스
**/
class SyndicationPing
{
// Ping Server
var $ping_host = 'syndication.openapi.naver.com';
var $client;
var $type = 'article';
var $id;
var $start_time;
var $end_time;
var $max_entry;
var $page;
function setId($id)
{
$this->id = $id;
}
function setType($type)
{
$this->type = $type;
}
function setStartTime($start_time)
{
if($start_time)
{
$this->start_time = $this->_convertTime($start_time);
}
}
function setEndTime($end_time)
{
if($end_time)
{
$this->end_time = $this->_convertTime($end_time);
}
}
function _convertTime($time)
{
return str_replace('+','%2b',$time);
}
function setMaxEntry($max_entry)
{
if($max_entry > 0 && $max_entry <= 10000)
{
$this->max_entry = $max_entry;
}
}
function setPage($page)
{
if($page > 0 && $page <= 10000)
{
$this->page = $page;
}
}
function getBody()
{
$str = $GLOBALS['syndi_echo_url'];
$str .= '?id=' . $this->id;
$str .= '&type=' . $this->type;
if($this->start_time && $this->end_time)
{
$str .= '&start_time=' . $this->start_time;
$str .= '&end_time=' . $this->end_time;
}
if($this->max_entry) $str .= '&max_entry=' . $this->max_entry;
if($this->page) $str .= '&page=' . $this->page;
return 'link='.urlencode($str);
}
function request()
{
$body = $this->getBody();
if(!$body) return false;
$header = "POST /ping/ HTTP/1.0\r\n".
"User-Agent: request\r\n".
"Host: " . $this->ping_host . "\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: ". strlen($body) ."\r\n".
"\r\n".
$body;
$fp = @fsockopen($this->ping_host, '80', $errno, $errstr, 5);
if(!$fp) return false;
fputs($fp, $header);
fclose($fp);
return true;
}
}
?>

View File

@ -1,74 +0,0 @@
<?php
/**
* @class SyndicationSite
* @author sol (ngleader@gmail.com)
* @brief Syndication Site 정보 클래스
**/
class SyndicationSite extends SyndicationObject
{
var $node = array('id','title','link_self','link_alternative','link_next_in_thread','updated');
/**
* @brief URI Tag
**/
function setId($id)
{
$this->id = $id;
}
/**
* @brief Title of Site
**/
function setTitle($title)
{
$this->title = $title;
}
/**
* @brief Syndication Ping Url
**/
function setLinkSelf($link_self)
{
$this->link_self = $link_self;
}
/**
* @brief 접근 Url
**/
function setLinkAlternative($link_alternative)
{
$this->link_alternative = $link_alternative;
}
/**
* @brief 다음 페이지 Url
**/
function setNextPage($obj)
{
if(!$obj) return;
if($obj['page']>0) $this->link_next_in_thread = $this->link_self . '&page='. $obj['page'];
if($obj['channel_id']) $this->link_next_in_thread .= '&channel_id='. $obj['channel_id'];
}
/**
* @brief update time
* 'YYYYMMDDHHIISS' type
**/
function setUpdated($updated)
{
$this->updated = $updated;
}
function __toString()
{
$str = '';
foreach($this->node as $node){
$str .= $this->get($node);
}
return $str;
}
}
?>

View File

@ -1,77 +0,0 @@
<?php
/**
* @class SyndicationStatus
* @author sol (ngleader@gmail.com)
* @brief Syndication 상태 정보 클래스
**/
class SyndicationStatus
{
// Status Server
var $status_host = 'syndication.openapi.naver.com';
var $site;
function setSite($site)
{
$this->site = $site;
}
function request()
{
if(!$this->site) return false;
$header = "GET /status/?site=".$this->site." HTTP/1.0\r\n".
"Host: " . $this->status_host . "\r\n\r\n";
$fp = @fsockopen($this->status_host, '80', $errno, $errstr);
if(!$fp) return false;
$output = '';
fputs($fp, $header);
while(!feof($fp)){
$output .= fgets($fp, 1024);
}
fclose($fp);
$output = substr($output, strpos($output, "\r\n\r\n")+4);
return $this->_parse($output);
}
function _parse($data)
{
preg_match_all('@\<([a-z_0-9=\" ]+)\>([^\<]+)\</@', $data, $matches);
if(!$matches[2]) return false;
$output = array('article'=>array());
for($i=0,$c=count($matches[0]);$i<$c;$i++){
if(strpos($matches[1][$i], 'date="')!==false){
$date = substr($matches[1][$i],14,8);
$output['article'][$date] = $matches[2][$i];
}else{
$output[$matches[1][$i]] = $matches[2][$i];
}
}
return $output;
}
}
/*
$oStatus = new SyndicationStatus;
$oStatus->setSite('domain.com');
$output = $oStatus->request();
$output data fields
error : 0이 아닌 경우 에러
message : 에러 메세지
site_url : site url
site_name : site name
first_update : Syndication 서버에 처음 등록된 시간
last_update : Syndication 서버에 최근 갱신 시간
status : site 상태
visit_ok_count : ping 연속 성공 횟수
visit_fail_count : ping 실패 횟수
*/
?>

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>";
?>

View File

@ -1,39 +0,0 @@
<?php
include_once('./_common.php');
/**
* @file syndi_echo.php
* @author sol (ngleader@gmail.com)
* @brief Print Syndication Data XML
*/
header('Content-Type: text/html; charset=UTF-8');
header('Pragma: no-cache');
if(version_compare(PHP_VERSION, '5.3.0') >= 0)
{
date_default_timezone_set(@date_default_timezone_get());
}
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
$syndi_path = dirname(__FILE__);
// include class
include $syndi_path . '/libs/SyndicationHandler.class.php';
include $syndi_path . '/libs/SyndicationObject.class.php';
include $syndi_path . '/libs/SyndicationSite.class.php';
include $syndi_path . '/libs/SyndicationChannel.class.php';
include $syndi_path . '/libs/SyndicationArticle.class.php';
include $syndi_path . '/libs/SyndicationDeleted.class.php';
// config & custom func for site
include $syndi_path . '/config/site.config.php';
include $syndi_path . '/func/site.func.php';
$oSyndicationHandler = &SyndicationHandler::getInstance();
$oSyndicationHandler->setArgument();
echo $oSyndicationHandler->getXML();
?>