git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-12 03:59:52 +00:00
commit 8326004cb2
2773 changed files with 91485 additions and 0 deletions

17
modules/rss/conf/info.xml Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">RSS</title>
<title xml:lang="zh-CN">RSS</title>
<title xml:lang="jp">RSS</title>
<title xml:lang="en">RSS</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="zh-CN">zero</name>
<name xml:lang="jp">Zero</name>
<name xml:lang="en">zero</name>
<description xml:lang="ko">RSS 출력을 담당하는 모듈</description>
<description xml:lang="zh-CN">负责输出RSS的模块。</description>
<description xml:lang="jp">RSS出力を担うモジュールです。</description>
<description xml:lang="en">This modules is for printing RSS.</description>
</author>
</module>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<actions>
<action name="rss" type="view" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,18 @@
<?php
/**
* @file modules/rss/lang/en.lang.php
* @author zero <zero@nzeo.com>
* @brief English language pack (basic)
**/
// general words
$lang->rss_disable = "Disable RSS";
$lang->rss_type = "RSS feed type";
// for description
$lang->about_rss_disable = "If checked, RSS will be disabled.";
$lang->about_rss_type = "You can assign RSS feed type.";
// for error message
$lang->msg_rss_is_disabled = "RSS function is disabled.";
?>

View file

@ -0,0 +1,18 @@
<?php
/**
* @file modules/rss/lang/jp.lang.php
* @author zero <zero@nzeo.com> 翻訳RisaPapa
* @brief 日本語言語パッケージ(基本的な内容のみ)
**/
// 一般用語
$lang->rss_disable = "RSS機能ロック";
$lang->rss_type = "出力するRSSタイプ";
// 説明文
$lang->about_rss_disable = "チェックするとRSSの出力を行いません。";
$lang->about_rss_type = "出力するRSSタイプを指定することができます。";
// エラーメッセージ
$lang->msg_rss_is_disabled = "RSS機能がロックされています。";
?>

View file

@ -0,0 +1,18 @@
<?php
/**
* @file modules/rss/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 한국어 언어팩 (기본적인 내용만 수록)
**/
// 일반 단어들
$lang->rss_disable = "RSS 끄기";
$lang->rss_type = "출력할 RSS 형식";
// 설명문
$lang->about_rss_disable = "체크하시면 RSS 출력을 하지 않습니다";
$lang->about_rss_type = "출력하실 RSS 형식을 지정하실 수 있습니다";
// 에러 메세지들
$lang->msg_rss_is_disabled = "RSS 기능이 잠겨 있습니다";
?>

View file

@ -0,0 +1,18 @@
<?php
/**
* @file modules/rss/lang/zh-CN.lang.php
* @author zero <zero@nzeo.com>
* @brief 简体中文语言包 (只收录基本内容)
**/
// 一般单词
$lang->rss_disable = "关闭RSS";
$lang->rss_type = "将显示的RSS形式";
// 说明文
$lang->about_rss_disable = "选此项不显示RSS。";
$lang->about_rss_type = "可以指定要显示的RSS形式。";
// 错误提示
$lang->msg_rss_is_disabled = "RSS功能处于锁定状态。";
?>

36
modules/rss/rss.class.php Normal file
View file

@ -0,0 +1,36 @@
<?php
/**
* @class rss
* @author zero (zero@nzeo.com)
* @brief rss module의 view class
**/
class rss extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
// action forward에 등록
$oModuleController = &getController('module');
$oModuleController->insertActionForward('rss', 'view', 'rss');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object();
}
}
?>

142
modules/rss/rss.view.php Normal file
View file

@ -0,0 +1,142 @@
<?php
/**
* @class rssView
* @author zero (zero@nzeo.com)
* @brief rss module의 view class
*
* RSS 2.0형식으로 문서 출력
*
**/
class rssView extends rss {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief RSS 출력
**/
function rss() {
/**
* RSS 출력을 위한 변수 설정
**/
$mid = Context::get('mid'); ///< 대상 모듈 id, 없으면 전체로
$page = (int)Context::get('page'); ///< 페이지, 없으면 1
if(!$page) $page = 1;
$list_count = (int)Context::get('list_count'); ///< 목록 갯수, 기본 20, 최고 100개
if(!$list_count|| $list_count>100) $list_count = 20;
$start_date = Context::get('start_date'); ///< 시작 일자, 없으면 무시
if(strlen($start_date)!=14 || !ereg("^([0-9]){14}$", $start_date) ) unset($start_date);
$end_date = Context::get('end_date'); ///< 종료 일자, 없으면 무시
if(strlen($end_date)!=14 || !ereg("^([0-9]){14}$", $end_date) ) unset($end_date);
/**
* 요청된 모듈 혹은 전체 모듈의 정보를 구하고 open_rss의 값을 체크
**/
$oModuleModel = &getModel('module');
$mid_list = array();
// mid값이 없으면 전체 mid중 open_rss == 'Y|H'인 걸 고름
if(!$mid) {
$args->open_rss = "'Y','H'";
$module_list = $oModuleModel->getMidList($args);
if(!$module_list) return $this->dispError();
// 대상 모듈을 정리함
$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);
}
/**
* 출력할 컨텐츠 추출을 위한 인자 정리
**/
$args->module_srl = $module_srl;
$args->page = $page;
$args->list_count = $list_count;
$args->page_count = 10;
if($start_date) $args->start_date = $start_date;
if($end_date) $args->end_date = $end_date;
$args->sort_index = 'last_update';
$args->order_type = 'desc';
// 대상 문서들을 가져옴
$oDocumentModel = &getModel('document');
$output = $oDocumentModel->getDocumentList($args);
$document_list = $output->data;
// rss 제목 및 정보등을 추출
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->total_page = $output->total_page;
$info->date = gmdate("D, d M Y H:i:s");
$info->language = Context::getLangType();
// RSS 출력물에서 사용될 변수 세팅
Context::set('info', $info);
Context::set('mid_list', $mid_list);
Context::set('document_list', $document_list);
// 결과 출력을 XMLRPC로 강제 지정
Context::setResponseMethod("XMLRPC");
// 템플릿 파일 지정
$this->setTemplatePath($this->module_path.'tpl/');
if($args->start_date || $args->end_date) $this->setTemplateFile('xe_rss');
else $this->setTemplateFile('rss20');
}
/**
* @brief 에러 출력
**/
function dispError() {
// 결과 출력을 XMLRPC로 강제 지정
Context::setResponseMethod("XMLRPC");
// 출력 메세지 작성
Context::set('error', -1);
Context::set('message', Context::getLang('msg_rss_is_disabled') );
// 템플릿 파일 지정
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile("error");
}
}
?>

View file

@ -0,0 +1,5 @@
{'<?xml version="1.0" encoding="utf-8" ?>'}
<response>
<error>{$error}</error>
<message><![CDATA[{$message}]]></message>
</response>

View file

@ -0,0 +1,7 @@
<filter name="insert_config" module="rss" act="procRssAdminInsertConfig" confirm_msg_code="confirm_submit">
<form />
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -0,0 +1,32 @@
<!--%import("filter/insert_config.xml")-->
<form action="./" method="get" onsubmit="return procFilter(this, insert_config)">
<table border="1">
<tr>
<th rowspan="2">{$lang->rss_disable}</th>
<td><input type="checkbox" name="rss_disable" value="Y" <!--@if($config->rss_disable=="Y")-->checked="checked"<!--@end--> />
</tr>
<tr>
<td>{$lang->about_rss_disable}</td>
</tr>
<tr>
<th rowspan="2">{$lang->rss_type}</th>
<td>
<select name="rss_type">
<!--@foreach($rss_types as $key => $val)-->
<option value="{$key}" <!--@if($key==$config->rss_type)-->selected="selected"<!--@end-->>{$val}</option>
<!--@end-->
</select>
</td>
</tr>
<tr>
<td>{$lang->about_rss_type}</td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,27 @@
{'<?xml version="1.0" encoding="utf-8" ?>'}
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" >
<channel rdf:about="http://blog.rss.naver.com/blogRss.nhn?blogId=myyami78&amp;rss=1.0">
<title><![CDATA[{$info->title}]]></title>
<link><![CDATA[{$info->link}]]></link>
<description><![CDATA[{$info->description}]]></description>
<items>
<rdf:Seq>
<!--@foreach($content as $key => $item)-->
<rdf:li resource="{$key}" />
<!--@end-->
</rdf:Seq>
</items>
<dc:date>{$info->date}</dc:date>
<dc:language>{$info->language}</dc:language>
<totalCount>{$info->total_count}</totalCount>
</channel>
<!--@foreach($content as $key => $item)-->
<item rdf:about="{$key}">
<title><![CDATA[{$item->title}]]></title>
<link><![CDATA[{$item->link}]]></link>
<description><![CDATA[{$item->description}]]></description>
<dc:date>{$item->date}</dc:date>
</item>
<!--@end-->
</rdf:RDF>

View file

@ -0,0 +1,25 @@
{'<?xml version="1.0" encoding="utf-8" ?>'}
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
<channel>
<title><![CDATA[{$info->title}]]></title>
<link><![CDATA[{$info->link}]]></link>
<description><![CDATA[{$info->description}]]></description>
<language>{$info->language}</language>
<pubDate>{$info->date}</pubDate>
<totalCount>{$info->total_count}</totalCount>
<!--@foreach($document_list as $oDocument)-->
<item>
<title><![CDATA[{$oDocument->getTitleText()}]]></title>
<author><![CDATA[{$oDocument->getNickName()}]]></author>
<link><![CDATA[{$oDocument->getPermanentUrl()}]]></link>
<!--@if($mid_list[$oDocument->get('module_srl')]->open_rss=='Y')-->
<description><![CDATA[{$oDocument->getContent(false)}]]></description>
<!--@else-->
<description><![CDATA[{$oDocument->getContentText(100)}]]></description>
<!--@end-->
<pubDate>{$oDocument->getRegdateGM()}</pubDate>
</item>
<!--@end-->
</channel>
</rss>

View file

@ -0,0 +1,30 @@
{'<?xml version="1.0" encoding="utf-8" ?>'}
<rss version="1.0">
<channel>
<title><![CDATA[{$info->title}]]></title>
<link><![CDATA[{$info->link}]]></link>
<description><![CDATA[{$info->description}]]></description>
<language>{$info->language}</language>
<pubDate>{$info->date}</pubDate>
<totalCount>{$info->total_count}</totalCount>
<totalPage>{$info->total_page}</totalPage>
<!--@foreach($document_list as $oDocument)-->
<item>
<title><![CDATA[{$oDocument->getTitleText()}]]></title>
<author><![CDATA[{$oDocument->getNickName()}]]></author>
<link><![CDATA[{$oDocument->getPermanentUrl()}]]></link>
<!--@if($mid_list[$oDocument->get('module_srl')]->open_rss=='Y')-->
<description><![CDATA[{$oDocument->getContent(false)}]]></description>
<!--@else-->
<description><![CDATA[{$oDocument->getContentText(100)}]]></description>
<!--@end-->
<tags><![CDATA[{$oDocument->get('tags')}]]></tags>
<comment_count>{$oDocument->getCommentCount()}</comment_count>
<trackback_count>{$oDocument->getTrackbackCount()}</trackback_count>
<pubDate>{$oDocument->getRegdateGM()}</pubDate>
<upDate>{$oDocument->getUpdateGM()}</upDate>
</item>
<!--@end-->
</channel>
</rss>