mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 09:09:59 +09:00
사이트 전체 RSS 발행. 모든 mid를 체크하여 open_rss가 Y또는 H인 경우에만 글을 찾아서 RSS로 출력
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1886 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
03eaa01d56
commit
88bd5f049b
3 changed files with 63 additions and 18 deletions
|
|
@ -3,6 +3,9 @@ RewriteEngine On
|
||||||
# page
|
# page
|
||||||
RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L]
|
RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L]
|
||||||
|
|
||||||
|
# total rss
|
||||||
|
RewriteRule ^rss$ ./index.php?module=rss&act=rss [L]
|
||||||
|
|
||||||
# administrator page
|
# administrator page
|
||||||
RewriteRule ^admin$ ./index.php?module=admin [L]
|
RewriteRule ^admin$ ./index.php?module=admin [L]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<conditions>
|
<conditions>
|
||||||
<condition operation="equal" column="module_category_srl" var="module_category_srl" />
|
<condition operation="equal" column="module_category_srl" var="module_category_srl" />
|
||||||
<condition operation="equal" column="module" var="module" pipe="and" />
|
<condition operation="equal" column="module" var="module" pipe="and" />
|
||||||
|
<condition operation="in" column="open_rss" var="open_rss" pipe="and" />
|
||||||
</conditions>
|
</conditions>
|
||||||
<navigation>
|
<navigation>
|
||||||
<index var="sort_index" default="mid" order="asc" />
|
<index var="sort_index" default="mid" order="asc" />
|
||||||
|
|
|
||||||
|
|
@ -22,39 +22,78 @@
|
||||||
function rss() {
|
function rss() {
|
||||||
// RSS를 출력하고자 하는 mid를 구함 (없으면 오류)
|
// RSS를 출력하고자 하는 mid를 구함 (없으면 오류)
|
||||||
$mid = Context::get('mid');
|
$mid = Context::get('mid');
|
||||||
if(!$mid) return $this->dispError();
|
|
||||||
|
|
||||||
// 모듈의 설정 정보를 받아옴 (module model 객체를 이용)
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$module_info = $oModuleModel->getModuleInfoByMid($mid);
|
$mid_list = array();
|
||||||
if($module_info->mid != $mid) return $this->dispError();
|
|
||||||
|
|
||||||
// RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력
|
// mid값이 없으면 전체 mid중 open_rss == 'Y|H'인 걸 고름
|
||||||
if($module_info->open_rss == 'N') return $this->dispError();
|
if(!$mid) {
|
||||||
|
$args->open_rss = "'Y','H'";
|
||||||
|
$module_list = $oModuleModel->getMidList($args);
|
||||||
|
if(!$module_list) return $this->dispError();
|
||||||
|
|
||||||
// 출력할 컨텐츠 추출
|
// 대상 모듈을 정리함
|
||||||
$args->module_srl = $module_info->module_srl;
|
$module_srl_list = array();
|
||||||
$args->page = Context::get('page');
|
foreach($module_list as $mid => $val) {
|
||||||
$args->list_count = 20;
|
$module_srl_list[] = $val->module_srl;
|
||||||
|
$mid_list[$val->module_srl] = $val;
|
||||||
|
}
|
||||||
|
if(!count($module_srl_list)) return $this->dispError();
|
||||||
|
unset($output);
|
||||||
|
unset($args);
|
||||||
|
|
||||||
|
$module_srl = implode(',',$module_srl_list);
|
||||||
|
|
||||||
|
// 있으면 해당 모듈의 정보를 구함
|
||||||
|
} else {
|
||||||
|
// 모듈의 설정 정보를 받아옴 (module model 객체를 이용)
|
||||||
|
$module_info = $oModuleModel->getModuleInfoByMid($mid);
|
||||||
|
if($module_info->mid != $mid) return $this->dispError();
|
||||||
|
|
||||||
|
// RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력
|
||||||
|
if($module_info->open_rss == 'N') return $this->dispError();
|
||||||
|
|
||||||
|
$module_srl = $module_info->module_srl;
|
||||||
|
$mid_list[$module_info->module_srl] = $module_info;
|
||||||
|
|
||||||
|
unset($args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 변수 설정
|
||||||
|
$page = (int)Context::get('page');
|
||||||
|
if(!$page) $page = 1;
|
||||||
|
$list_count = (int)Context::get('list_count');
|
||||||
|
if(!$list_count|| $list_count>100) $list_count = 100;
|
||||||
|
|
||||||
|
// 출력할 컨텐츠 추출을 위한 인자 정리
|
||||||
|
$args->module_srl = $module_srl;
|
||||||
|
$args->page = $page;
|
||||||
|
$args->list_count = $list_count;
|
||||||
$args->page_count = 10;
|
$args->page_count = 10;
|
||||||
|
|
||||||
$args->search_target = Context::get('search_target');
|
$args->search_target = Context::get('search_target');
|
||||||
$args->search_keyword = Context::get('search_keyword');
|
$args->search_keyword = Context::get('search_keyword');
|
||||||
if($module_info->use_category=='Y') $args->category_srl = Context::get('category');
|
if($module_info->use_category=='Y') $args->category_srl = Context::get('category');
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
|
$args->order_type = 'asc';
|
||||||
|
|
||||||
|
// 대상 문서들을 가져옴
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$output = $oDocumentModel->getDocumentList($args);
|
$output = $oDocumentModel->getDocumentList($args);
|
||||||
$document_list = $output->data;
|
$document_list = $output->data;
|
||||||
|
|
||||||
// rss 제목 및 정보등을 추출
|
// rss 제목 및 정보등을 추출
|
||||||
$info->title = Context::getBrowserTitle();
|
if($this->mid) {
|
||||||
$info->description = $this->module_info->description;
|
$info->title = Context::getBrowserTitle();
|
||||||
$info->language = Context::getLangType();
|
$info->description = $this->module_info->description;
|
||||||
$info->date = gmdate("D, d M Y H:i:s");
|
$info->link = getUrl('','mid',Context::get('mid'));
|
||||||
$info->link = getUrl('','mid',Context::get('mid'));
|
} else {
|
||||||
|
$info->title = $info->link = Context::getRequestUri();
|
||||||
|
}
|
||||||
$info->total_count = $output->total_count;
|
$info->total_count = $output->total_count;
|
||||||
|
$info->date = gmdate("D, d M Y H:i:s");
|
||||||
|
$info->language = Context::getLangType();
|
||||||
|
|
||||||
|
// rss2.0으로 출력
|
||||||
if(count($document_list)) {
|
if(count($document_list)) {
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
foreach($document_list as $key => $item) {
|
foreach($document_list as $key => $item) {
|
||||||
|
|
@ -70,8 +109,10 @@
|
||||||
$item->link = $item->getPermanentUrl();
|
$item->link = $item->getPermanentUrl();
|
||||||
$item->title = $item->getTitleText();
|
$item->title = $item->getTitleText();
|
||||||
|
|
||||||
|
$module_srl = $item->get('module_srl');
|
||||||
|
|
||||||
// 전문 공개일 경우
|
// 전문 공개일 경우
|
||||||
if($module_info->open_rss=='Y') {
|
if($mid_list[$module_srl]->open_rss=='Y') {
|
||||||
$item->description = $item->getContent();
|
$item->description = $item->getContent();
|
||||||
// 요약 공개일 경우
|
// 요약 공개일 경우
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -80,7 +121,7 @@
|
||||||
$item->date = gmdate("D, d M Y H:i:s", $time);
|
$item->date = gmdate("D, d M Y H:i:s", $time);
|
||||||
$content[$idx++] = $item;
|
$content[$idx++] = $item;
|
||||||
}
|
}
|
||||||
}
|
} else return $this->dispError();
|
||||||
|
|
||||||
// RSS 출력물에서 사용될 변수 세팅
|
// RSS 출력물에서 사용될 변수 세팅
|
||||||
Context::set('info', $info);
|
Context::set('info', $info);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue