git-svn-id: http://xe-core.googlecode.com/svn/trunk@2339 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-12 04:10:31 +00:00
parent 4e9eaaf97a
commit c1fd55eb32
12 changed files with 0 additions and 543 deletions

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">TatterTools 데이터 이전</title>
<title xml:lang="zh-CN">TatterTools 数据导入</title>
<title xml:lang="jp">TTデータ移転</title>
<title xml:lang="en">Transfer data from TatterTools</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">
태터툴즈의 백업파일을 제로보드XE에 입력을 하는 모듈입니다.
첨부파일 포함하지 않은 백업파일이 필요합니다.
첨부파일은 원주소에서 직접 다운로드를 하게 됩니다.
</description>
<description xml:lang="zh-CN">
导入TatterTools的备份文件到Zeroboard XE的模块。
需要不包含附件的备份文件。
附件将在原地址直接下载。
</description>
<description xml:lang="jp">
TatterToolsのバックアップファイルをゼロボードXE用にデータの変換を行うモジュールです。添付ファイルを含まないバックアップファイルが必要です。添付ファイルは、元のアドレスからダウンロードします。
</description>
<description xml:lang="en">
Module for inputting TattertTools' backup file to ZeroboardXE.
Backup file without attachment is required.
Attachments will be downloaded from the original address.
</description>
</author>
</module>

View file

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

View file

@ -1,21 +0,0 @@
<?php
/**
* @file modules/ttimporter/lang/en.lang.php
* @author zero (zero@nzeo.com)
* @brief Ttimporter module / basic language pack
**/
$lang->ttimporter = "Import Tetter Tools data";
$lang->about_tt_importer = "You can input the Tetter Tools data into the module you want.\n The attached file will be directly downloaded via web, so please be sure to enable the original Tetter Tools blog.";
$lang->target_module = "Target module";
$lang->target_file = "Target xml file";
$lang->target_url = "Blog URL";
$lang->cmd_continue = 'Continue';
$lang->msg_no_xml_file = 'Could not find the XML file! Please check the URL.';
$lang->msg_invalid_xml_file = 'Invalid XML file type!';
$lang->msg_importing = 'No. of importing: %d (if stopped long time, please click the "Continue" button.)';
$lang->msg_import_finished = 'No. of imported: %d (according to condition, some data may not be imported properly.)';
?>

View file

@ -1,21 +0,0 @@
<?php
/**
* @file ko.lang.php
* @author zero (zero@nzeo.com) 翻訳RisaPapa
* @brief Ttimporter モジュールの基本言語パッケージ
**/
$lang->ttimporter = "TTデータの移転";
$lang->about_tt_importer = "TatterTools データを希望するモジュールへデータを変換し、入力を行います。添付ファイルは、元のから直接ダウンロードするため、元のTatterTools が作動するようにしておいてください。";
$lang->target_module = "対象モジュール";
$lang->target_file = "対象XMLファイル";
$lang->target_url = "ブログURL";
$lang->cmd_continue = '続ける';
$lang->msg_no_xml_file = 'XMLファイルが見つかりません。パスを確認してください。';
$lang->msg_invalid_xml_file = '正しくないフォーマットのXMLファイルです。';
$lang->msg_importing = '%d個を変換・入力中です。止まっている場合は「続ける」ボタンをクリックしてください。';
$lang->msg_import_finished = '%d個のデータを変換し、入力が完了しました。正しく変換入力されていないデータがある場合もあります。';
?>

View file

@ -1,21 +0,0 @@
<?php
/**
* @file ko.lang.php
* @author zero (zero@nzeo.com)
* @brief Ttimporter 모듈의 기본 언어팩
**/
$lang->ttimporter = "태터툴즈 데이터 이전";
$lang->about_tt_importer = "태터툴즈 데이터를 원하는 모듈에 입력을 할 수 있습니다.\n첨부파일은 웹으로 직접 다운로드를 받으니 꼭 원래 태터툴즈 블로그를 활성화 시켜 주셔야 합니다.";
$lang->target_module = "대상 모듈";
$lang->target_file = "대상 xml파일";
$lang->target_url = "블로그URL";
$lang->cmd_continue = '계속진행';
$lang->msg_no_xml_file = 'XML파일을 찾을 수 없습니다. 경로를 다시 확인해주세요';
$lang->msg_invalid_xml_file = '잘못된 형식의 XML파일입니다';
$lang->msg_importing = '%d개를 입력중입니다. (계속 멈추어 있으면 "계속진행" 버튼을 클릭해주세요)';
$lang->msg_import_finished = '%d개의 데이터 입력이 완료되었습니다. 상황에 따라 입력되지 못한 데이터가 있을 수 있습니다.';
?>

View file

@ -1,21 +0,0 @@
<?php
/**
* @file zh-CN.lang.php
* @author zero (zero@nzeo.com)
* @brief Ttimporter 模块的基本语言包
**/
$lang->ttimporter = "TatterTools 数据导入";
$lang->about_tt_importer = "可以把TatterTools 的数据导入到指定的模块当中。\n因附件要在网站直接下载所以导入前必须先激活原TatterTools 博客。";
$lang->target_module = "对象模块";
$lang->target_file = "对象xml文件";
$lang->target_url = "博客URL";
$lang->cmd_continue = '继续进行';
$lang->msg_no_xml_file = '找不到XML文件。请重新确认路径';
$lang->msg_invalid_xml_file = '错误的XML文件格式。';
$lang->msg_importing = '正在输入%d个。长时间停止响应时请按“继续进行”按钮';
$lang->msg_import_finished = '已完成%d个数据导入。根据情况可能会有没有被导入的数据。';
?>

View file

@ -1,14 +0,0 @@
<filter name="import_tt" module="ttimporter" act="procTtimporterAdminImport">
<form>
<node target="xml_file" required="true" />
<node target="url" required="true" />
<node target="module_srl" required="true" />
</form>
<parameter />
<response callback_func="completeImport">
<tag name="error" />
<tag name="message" />
<tag name="is_finished" />
<tag name="position" />
</response>
</filter>

View file

@ -1,46 +0,0 @@
<!--%import("js/importer_admin.js")-->
<!--%import("filter/import_tt.xml")-->
<h3>{$lang->ttimporter} <span class="gray">{$lang->cmd_management}</span></h3>
<!-- 설명 -->
<div class="infoText">{nl2br($lang->about_tt_importer)}</div>
<form action="./" method="get" onsubmit="return procFilter(this, import_tt);" id="fo_import">
<input type="hidden" name="position" value="0" />
<table cellspacing="0" class="tableType3 gap1">
<col width="150" />
<col />
<tr>
<th scope="col">{$lang->target_module}</th>
<td class="left">
<select name="module_srl">
<!--@foreach($module_list as $key => $val)-->
<option value="{$val->module_srl}">{$val->browser_title} - {$key}</option>
<!--@end-->
</select>
</td>
</tr>
<tr>
<th scope="col">{$lang->target_file}</th>
<td class="left"><input type="text" name="xml_file" value="" class="inputTypeText w100" /></td>
</tr>
<tr>
<th scope="col">{$lang->target_url}</th>
<td class="left"><input type="text" name="url" value="" class="inputTypeText w100" /></td>
</tr>
</table>
<div class="tRight gap1">
<span class="button"><input type="submit" value="{$lang->cmd_registration}" /></span>
</div>
<div id="import_status" style="display:none" class="gap1">
<div id="step2_position" class="desc"></div>
<div class="tRight gap1">
<span class="button"><input type="button" value="{$lang->cmd_continue}" onclick="doManualProcess(); return false" /></span>
</div>
</div>
</form>

View file

@ -1,29 +0,0 @@
/**
* @file modules/ttimporter/js/importer_admin.js
* @author zero (zero@nzeo.com)
* @brief importer에서 사용하는 javascript
**/
/* Step Complete Import */
function completeImport(ret_obj) {
var message = ret_obj['message'];
var is_finished = ret_obj['is_finished'];
var position = ret_obj['position'];
xGetElementById("import_status").style.display = "block";
if(is_finished=='Y') {
alert(ret_obj["message"]);
location.href = location.href;
} else {
var fo_obj = xGetElementById('fo_import');
fo_obj.position.value = position;
xInnerHtml('import_status', message);
procFilter(fo_obj, import_tt);
}
}
function doManualProcess() {
var fo_obj = xGetElementById('fo_import');
procFilter(fo_obj, import_tt);
}

View file

@ -1,264 +0,0 @@
<?php
/**
* @class ttimporterAdminController
* @author zero (zero@nzeo.com)
* @brief ttimporter 모듈의 admin controller class
**/
class ttimporterAdminController extends ttimporter {
var $oXml = null;
var $oDocumentController = null;
var $oFileController = null;
var $oCommentController = null;
var $oTrackbackController = null;
var $position = 0;
var $imported_count = 0;
var $limit_count = 20;
var $url = '';
var $module_srl = 0;
var $category_list = array();
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief import 실행
**/
function procTtimporterAdminImport() {
// 실행시간 무한대로 설정
@set_time_limit(0);
// 변수 체크
$this->module_srl = Context::get('module_srl');
$xml_file = Context::get('xml_file');
$this->url = Context::get('url');
$this->position = (int)Context::get('position');
if(substr($this->url,-1)!='/') $this->url .= '/';
// 파일을 찾을 수 없으면 에러 표시
if(!file_exists($xml_file)) return new Object(-1,'msg_no_xml_file');
$this->oXml = new XmlParser();
$oDocumentModel = &getModel('document');
$tmp_category_list = $oDocumentModel->getCategoryList($this->module_srl);
if(count($tmp_category_list)) {
foreach($tmp_category_list as $key => $val) $this->category_list[$val->title] = $key;
} else {
$this->category_list = array();
}
// module_srl이 있으면 module데이터로 판단하여 처리, 아니면 회원정보로..
$is_finished = $this->importDocument($xml_file);
if($is_finished) {
$this->add('is_finished', 'Y');
$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $this->imported_count) );
} else {
$this->add('position', $this->imported_count);
$this->add('is_finished', 'N');
$this->setMessage( sprintf(Context::getLang('msg_importing'), $this->imported_count) );
}
}
/**
* @brief 게시물정보 import
**/
function importDocument($xml_file) {
$filesize = filesize($xml_file);
if($filesize<1) return;
$this->oDocumentController = &getController('document');
$this->oFileController = &getController('file');
$this->oCommentController = &getController('comment');
$this->oTrackbackController = &getController('trackback');
$is_finished = true;
$fp = @fopen($xml_file, "r");
if($fp) {
$buff = '';
while(!feof($fp)) {
$str = fread($fp,1024);
$buff .= $str;
$buff = preg_replace_callback("!<category>(.*?)<\/category>!is", array($this, '_parseCategoryInfo'), trim($buff));
$buff = preg_replace_callback("!<post (.*?)<\/post>!is", array($this, '_importDocument'), trim($buff));
if($this->position+$this->limit_count <= $this->imported_count) {
$is_finished = false;
break;
}
}
fclose($fp);
}
return $is_finished;
}
function _insertAttachment($matches) {
$xml_doc = $this->oXml->parse($matches[0]);
$filename = $xml_doc->attachment->name->body;
$url = sprintf("%sattach/1/%s", $this->url, $filename);
$tmp_filename = './files/cache/tmp_uploaded_file';
if(FileHandler::getRemoteFile($url, $tmp_filename)) {
$file_info['tmp_name'] = $tmp_filename;
$file_info['name'] = $filename;
$this->oFileController->insertFile($file_info, $this->module_srl, $this->document_srl, 0, true);
$this->uploaded_count++;
}
@unlink($tmp_filename);
}
function _importDocument($matches) {
if($this->position > $this->imported_count) {
$this->imported_count++;
return;
}
$this->uploaded_count = 0;
$xml_doc = $this->oXml->parse($matches[0]);
// 문서 번호와 내용 미리 구해 놓기
$this->document_srl = $args->document_srl = getNextSequence();
$args->content = $xml_doc->post->content->body;
// 첨부파일 미리 등록
preg_replace_callback("!<attachment (.*?)<\/attachment>!is", array($this, '_insertAttachment'), $matches[0]);
// 컨텐츠의 내용 수정 (이미지 첨부파일 관련)
$args->content = preg_replace("!(\[##\_1)([a-zA-Z]){1}\|([^\|]*)\|([^\|]*)\|([^\]]*)\]!is", sprintf('<img src="./files/attach/images/%s/%s/$3" $4 />', $this->module_srl, $args->document_srl), $args->content);
if($xml_doc->post->comment && !is_array($xml_doc->post->comment)) $xml_doc->post->comment = array($xml_doc->post->comment);
$logged_info = Context::get('logged_info');
// 문서 입력
$args->module_srl = $this->module_srl;
$args->category_srl = $this->category_list[$xml_doc->post->category->body];
$args->is_notice = 'N';
$args->is_secret = 'N';
$args->title = $xml_doc->post->title->body;
$args->readed_count = 0;
$args->voted_count = 0;
$args->comment_count = count($xml_doc->post->comment);
$args->trackback_count = 0;
$args->uploaded_count = $this->uploaded_count;
$args->password = '';
$args->nick_name = $logged_info->nick_name;
$args->member_srl = $logged_info->member_srl;
$args->user_id = $logged_info->user_id;
$args->user_name = $logged_info->user_name;
$args->email_address = $logged_info->email_address;
$args->homepage = $logged_info->homepage;
$tag_list = array();
$tags = $xml_doc->post->tag;
if($tags && !is_array($tags)) $tags = array($tags);
for($i=0;$i<count($tags);$i++) {
$tag_list[] = $tags[$i]->body;
}
$args->tags = implode(',',$tag_list);
$args->regdate = date("YmdHis", $xml_doc->post->created->body);
$args->ipaddress = '';
$args->allow_comment = $xml_doc->post->acceptcomment->body?'Y':'N';
$args->lock_comment = 'N';
$args->allow_trackback = $xml_doc->post->accepttrackback->body?'Y':'N';
$output = $this->oDocumentController->insertDocument($args, true);
if($output->toBool()) {
// 코멘트 입력
$comments = $xml_doc->post->comment;
if(count($comments)) {
foreach($comments as $key => $val) {
unset($comment_args);
$comment_args->document_srl = $args->document_srl;
$comment_args->comment_srl = getNextSequence();
$comment_args->module_srl = $this->module_srl;
$comment_args->parent_srl = 0;
$comment_args->content = $val->content->body;
$comment_args->password = '';
$comment_args->nick_name = $val->commenter->name->body;
$comment_args->user_id = '';
$comment_args->user_name = '';
$comment_args->member_srl = 0;
$comment_args->email_address = '';
$comment_args->regdate = date("YmdHis",$val->written->body);
$comment_args->ipaddress = $val->commenter->ip->body;
$this->oCommentController->insertComment($comment_args, true);
if($val->comment) {
$val = $val->comment;
unset($child_comment_args);
$child_comment_args->document_srl = $args->document_srl;
$child_comment_args->comment_srl = getNextSequence();
$child_comment_args->module_srl = $this->module_srl;
$child_comment_args->parent_srl = $comment_args->comment_srl;
$child_comment_args->content = $val->content->body;
$child_comment_args->password = '';
$child_comment_args->nick_name = $val->commenter->name->body;
$child_comment_args->user_id = '';
$child_comment_args->user_name = '';
$child_comment_args->member_srl = 0;
$child_comment_args->email_address = '';
$child_comment_args->regdate = date("YmdHis",$val->written->body);
$child_comment_args->ipaddress = $val->commenter->ip->body;
$this->oCommentController->insertComment($child_comment_args, true);
}
}
}
/*
// 트랙백 입력
$trackbacks = $xml_doc->document->trackbacks->trackback;
if($trackbacks && !is_array($trackbacks)) $trackbacks = array($trackbacks);
if(count($trackbacks)) {
foreach($trackbacks as $key => $val) {
$trackback_args->document_srl = $args->document_srl;
$trackback_args->module_srl = $this->module_srl;
$trackback_args->url = $val->url->body;
$trackback_args->title = $val->title->body;
$trackback_args->blog_name = $val->blog_name->body;
$trackback_args->excerpt = $val->excerpt->body;
$trackback_args->regdate = $val->regdate->body;
$trackback_args->ipaddress = $val->ipaddress->body;
$this->oTrackbackController->insertTrackback($trackback_args, true);
}
}
*/
}
$this->imported_count ++;
return '';
}
/**
* @brief <categories>정보를 읽어서 정보를 구함
**/
function _parseCategoryInfo($matches) {
$xml_doc = $this->oXml->parse($matches[0]);
if(!$xml_doc->category->priority) return $matches[0];
$title = trim($xml_doc->category->name->body);
if(!$title || $this->category_list[$title]) return;
$oDocumentController = &getAdminController('document');
$output = $oDocumentController->insertCategory($this->module_srl, $title);
$this->category_list[$title] = $output->get('category_srl');
}
}
?>

View file

@ -1,32 +0,0 @@
<?php
/**
* @class ttimporterAdminView
* @author zero (zero@nzeo.com)
* @brief ttimporter 모듈의 admin view class
**/
class ttimporterAdminView extends ttimporter {
/**
* @brief 초기화
*
* importer 모듈은 일반 사용과 관리자용으로 나누어진다.\n
**/
function init() {
}
/**
* @brief XML 파일을 업로드하는 form 출력
**/
function dispTtimporterAdminContent() {
// 모듈 목록을 구함
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getMidList();
Context::set('module_list', $module_list);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('index');
}
}
?>

View file

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