git-svn-id: http://xe-core.googlecode.com/svn/trunk@100 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-02-15 14:08:06 +00:00
parent dc1bf81d06
commit cf88cc4cb2
42 changed files with 209 additions and 1387 deletions

View file

@ -137,7 +137,8 @@
$oTagController->deleteTag($document_srl);
// 첨부 파일 삭제
if($document->uploaded_count) $this->deleteFiles($document->module_srl, $document_srl);
$oFileController = getController('file');
if($document->uploaded_count) $oFileController->deleteFiles($document->module_srl, $document_srl);
// 카테고리가 있으면 카테고리 정보 변경
if($document->category_srl) $this->updateCategoryCount($document->category_srl);
@ -368,123 +369,5 @@
return new Object();
}
/**
* @brief 첨부파일 추가
**/
function insertFile($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$file_info = Context::get('file');
// 정상적으로 업로드된 파일이 아니면 오류 출력
if(!is_uploaded_file($file_info['tmp_name'])) return false;
// 이미지인지 기타 파일인지 체크하여 upload path 지정
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) {
$path = sprintf("./files/attach/images/%s/%s/", $module_srl,$document_srl);
$filename = $path.$file_info['name'];
$direct_download = 'Y';
} else {
$path = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$direct_download = 'N';
}
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
// 파일 이동
if(!move_uploaded_file($file_info['tmp_name'], $filename)) return false;
// 사용자 정보를 구함
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getMemberSrl();
// 파일 정보를 정리
$args->file_srl = $oDB->getNextSequence();
$args->document_srl = $document_srl;
$args->module_srl = $module_srl;
$args->direct_download = $direct_download;
$args->source_filename = $file_info['name'];
$args->uploaded_filename = $filename;
$args->file_size = filesize($filename);
$args->comment = NULL;
$args->member_srl = $member_srl;
$args->sid = md5($args->source_filename);
$output = $oDB->executeQuery('document.insertFile', $args);
if(!$output->toBool()) return $output;
$output->add('file_srl', $args->file_srl);
$output->add('file_size', $args->file_size);
$output->add('source_filename', $args->source_filename);
return $output;
}
/**
* @brief 첨부파일 삭제
**/
function deleteFile($file_srl) {
$oDB = &DB::getInstance();
// 파일 정보를 가져옴
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
if(!$output->toBool()) return $output;
$file_info = $output->data;
if(!$file_info) return new Object(-1, 'file_not_founded');
$source_filename = $output->data->source_filename;
$uploaded_filename = $output->data->uploaded_filename;
// DB에서 삭제
$output = $oDB->executeQuery('document.deleteFile', $args);
if(!$output->toBool()) return $output;
// 삭제 성공하면 파일 삭제
unlink($uploaded_filename);
return $output;
}
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $document_srl);
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/", $module_srl);
$path[1] = sprintf("./files/attach/binaries/%s/", $module_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
}
?>

View file

@ -189,54 +189,6 @@
return (int)$output->data->count;
}
/**
* @brief 특정 문서에 속한 첨부파일의 개수를 return
**/
function getFilesCount($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.getFilesCount', $args);
return (int)$output->data->count;
}
/**
* @brief 파일 정보를 구함
**/
function getFile($file_srl) {
$oDB = &DB::getInstance();
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
return $output->data;
}
/**
* @brief 특정 문서에 속한 파일을 모두 return
**/
function getFiles($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->sort_index = 'file_srl';
$output = $oDB->executeQuery('document.getFiles', $args);
$file_list = $output->data;
if($file_list && !is_array($file_list)) $file_list = array($file_list);
for($i=0;$i<count($file_list);$i++) {
$direct_download = $file_list[$i]->direct_download;
if($direct_download!='Y') continue;
$uploaded_filename = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2);
$file_list[$i]->uploaded_filename = $uploaded_filename;
}
return $file_list;
}
/**
* @brief 내용의 플러그인이나 기타 기능에 대한 code를 실제 code로 변경
**/

View file

@ -1,8 +0,0 @@
<query id="deleteFile" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="deleteFiles" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="deleteModuleFiles" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="getFile" action="select">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="getFiles" action="select">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" order="asc" />
</navigation>
</query>

View file

@ -1,11 +0,0 @@
<query id="getFilesCount" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,20 +0,0 @@
<query id="insertFile" action="insert">
<tables>
<table name="files" />
</tables>
<columns>
<column name="file_srl" var="file_srl" notnull="notnull" />
<column name="document_srl" var="document_srl" filter="number" default="0" notnull="notnull" />
<column name="sid" var="sid" />
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
<column name="source_filename" var="source_filename" notnull="notnull" minlength="1" maxlength="250" />
<column name="uploaded_filename" var="uploaded_filename" notnull="notnull" minlength="1" maxlength="250" />
<column name="file_size" var="file_size" notnull="notnull" default="0" />
<column name="direct_download" var="direct_download" notnull="notnull" default="N" />
<column name="comment" var="comment" />
<column name="downloaded_count" var="downloaded_count" default="0" />
<column name="member_srl" var="member_srl" default="0" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
</columns>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateDownloadCount" action="update">
<tables>
<table name="files" />
</tables>
<columns>
<column name="download_count" var="download_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,16 +0,0 @@
<table name="files">
<column name="file_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="sid" type="varchar" size="60" />
<column name="document_srl" type="number" size="11" default="0" notnull="notnull" index="idx_document_srl" />
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="download_count" type="number" size="11" notnull="notnull" default="0" />
<column name="direct_download" type="char" size="1" default="N" notnull="notnull" />
<column name="source_filename" type="varchar" size="250" />
<column name="uploaded_filename" type="varchar" size="250" />
<column name="file_size" type="number" size="11" default="0" notnull="notnull" />
<column name="comment" type="varchar" size="250" />
<column name="downloaded_count" type="number" size="11" default="0" notnull="notnull" />
<column name="regdate" type="date" index="idx_regdate" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
</table>

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">문서</title>
<title xml:lang="en">document</title>
<title xml:lang="ko">파일</title>
<title xml:lang="en">file</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="en">zero</name>
<description xml:lang="ko">문서 모듈</description>
<description xml:lang="en">document</description>
<description xml:lang="ko">파일 관리 모듈</description>
<description xml:lang="en">file manager</description>
</author>
<module>

View file

@ -1,490 +0,0 @@
<?php
/**
* @class documentController
* @author zero (zero@nzeo.com)
* @brief document 모듈의 controller 클래스
**/
class documentController extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 문서의 권한 부여
* 세션값으로 접속상태에서만 사용 가능
**/
function addGrant($document_srl) {
$_SESSION['own_document'][$document_srl] = true;
}
/**
* @brief 문서 입력
**/
function insertDocument($obj) {
$oDB = &DB::getInstance();
// 카테고리가 있나 검사하여 없는 카테고리면 0으로 세팅
if($obj->category_srl) {
$category_list = $this->getCategoryList($obj->module_srl);
if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
}
// 태그 처리
$oTagController = getController('tag');
$obj->tags = $oTagController->insertTag($obj->module_srl, $obj->document_srl, $obj->tags);
// 글 입력
$obj->readed_count = 0;
$obj->update_order = $obj->list_order = $obj->document_srl * -1;
if($obj->password) $obj->password = md5($obj->password);
// 공지사항일 경우 list_order에 무지막지한 값;;을 입력
if($obj->is_notice=='Y') $obj->list_order = $this->notice_list_order;
// DB에 입력
$output = $oDB->executeQuery('document.insertDocument', $obj);
if(!$output->toBool()) return $output;
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($obj->category_srl) $this->updateCategoryCount($obj->category_srl);
// return
$this->addGrant($obj->document_srl);
$output->add('document_srl',$obj->document_srl);
$output->add('category_srl',$obj->category_srl);
return $output;
}
/**
* @brief 문서 수정
**/
function updateDocument($source_obj, $obj) {
// 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅
if($source_obj->category_srl!=$obj->category_srl) {
$category_list = $this->getCategoryList($obj->module_srl);
if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
}
// 태그 처리
$oTagController = getController('tag');
$obj->tags = $oTagController->insertTag($obj->module_srl, $obj->document_srl, $obj->tags);
// 수정
$oDB = &DB::getInstance();
$obj->update_order = $oDB->getNextSequence() * -1;
// 공지사항일 경우 list_order에 무지막지한 값을, 그렇지 않으면 document_srl*-1값을
if($obj->is_notice=='Y') $obj->list_order = $this->notice_list_order;
else $obj->list_order = $obj->document_srl*-1;
if($obj->password) $obj->password = md5($obj->password);
// DB에 입력
$output = $oDB->executeQuery('document.updateDocument', $obj);
if(!$output->toBool()) return $output;
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($source_obj->category_srl!=$obj->category_srl) {
if($source_obj->category_srl) $this->updateCategoryCount($source_obj->category_srl);
if($obj->category_srl) $this->updateCategoryCount($obj->category_srl);
}
$output->add('document_srl',$obj->document_srl);
return $output;
}
/**
* @brief 문서 삭제
**/
function deleteDocument($obj) {
// 변수 세팅
$document_srl = $obj->document_srl;
$category_srl = $obj->category_srl;
// document의 model 객체 생성
$oDocumentModel = getModel('document');
// 기존 문서가 있는지 확인
$document = $oDocumentModel->getDocument($document_srl);
if($document->document_srl != $document_srl) return false;
// 권한이 있는지 확인
if(!$document->is_granted) return new Object(-1, 'msg_not_permitted');
$oDB = &DB::getInstance();
// 글 삭제
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.deleteDocument', $args);
if(!$output->toBool()) return $output;
// 댓글 삭제
$oCommentController = getController('comment');
$output = $oCommentController->deleteComments($document_srl);
// 엮인글 삭제
$oTrackbackController = getController('trackback');
$output = $oTrackbackController->deleteTrackbacks($document_srl);
// 태그 삭제
$oTagController = getController('tag');
$oTagController->deleteTag($document_srl);
// 첨부 파일 삭제
if($document->uploaded_count) $this->deleteFiles($document->module_srl, $document_srl);
// 카테고리가 있으면 카테고리 정보 변경
if($document->category_srl) $this->updateCategoryCount($document->category_srl);
return $output;
}
/**
* @brief 특정 모듈의 전체 문서 삭제
**/
function deleteModuleDocument($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.deleteModuleDocument', $args);
return $output;
}
/**
* @brief 해당 document의 조회수 증가
**/
function updateReadedCount($document_srl) {
if($_SESSION['readed_document'][$document_srl]) return false;
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.updateReadedCount', $args);
return $_SESSION['readed_document'][$document_srl] = true;
}
/**
* @brief 해당 document의 추천수 증가
**/
function updateVotedCount($document_srl) {
if($_SESSION['voted_document'][$document_srl]) return new Object(-1, 'failed_voted');
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.updateVotedCount', $args);
$_SESSION['voted_document'][$document_srl] = true;
return $output;
}
/**
* @brief 해당 document의 댓글 증가
**/
function updateCommentCount($document_srl, $comment_count) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->comment_count = $comment_count;
return $oDB->executeQuery('document.updateCommentCount', $args);
}
/**
* @brief 해당 document의 엮인글 수증가
**/
function updateTrackbackCount($document_srl, $trackback_count) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->trackback_count = $trackback_count;
return $oDB->executeQuery('document.updateTrackbackCount', $args);
}
/**
* @brief 카테고리 추가
**/
function insertCategory($module_srl, $title) {
$oDB = &DB::getInstance();
$args->list_order = $args->category_srl = $oDB->getNextSequence();
$args->module_srl = $module_srl;
$args->title = $title;
$args->document_count = 0;
return $oDB->executeQuery('document.insertCategory', $args);
}
/**
* @brief 카테고리 정보 수정
**/
function updateCategory($args) {
$oDB = &DB::getInstance();
return $oDB->executeQuery('document.updateCategory', $args);
}
/**
* @brief 카테고리에 문서의 숫자를 변경
**/
function updateCategoryCount($category_srl, $document_count = 0) {
// document model 객체 생성
$oDocumentModel = getModel('document');
if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($category_srl);
$oDB = &DB::getInstance();
$args->category_srl = $category_srl;
$args->document_count = $document_count;
return $oDB->executeQuery('document.updateCategoryCount', $args);
}
/**
* @brief 카테고리 삭제
**/
function deleteCategory($category_srl) {
$oDB = &DB::getInstance();
$args->category_srl = $category_srl;
// 카테고리 정보를 삭제
$output = $oDB->executeQuery('document.deleteCategory', $args);
if(!$output->toBool()) return $output;
// 현 카테고리 값을 가지는 문서들의 category_srl을 0 으로 세팅
unset($args);
$args->target_category_srl = 0;
$args->source_category_srl = $category_srl;
$output = $oDB->executeQuery('document.updateDocumentCategory', $args);
return $output;
}
/**
* @brief 특정 모듈의 카테고리를 모두 삭제
**/
function deleteModuleCategory($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.deleteModuleCategory', $args);
return $output;
}
/**
* @brief 카테고리를 상단으로 이동
**/
function moveCategoryUp($category_srl) {
$oDB = &DB::getInstance();
$oDocumentModel = getModel('document');
// 선택된 카테고리의 정보를 구한다
$args->category_srl = $category_srl;
$output = $oDB->executeQuery('document.getCategory', $args);
$category = $output->data;
$list_order = $category->list_order;
$module_srl = $category->module_srl;
// 전체 카테고리 목록을 구한다
$category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object();
$prev_category = NULL;
foreach($category_list as $key => $val) {
if($key==$category_srl) break;
$prev_category = $val;
}
// 이전 카테고리가 없으면 그냥 return
if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
// 선택한 카테고리가 가장 위의 카테고리이면 그냥 return
if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
// 선택한 카테고리의 정보
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $prev_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// 대상 카테고리의 정보
$prev_args->category_srl = $prev_category->category_srl;
$prev_args->list_order = $list_order;
$prev_args->title = $prev_category->title;
$this->updateCategory($prev_args);
return new Object();
}
/**
* @brief 카테고리를 아래로 이동
**/
function moveCategoryDown($category_srl) {
$oDB = &DB::getInstance();
$oDocumentModel = getModel('document');
// 선택된 카테고리의 정보를 구한다
$args->category_srl = $category_srl;
$output = $oDB->executeQuery('document.getCategory', $args);
$category = $output->data;
$list_order = $category->list_order;
$module_srl = $category->module_srl;
// 전체 카테고리 목록을 구한다
$category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object();
for($i=0;$i<count($category_srl_list);$i++) {
if($category_srl_list[$i]==$category_srl) break;
}
$next_category_srl = $category_srl_list[$i+1];
if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
$next_category = $category_list[$next_category_srl];
// 선택한 카테고리의 정보
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $next_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// 대상 카테고리의 정보
$next_args->category_srl = $next_category->category_srl;
$next_args->list_order = $list_order;
$next_args->title = $next_category->title;
$this->updateCategory($next_args);
return new Object();
}
/**
* @brief 첨부파일 추가
**/
function insertFile($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$file_info = Context::get('file');
// 정상적으로 업로드된 파일이 아니면 오류 출력
if(!is_uploaded_file($file_info['tmp_name'])) return false;
// 이미지인지 기타 파일인지 체크하여 upload path 지정
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) {
$path = sprintf("./files/attach/images/%s/%s/", $module_srl,$document_srl);
$filename = $path.$file_info['name'];
$direct_download = 'Y';
} else {
$path = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$direct_download = 'N';
}
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
// 파일 이동
if(!move_uploaded_file($file_info['tmp_name'], $filename)) return false;
// 사용자 정보를 구함
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getMemberSrl();
// 파일 정보를 정리
$args->file_srl = $oDB->getNextSequence();
$args->document_srl = $document_srl;
$args->module_srl = $module_srl;
$args->direct_download = $direct_download;
$args->source_filename = $file_info['name'];
$args->uploaded_filename = $filename;
$args->file_size = filesize($filename);
$args->comment = NULL;
$args->member_srl = $member_srl;
$args->sid = md5($args->source_filename);
$output = $oDB->executeQuery('document.insertFile', $args);
if(!$output->toBool()) return $output;
$output->add('file_srl', $args->file_srl);
$output->add('file_size', $args->file_size);
$output->add('source_filename', $args->source_filename);
return $output;
}
/**
* @brief 첨부파일 삭제
**/
function deleteFile($file_srl) {
$oDB = &DB::getInstance();
// 파일 정보를 가져옴
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
if(!$output->toBool()) return $output;
$file_info = $output->data;
if(!$file_info) return new Object(-1, 'file_not_founded');
$source_filename = $output->data->source_filename;
$uploaded_filename = $output->data->uploaded_filename;
// DB에서 삭제
$output = $oDB->executeQuery('document.deleteFile', $args);
if(!$output->toBool()) return $output;
// 삭제 성공하면 파일 삭제
unlink($uploaded_filename);
return $output;
}
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $document_srl);
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/", $module_srl);
$path[1] = sprintf("./files/attach/binaries/%s/", $module_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
}
?>

View file

@ -1,276 +0,0 @@
<?php
/**
* @class documentModel
* @author zero (zero@nzeo.com)
* @brief document 모듈의 model 클래스
**/
class documentModel extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief document에 대한 권한을 세션값으로 체크
**/
function isGranted($document_srl) {
return $_SESSION['own_document'][$document_srl];
}
/**
* @brief 문서 가져오기
**/
function getDocument($document_srl) {
// DB에서 가져옴
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.getDocument', $args);
$document = $output->data;
// 이 문서에 대한 권한이 있는지 확인
if($this->isGranted($document->document_srl)) {
$document->is_granted = true;
} elseif($document->member_srl) {
$oMember = getModule('member');
$member_srl = $oMember->getMemberSrl();
if($member_srl && $member_srl ==$document->member_srl) $document->is_granted = true;
}
return $document;
}
/**
* @brief 여러개의 문서들을 가져옴 (페이징 아님)
**/
function getDocuments($document_srl_list) {
if(is_array($document_srl_list)) $document_srls = implode(',',$document_srl_list);
// DB에서 가져옴
$oDB = &DB::getInstance();
$args->document_srls = $document_srls;
$output = $oDB->executeQuery('document.getDocuments', $args);
$document_list = $output->data;
if(!$document_list) return;
// 권한 체크
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getMemberSrl();
$document_count = count($document_list);
for($i=0;$i<$document_count;$i++) {
$document = $document_list[$i];
$is_granted = false;
if($this->isGranted($document->document_srl)) {
$is_granted = true;
} elseif($member_srl && $member_srl == $document->member_srl) {
$is_granted = true;
}
$document_list[$i]->is_granted = $is_granted;
}
return $document_list;
}
/**
* @brief module_srl에 해당하는 문서의 전체 갯수를 가져옴
**/
function getDocumentCount($module_srl, $search_obj = NULL) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$args->s_title = $search_obj->s_title;
$args->s_content = $search_obj->s_content;
$args->s_user_name = $search_obj->s_user_name;
$args->s_member_srl = $search_obj->s_member_srl;
$args->s_ipaddress = $search_obj->s_ipaddress;
$args->s_regdate = $search_obj->s_regdate;
$output = $oDB->executeQuery('document.getDocumentCount', $args);
$total_count = $output->data->count;
return (int)$total_count;
}
/**
* @brief module_srl값을 가지는 문서의 목록을 가져옴
**/
function getDocumentList($module_srl, $sort_index = 'list_order', $page = 1, $list_count = 20, $page_count = 10, $search_obj = NULL) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$args->s_title = $search_obj->s_title;
$args->s_content = $search_obj->s_content;
$args->s_user_name = $search_obj->s_user_name;
$args->s_member_srl = $search_obj->s_member_srl;
$args->s_ipaddress = $search_obj->s_ipaddress;
$args->s_regdate = $search_obj->s_regdate;
$args->category_srl = $search_obj->category_srl;
$args->sort_index = $sort_index;
$args->page = $page;
$args->list_count = $list_count;
$args->page_count = $page_count;
$output = $oDB->executeQuery('document.getDocumentList', $args);
if(!count($output->data)) return $output;
// 권한 체크
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getMemberSrl();
foreach($output->data as $key => $document) {
$is_granted = false;
if($this->isGranted($document->document_srl)) $is_granted = true;
elseif($member_srl && $member_srl == $document->member_srl) $is_granted = true;
$output->data[$key]->is_granted = $is_granted;
}
return $output;
}
/**
* @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서..
**/
function getDocumentPage($document_srl, $module_srl=0, $list_count) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.getDocumentPage', $args);
$count = $output->data->count;
$page = (int)(($count-1)/$list_count)+1;
return $page;
}
/**
* @brief 카테고리의 정보를 가져옴
**/
function getCategory($category_srl) {
$oDB = &DB::getInstance();
$args->category_srl = $category_srl;
$output = $oDB->executeQuery('document.getCategory', $args);
return $output->data;
}
/**
* @brief 특정 모듈의 카테고리 목록을 가져옴
**/
function getCategoryList($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$args->sort_index = 'list_order';
$output = $oDB->executeQuery('document.getCategoryList', $args);
$category_list = $output->data;
if(!$category_list) return NULL;
if(!is_array($category_list)) $category_list = array($category_list);
$category_count = count($category_list);
for($i=0;$i<$category_count;$i++) {
$category_srl = $category_list[$i]->category_srl;
$list[$category_srl] = $category_list[$i];
}
return $list;
}
/**
* @brief 카테고리에 속한 문서의 갯수를 구함
**/
function getCategoryDocumentCount($category_srl) {
$oDB = &DB::getInstance();
$args->category_srl = $category_srl;
$output = $oDB->executeQuery('document.getCategoryDocumentCount', $args);
return (int)$output->data->count;
}
/**
* @brief 특정 문서에 속한 첨부파일의 개수를 return
**/
function getFilesCount($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.getFilesCount', $args);
return (int)$output->data->count;
}
/**
* @brief 파일 정보를 구함
**/
function getFile($file_srl) {
$oDB = &DB::getInstance();
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
return $output->data;
}
/**
* @brief 특정 문서에 속한 파일을 모두 return
**/
function getFiles($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->sort_index = 'file_srl';
$output = $oDB->executeQuery('document.getFiles', $args);
$file_list = $output->data;
if($file_list && !is_array($file_list)) $file_list = array($file_list);
for($i=0;$i<count($file_list);$i++) {
$direct_download = $file_list[$i]->direct_download;
if($direct_download!='Y') continue;
$uploaded_filename = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2);
$file_list[$i]->uploaded_filename = $uploaded_filename;
}
return $file_list;
}
/**
* @brief 내용의 플러그인이나 기타 기능에 대한 code를 실제 code로 변경
**/
function transContent($content) {
// 멀티미디어 코드의 변환
$content = preg_replace_callback('!<img([^\>]*)editor_multimedia([^\>]*?)>!is', array('Document','_transMultimedia'), $content);
// <br> 코드 변환
$content = str_replace(array("<BR>","<br>","<Br>"),"<br />", $content);
// <img ...> 코드를 <img ... /> 코드로 변환
$content = preg_replace('!<img(.*?)(\/){0,1}>!is','<img\\1 />', $content);
return $content;
}
/**
* @brief 내용의 멀티미디어 태그를 html 태그로 변경
* <img ... class="multimedia" ..> 되어 있는 코드를 변경
**/
function _transMultimedia($matches) {
preg_match("/style\=(\"|'){0,1}([^\"\']+)(\"|'){0,1}/i",$matches[0], $buff);
$style = str_replace("\"","'",$buff[0]);
preg_match("/alt\=\"{0,1}([^\"]+)\"{0,1}/i",$matches[0], $buff);
$opt = explode('|@|',$buff[1]);
if(count($opt)<1) return $matches[0];
for($i=0;$i<count($opt);$i++) {
$pos = strpos($opt[$i],"=");
$cmd = substr($opt[$i],0,$pos);
$val = substr($opt[$i],$pos+1);
$obj->{$cmd} = $val;
}
return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\", \"%s\");</script>", $obj->type, $obj->src, $style);
}
}
?>

View file

@ -0,0 +1,135 @@
<?php
/**
* @class fileController
* @author zero (zero@nzeo.com)
* @brief file 모듈의 controller 클래스
**/
class fileController extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 첨부파일 추가
**/
function insertFile($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$file_info = Context::get('file');
// 정상적으로 업로드된 파일이 아니면 오류 출력
if(!is_uploaded_file($file_info['tmp_name'])) return false;
// 이미지인지 기타 파일인지 체크하여 upload path 지정
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) {
$path = sprintf("./files/attach/images/%s/%s/", $module_srl,$document_srl);
$filename = $path.$file_info['name'];
$direct_download = 'Y';
} else {
$path = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$direct_download = 'N';
}
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
// 파일 이동
if(!move_uploaded_file($file_info['tmp_name'], $filename)) return false;
// 사용자 정보를 구함
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getMemberSrl();
// 파일 정보를 정리
$args->file_srl = $oDB->getNextSequence();
$args->document_srl = $document_srl;
$args->module_srl = $module_srl;
$args->direct_download = $direct_download;
$args->source_filename = $file_info['name'];
$args->uploaded_filename = $filename;
$args->file_size = filesize($filename);
$args->comment = NULL;
$args->member_srl = $member_srl;
$args->sid = md5($args->source_filename);
$output = $oDB->executeQuery('document.insertFile', $args);
if(!$output->toBool()) return $output;
$output->add('file_srl', $args->file_srl);
$output->add('file_size', $args->file_size);
$output->add('source_filename', $args->source_filename);
return $output;
}
/**
* @brief 첨부파일 삭제
**/
function deleteFile($file_srl) {
$oDB = &DB::getInstance();
// 파일 정보를 가져옴
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
if(!$output->toBool()) return $output;
$file_info = $output->data;
if(!$file_info) return new Object(-1, 'file_not_founded');
$source_filename = $output->data->source_filename;
$uploaded_filename = $output->data->uploaded_filename;
// DB에서 삭제
$output = $oDB->executeQuery('document.deleteFile', $args);
if(!$output->toBool()) return $output;
// 삭제 성공하면 파일 삭제
unlink($uploaded_filename);
return $output;
}
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($module_srl, $document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $document_srl);
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl) {
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('document.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/", $module_srl);
$path[1] = sprintf("./files/attach/binaries/%s/", $module_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
}
?>

View file

@ -0,0 +1,65 @@
<?php
/**
* @class fileModel
* @author zero (zero@nzeo.com)
* @brief file 모듈의 model 클래스
**/
class fileModel extends Module {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 특정 문서에 속한 첨부파일의 개수를 return
**/
function getFilesCount($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.getFilesCount', $args);
return (int)$output->data->count;
}
/**
* @brief 파일 정보를 구함
**/
function getFile($file_srl) {
$oDB = &DB::getInstance();
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
return $output->data;
}
/**
* @brief 특정 문서에 속한 파일을 모두 return
**/
function getFiles($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->sort_index = 'file_srl';
$output = $oDB->executeQuery('document.getFiles', $args);
$file_list = $output->data;
if($file_list && !is_array($file_list)) $file_list = array($file_list);
for($i=0;$i<count($file_list);$i++) {
$direct_download = $file_list[$i]->direct_download;
if($direct_download!='Y') continue;
$uploaded_filename = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2);
$file_list[$i]->uploaded_filename = $uploaded_filename;
}
return $file_list;
}
}
?>

View file

@ -1,11 +1,11 @@
<?php
/**
* @class documentView
* @class fileView
* @author zero (zero@nzeo.com)
* @brief document 모듈의 view 클래스
* @brief file 모듈의 view 클래스
**/
class documentView extends Module {
class fileView extends Module {
/**
* @brief 초기화

View file

@ -1,8 +0,0 @@
<?php
/**
* @file : modules/document/lang/ko.lang.php
* @author : zero <zero@nzeo.com>
* @desc : 문서(document) 모듈의 기본 언어팩
**/
$lang->msg_category_not_moved = "이동할 수가 없습니다";
?>

View file

@ -1,8 +0,0 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="categories" />
</tables>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="deleteDocument" action="delete">
<tables>
<table name="documents" />
</tables>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="categories" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="deleteModuleDocument" action="delete">
<tables>
<table name="documents" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,8 +0,0 @@
<query id="getCategory" action="select">
<tables>
<table name="categories" />
</tables>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="getCategoryDocumentCount" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="getCategoryList" action="select">
<tables>
<table name="categories" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" order="asc" />
</navigation>
</query>

View file

@ -1,11 +0,0 @@
<query id="getDocument" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,19 +0,0 @@
<query id="getDocumentCount" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="and" />
<condition operation="like" column="user_name" var="s_user_name" pipe="and" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="and" />
<condition operation="like_prefix" column="ipaddress" var="s_ipaddress" pipe="and" />
<condition operation="like_prefix" column="regdate" var="s_regdate" pipe="and" />
</group>
</conditions>
</query>

View file

@ -1,26 +0,0 @@
<query id="getDocumentList" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="category_srl" var="category_srl" />
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="or" />
<condition operation="like_prefix" column="ipaddress" var="s_ipaddress" pipe="or" />
<condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" />
</group>
</conditions>
<navigation>
<index var="sort_index" order="asc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -1,12 +0,0 @@
<query id="getDocumentPage" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="more" column="document_srl" var="document_srl" filter="number" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="getDocuments" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -1,14 +0,0 @@
<query id="insertCategory" action="insert">
<tables>
<table name="categories" />
</tables>
<columns>
<column name="category_srl" var="category_srl" filter="number" notnull="notnull" />
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
<column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" />
<column name="document_count" var="document_count" default="0" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="list_order" var="list_order" default="0" />
</columns>
</query>

View file

@ -1,34 +0,0 @@
<query id="insertDocument" action="insert">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="document_srl" var="document_srl" filter="number" notnull="notnull" />
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
<column name="is_notice" var="is_notice" notnull="notnull" default="N" />
<column name="is_secret" var="is_secret" notnull="notnull" default="N" />
<column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" />
<column name="content" var="content" notnull="notnull" minlength="2" maxlength="250" />
<column name="readed_count" var="readed_count" default="0" />
<column name="voted_count" var="voted_count" default="0" />
<column name="comment_count" var="voted_count" default="0" />
<column name="trackback_count" var="voted_count" default="0" />
<column name="uploaded_count" var="uploaded_count" default="0" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="nick_name" var="nick_name" minlength="2" maxlength="40" />
<column name="member_srl" var="member_srl" default="0" filter="number" />
<column name="user_name" var="user_name" default="" minlength="1" maxlength="80" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="tags" var="tags" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" default="0" />
<column name="update_order" var="update_order" default="0" />
<column name="allow_comment" var="allow_comment" default="Y" />
<column name="lock_comment" var="lock_comment" default="N" />
<column name="allow_trackback" var="allow_trackback" default="Y" />
</columns>
</query>

View file

@ -1,13 +0,0 @@
<query id="updateCategory" action="update">
<tables>
<table name="categories" />
</tables>
<columns>
<column name="title" var="title" />
<column name="list_order" var="list_order" />
<column name="last_update" var="last_update" default="curdate()" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,12 +0,0 @@
<query id="updateCategory" action="update">
<tables>
<table name="categories" />
</tables>
<columns>
<column name="document_count" var="document_count" />
<column name="last_update" var="last_update" default="curdate()" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateCommentCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="comment_count" var="comment_count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,31 +0,0 @@
<query id="updateDocument" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
<column name="is_notice" var="is_notice" notnull="notnull" default="N" />
<column name="is_secret" var="is_secret" notnull="notnull" default="N" />
<column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" />
<column name="content" var="content" notnull="notnull" minlength="2" maxlength="250" />
<column name="uploaded_count" var="uploaded_count" default="0" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="nick_name" var="nick_name" minlength="2" maxlength="40" />
<column name="member_srl" var="member_srl" default="0" filter="number" />
<column name="user_name" var="user_name" default="" minlength="1" maxlength="80" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="tags" var="tags" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" />
<column name="update_order" var="update_order" default="0" />
<column name="allow_comment" var="allow_comment" default="Y" />
<column name="lock_comment" var="lock_comment" default="N" />
<column name="allow_trackback" var="allow_trackback" default="Y" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateCategoryDocument" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="category_srl" var="target_category_srl" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="source_category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateReadedCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="readed_count" var="readed_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateTrackbackCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="trackback_count" var="trackback_count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,11 +0,0 @@
<query id="updateVotedCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="voted_count" var="voted_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,9 +0,0 @@
<table name="categories">
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" primary_key="primary_key" />
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
<column name="title" type="varchar" size="250" />
<column name="document_count" type="number" size="11" default="0" notnull="notnull" />
<column name="regdate" type="date" index="idx_regdate" />
<column name="last_update" type="date" />
<column name="list_order" type="number" size="11" notnull="notnull" />
</table>

View file

@ -1,29 +0,0 @@
<table name="documents">
<column name="document_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" index="idx_category_srl" />
<column name="is_notice" type="char" size="1" default="N" notnull="notnull" />
<column name="is_secret" type="char" size="1" default="N" notnull="notnull" />
<column name="title" type="varchar" size="250" />
<column name="content" type="text" notnull="notnull" />
<column name="readed_count" type="number" size="11" default="0" notnull="notnull" />
<column name="voted_count" type="number" size="11" default="0" notnull="notnull" />
<column name="comment_count" type="number" size="11" default="0" notnull="notnull" />
<column name="trackback_count" type="number" size="11" default="0" notnull="notnull" />
<column name="uploaded_count" type="number" size="11" default="0" notnull="notnull" />
<column name="password" type="varchar" size="60" />
<column name="user_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="email_address" type="varchar" size="250" notnull="notnull" />
<column name="homepage" type="varchar" size="250" notnull="notnull" />
<column name="tags" type="text" />
<column name="regdate" type="date" index="idx_regdate" />
<column name="last_update" type="date" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
<column name="list_order" type="number" size="11" notnull="notnull" index="idx_list_order" />
<column name="update_order" type="number" size="11" notnull="notnull" index="idx_update_order" />
<column name="allow_comment" type="char" size="1" default="Y" notnull="notnull" />
<column name="lock_comment" type="char" size="1" default="N" notnull="notnull" />
<column name="allow_trackback" type="char" size="1" default="Y" notnull="notnull" />
</table>