From 88bd5f049ba15c20a3dd735aa3f949183f3f0446 Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 10 Jul 2007 01:36:42 +0000 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9D=B4=ED=8A=B8=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20RSS=20=EB=B0=9C=ED=96=89.=20=EB=AA=A8=EB=93=A0=20mi?= =?UTF-8?q?d=EB=A5=BC=20=EC=B2=B4=ED=81=AC=ED=95=98=EC=97=AC=20open=5Frss?= =?UTF-8?q?=EA=B0=80=20Y=EB=98=90=EB=8A=94=20H=EC=9D=B8=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EC=97=90=EB=A7=8C=20=EA=B8=80=EC=9D=84=20=EC=B0=BE?= =?UTF-8?q?=EC=95=84=EC=84=9C=20RSS=EB=A1=9C=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/trunk@1886 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .htaccess | 3 ++ modules/module/queries/getMidList.xml | 1 + modules/rss/rss.view.php | 77 ++++++++++++++++++++------- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/.htaccess b/.htaccess index be494f455..3a01d6cdf 100644 --- a/.htaccess +++ b/.htaccess @@ -3,6 +3,9 @@ RewriteEngine On # page 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 RewriteRule ^admin$ ./index.php?module=admin [L] diff --git a/modules/module/queries/getMidList.xml b/modules/module/queries/getMidList.xml index a1da1a6be..164a84080 100644 --- a/modules/module/queries/getMidList.xml +++ b/modules/module/queries/getMidList.xml @@ -8,6 +8,7 @@ + diff --git a/modules/rss/rss.view.php b/modules/rss/rss.view.php index d66716601..487a88c5c 100644 --- a/modules/rss/rss.view.php +++ b/modules/rss/rss.view.php @@ -22,39 +22,78 @@ function rss() { // RSS를 출력하고자 하는 mid를 구함 (없으면 오류) $mid = Context::get('mid'); - if(!$mid) return $this->dispError(); - // 모듈의 설정 정보를 받아옴 (module model 객체를 이용) $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByMid($mid); - if($module_info->mid != $mid) return $this->dispError(); + $mid_list = array(); - // RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력 - if($module_info->open_rss == 'N') return $this->dispError(); + // mid값이 없으면 전체 mid중 open_rss == 'Y|H'인 걸 고름 + 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; - $args->page = Context::get('page'); - $args->list_count = 20; + // 대상 모듈을 정리함 + $module_srl_list = array(); + foreach($module_list as $mid => $val) { + $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->search_target = Context::get('search_target'); $args->search_keyword = Context::get('search_keyword'); if($module_info->use_category=='Y') $args->category_srl = Context::get('category'); $args->sort_index = 'list_order'; + $args->order_type = 'asc'; + // 대상 문서들을 가져옴 $oDocumentModel = &getModel('document'); $output = $oDocumentModel->getDocumentList($args); $document_list = $output->data; // rss 제목 및 정보등을 추출 - $info->title = Context::getBrowserTitle(); - $info->description = $this->module_info->description; - $info->language = Context::getLangType(); - $info->date = gmdate("D, d M Y H:i:s"); - $info->link = getUrl('','mid',Context::get('mid')); + if($this->mid) { + $info->title = Context::getBrowserTitle(); + $info->description = $this->module_info->description; + $info->link = getUrl('','mid',Context::get('mid')); + } else { + $info->title = $info->link = Context::getRequestUri(); + } $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)) { $idx = 0; foreach($document_list as $key => $item) { @@ -70,8 +109,10 @@ $item->link = $item->getPermanentUrl(); $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(); // 요약 공개일 경우 } else { @@ -80,7 +121,7 @@ $item->date = gmdate("D, d M Y H:i:s", $time); $content[$idx++] = $item; } - } + } else return $this->dispError(); // RSS 출력물에서 사용될 변수 세팅 Context::set('info', $info);