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

This commit is contained in:
zero 2007-02-06 15:11:13 +00:00
parent 2569c554ce
commit c040d4d713
317 changed files with 14496 additions and 0 deletions

View file

@ -0,0 +1,148 @@
<?php
/**
* @file : modules/admin/admin.module.php
* @author : zero <zero@nzeo.com>
* @desc : 기본 모듈중의 하나인 admin module
* Module class에서 상속을 받아서 사용
* action 경우 disp/proc 2가지만 존재하며 이는 action명세서에
* 미리 기록을 하여야
**/
class admin extends Module {
/**
* 모듈의 정보
**/
var $cur_version = "20070130_0.01";
/**
* 기본 action 지정
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
**/
var $default_act = '';
// 모듈에서 사용할 변수들
var $skin = "default";
/**
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
* css/js파일의 load라든지 lang파일 load등을 미리 선언
*
* Init() => 공통
* dispInit() => disp시에
* procInit() => proc시에
*
* $this->module_path는 현재 모듈파일의 위치를 나타낸다
* (ex: $this->module_path = "./modules/admin/";
**/
// 초기화
function init() {/*{{{*/
// admin 모듈의 언어 로드
Context::loadLang($this->module_path.'lang');
// 관리자 모듈 목록을 세팅
$module_list = module_manager::getAdminModuleList();
Context::set('module_list', $module_list);
}/*}}}*/
// disp 초기화
function dispInit() {/*{{{*/
// 접속 사용자에 대한 체크
$oMember = getModule('member');
$logged_info = $oMember->getLoggedInfo();
// 로그인 하지 않았다면 로그인 폼 출력
if(!$oMember->isLogged()) return $this->act = 'dispLogin';
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
Context::set('msg_code', 'msg_is_not_administrator');
return $this->act = 'dispError';
}
// 관리자용 레이아웃으로 변경
$this->setLayoutPath($this->getLayoutPath());
$this->setLayoutTpl($this->getLayoutTpl());
return true;
}/*}}}*/
// proc 초기화
function procInit() {/*{{{*/
// 로그인/로그아웃 act의 경우는 패스~
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
// 접속 사용자에 대한 체크
$oMember = getModule('member');
$logged_info = $oMember->getLoggedInfo();
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
$this->setError(-1);
$this->setMessage('msg_is_not_administrator');
return false;
}
return true;
}/*}}}*/
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
*
* 변수의 사용은 Context::get('이름')으로 얻어오면 된다
**/
// 출력부분
function dispAdminIndex() {/*{{{*/
$this->setTemplateFile('index');
}/*}}}*/
function dispLogin() {/*{{{*/
if(Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('login_form');
}/*}}}*/
function dispLogout() {/*{{{*/
if(!Context::get('is_logged')) return $this->dispAdminIndex();
$this->setTemplateFile('logout');
}/*}}}*/
function dispError() {/*{{{*/
Context::set('error_msg', Context::getLang( Context::get('msg_code') ) );
$this->setTemplateFile('error');
}/*}}}*/
// 실행부분
function procLogin() {/*{{{*/
// 아이디, 비밀번호를 받음
$user_id = Context::get('user_id');
$password = Context::get('password');
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogin($user_id, $password);
}/*}}}*/
function procLogout() {/*{{{*/
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogout();
}/*}}}*/
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
**/
function getLayoutPath() {/*{{{*/
return $this->template_path;
}/*}}}*/
function getLayoutTpl() {/*{{{*/
return "layout.html";
}/*}}}*/
}
?>

View file

@ -0,0 +1,9 @@
<?php
/**
* @file : modules/member/lang/ko.lang.php
* @author : zero <zero@nzeo.com>
* @desc : 한국어 언어팩 (기본적인 내용만 수록)
**/
$lang->msg_is_not_administrator = '관리자만 접속이 가능합니다';
?>

11
modules/admin/module.xml Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">관리자 툴</title>
<title xml:lang="en">Admin tool</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">Admin tool</description>
</author>
<module>

View file

@ -0,0 +1,22 @@
#admin_title {
font-weight:bold;
float:left;
height:30px;
}
#admin_info {
float:right;
height:30px;
}
#admin_module_list {
clear:both;
float:left;
}
#admin_module_content {
position:relative;
margin-left:150px;
left:0px;
top:30px;
}

View file

@ -0,0 +1 @@
{$error_msg}

View file

@ -0,0 +1,10 @@
<filter id="login">
<field>
<item target="user_id" required="true" filter="user_id"/>
<item target="password" required="true" />
</field>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1,12 @@
<filter id="logout">
<field>
<item target="act" required="true" />
</field>
<parameter>
<item param="act" target="act" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1 @@
haha

View file

@ -0,0 +1,27 @@
/**
* @file : modules/admin/js/admin.js
* @author : zero <zero@nzeo.com>
* @desc : admin 모듈의 javascript
**/
// 현재 페이지 reload
function procReload(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
location.href = location.href;
}
// 로그아웃
function procLogout(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
location.href = "./admin.php";
}
// 로그인폼에서 아이디 포커스
function procAdminLoginFocus() {
var fo = xGetElementById('user_id');
if(fo) fo.focus();
}

View file

@ -0,0 +1,21 @@
<!--%import("css/admin.css")-->
<!--%import("js/admin.js")-->
<!--#include("./common/tpl/common_header.html")-->
<div id="admin_title"><a href="./admin.php">zeroboard5</a></div>
<div id="admin_info">
<a href="{getUrl('act','dispLogout')}">{$lang->cmd_logout}</a>
</div>
<div id="admin_module_list">
<!--@foreach($module_list as $module_name => $module_title)-->
<div <!--@if($module_name==$sid)-->style="font-weight:bold;"<!--@end-->>
<a href="{getUrl('sid',$module_name,'act','','module_srl','','page','')}">{$module_title}</a>
</div>
<!--@end-->
</div>
<div id="admin_module_content">
{$content}
</div>
<!--#include("./common/tpl/common_footer.html")-->

View file

@ -0,0 +1,30 @@
<!--%import("filter/filter.login.xml")-->
<!--%import("js/admin.js")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, login, procReload)">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procLogin" />
<table>
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->user_id}</th>
<td><input type="text" name="user_id" id="user_id" /></td>
</tr>
<tr>
<th>{$lang->password}</th>
<td><input type="password" name="password" value="" /></td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_login}" />
</td>
</tr>
</table>
</form>
<script type="text/javascript">
xAddEventListener(window, 'load', procAdminLoginFocus);
</script>

View file

@ -0,0 +1,21 @@
<!--%import("filter/filter.logout.xml")-->
<!--%import("js/admin.js")-->
<form action="./admin.php" method="get" onsubmit="return procFormFilter(this, logout, procLogout)">
<input type="hidden" name="act" value="procLogout" />
<table>
<tr>
<th>{$lang->cmd_logout}</th>
</tr>
<tr>
<td>{$lang->confirm_logout}</td>
</tr>
<tr>
<td>
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_logout}" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,57 @@
<!--%import("filter/filter.insert_category.xml")-->
<!--%import("filter/filter.update_category.xml")-->
<!--#include("./header.html")-->
<!-- 카테고리의 위/아래, 삭제와 관련된 form -->
<form id="fo_category_info" action="./admin.php" method="post">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procUpdateCategory" />
<input type="hidden" name="category_srl" value="" />
<input type="hidden" name="mode" value="" />
</form>
<div>
<table>
<tr>
<th>{$lang->category_title}</th>
<th>{$lang->document_count}</th>
<th>{$lang->last_update}</th>
<th>{$lang->cmd_modify}</th>
<th colspan="2">{$lang->cmd_move}</th>
<th>{$lang->cmd_delete}</th>
</tr>
<!--@if(!count($category_list))-->
<tr>
<td colspan="7">{$lang->msg_category_is_null}</td>
</tr>
<!--@end-->
<!--@foreach($category_list as $category_srl => $category_info)-->
<tr>
<td>{$category_info->title}</td>
<td>{number_format($category_info->document_count)}</td>
<td>{zdate($category_info->last_update,"Y-m-d H:i:s")}</td>
<td><a href="{getUrl('category_srl',$category_info->category_srl)}">{$lang->cmd_modify}</a></td>
<td><a href="#" onclick="doUpdateCategory('{$category_info->category_srl}','up');return false;">{$lang->cmd_move_up}</a></td>
<td><a href="#" onclick="doUpdateCategory('{$category_info->category_srl}','down');return false;">{$lang->cmd_move_down}</a></td>
<td><a href="#" onclick="doUpdateCategory('{$category_info->category_srl}','delete','{$lang->confirm_delete}');return false;">{$lang->cmd_delete}</a></td>
</tr>
<!--@end-->
</table>
</div>
<!-- 카테고리 추가 -->
<form action="./admin.php" method="post" onsubmit="return procFormFilter(this, insert_category, procInsert)" enctype="multipart/form-data">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procInsertCategory" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="category_srl" value="" />
<div>
{$lang->category_title} :
<input type="text" name="category_title" />
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</div>
</form>

View file

@ -0,0 +1,21 @@
<!--%import("filter/filter.update_category.xml")-->
<!--#include("./header.html")-->
<!-- 카테고리 수정 -->
<!--@if($selected_category)-->
<form action="./admin.php" method="post" onsubmit="return procFormFilter(this, update_category, procUpdateCategory)" enctype="multipart/form-data">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procUpdateCategory" />
<input type="hidden" name="category_srl" value="{$selected_category->category_srl}" />
<input type="hidden" name="mode" value="update" />
<div style="margin-bottom:30px">
{$lang->category_title} :
<input type="text" name="category_title" value="{$selected_category->title}" />
<input type="submit" value="{$lang->cmd_modify}" />
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('category_srl','')}'" />
</div>
</form>
<!--@end-->

View file

@ -0,0 +1,34 @@
<!--%import("filter/filter.delete_module.xml")-->
<!--%import("js/admin.js")-->
<form action="./admin.php" method="get" onsubmit="return procFormFilter(this, delete_module, procDelete)">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procDelete" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
<table>
<tr>
<th colspan="2">{$lang->confirm_delete}</th>
</tr>
<tr>
<th>{$lang->module_name}</th>
<td>{$module_info->mid}</td>
</tr>
<tr>
<th>{$lang->module}</th>
<td>{$module_info->module}</td>
</tr>
<tr>
<th>{$lang->document_count}</th>
<td>{$module_info->document_count}</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_delete}" />
<input type="button" value="{$lang->cmd_back}" onclick="location.href='{@getUrl('act','')}'" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,15 @@
<filter id="delete">
<field>
<item target="sid" required="true" />
<item target="act" required="true" />
<item target="module_srl" required="true" />
<item target="page" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="sid" />
<item name="act" />
<item name="page" />
</response>
</filter>

View file

@ -0,0 +1,16 @@
<filter id="insert" confirm_msg_code="confirm_submit">
<field>
<item target="sid" required="true" />
<item target="act" required="true" />
<item target="mid" required="true" filter="alpha_number" />
<item target="browser_title" required="true" maxlength="250" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="sid" />
<item name="act" />
<item name="page" />
<item name="module_srl" />
</response>
</filter>

View file

@ -0,0 +1,16 @@
<filter id="insert_category" confirm_msg_code="confirm_submit">
<field>
<item target="sid" required="true" />
<item target="act" required="true" />
<item target="module_srl" required="true" />
<item target="category_title" required="true" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="sid" />
<item name="act" />
<item name="page" />
<item name="module_srl" />
</response>
</filter>

View file

@ -0,0 +1,15 @@
<filter id="insert_grant" confirm_msg_code="confirm_submit">
<field>
<item target="sid" required="true" />
<item target="act" required="true" />
<item target="module_srl" required="true" filter="number" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="sid" />
<item name="act" />
<item name="page" />
<item name="module_srl" />
</response>
</filter>

View file

@ -0,0 +1,13 @@
<filter id="update_category">
<field>
<item target="sid" required="true" />
<item target="act" required="true" />
<item target="category_srl" required="true" />
<item target="mode" required="true" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="module_srl" />
</response>
</filter>

View file

@ -0,0 +1,45 @@
<!--#include("./header.html")-->
<!--%import("filter/filter.insert_grant.xml")-->
<form action="./admin.php" method="post" onsubmit="return procFormFilter(this, insert_grant, procInsertGrant)">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procInsertGrant" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<div>
{$lang->about_grant}
</div>
<table>
<tr>
<th>{$lang->grant}</th>
<th>{$lang->target}</th>
</tr>
<!--@foreach($grant_list as $key => $val)-->
<tr>
<td>{$lang->grant_title[$val]}</td>
<td>
<div>
<!--@foreach($group_list as $k => $v)-->
<span>
<input type="checkbox" name="{$val}" value="{$v->group_srl}" id="grant_{$val}_{$v->group_srl}" <!--@if(is_array($module_info->grant)&&in_array($v->group_srl,$module_info->grant[$val]))-->checked="true"<!--@end-->/>
<label for="grant_{$val}_{$v->group_srl}">{$v->title}</label>
</span>
<!--@end-->
</div>
<div>
<input type="button" value="{$lang->cmd_select_all}" onclick="procSelectAll(this, '{$val}')"/>
<input type="button" value="{$lang->cmd_unselect_all}" onclick="procUnSelectAll(this, '{$val}')"/>
</div>
</td>
</tr>
<!--@end-->
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_save}" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,14 @@
<!--%import("js/admin.js")-->
<div style="margin-bottom:20px;">
<span>[<a href="{getUrl('act','','module_srl','')}">{$lang->cmd_list}</a>]</span>
<span <!--@if($act=='dispInfo')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispInfo')}">{$lang->cmd_view_info}</a>]</span>
<span <!--@if($act=='dispCategoryInfo')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispCategoryInfo')}">{$lang->cmd_manage_category}</a>]</span>
<span <!--@if($act=='dispGrantInfo')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispGrantInfo')}">{$lang->cmd_manage_grant}</a>]</span>
<span <!--@if($act=='dispSkinInfo')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispSkinInfo')}">{$lang->cmd_manage_skin}</a>]</span>
</div>
<div style="margin-bottom:20px;font-weight:bold;">
{$lang->mid} : {$module_info->mid}
(<a href="./?mid={$module_info->mid}" target="_blank">{$lang->cmd_move}</a>)
<!--@if($module_info->is_default=='Y')-->[{$lang->is_default}]<!--@end-->
</div>

View file

@ -0,0 +1,37 @@
<!--#include("header.html")-->
<table>
<tr>
<th>{$lang->skin}</th>
<td>{$module_info->skin}</td>
</tr>
<tr>
<th>{$lang->use_category}</th>
<td><!--@if($module_info->use_category=='Y')-->{$lang->use}<!--@else-->{$lang->notuse}<!--@end--></td>
</tr>
<tr>
<th>{$lang->browser_title}</th>
<td>{$module_info->browser_title}</td>
</tr>
<tr>
<th>{$lang->description}</th>
<td>{nl2br($module_info->description)}</td>
</tr>
<tr>
<th>{$lang->header_text}</th>
<td>{$module_info->header_text}</td>
</tr>
<tr>
<th>{$lang->footer_text}</th>
<td>{$module_info->footer_text}</td>
</tr>
<tr>
<th>{$lang->admin_id}</th>
<td>{$module_info->admin_id}</td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_modify}" onclick="location.href='{getUrl('act','dispInsert')}'" />
</td>
</tr>
</table>

View file

@ -0,0 +1,99 @@
<!--%import("filter/filter.insert.xml")-->
<!--%import("js/admin.js")-->
<div>
<!--@if(!$module_srl)-->
{$lang->msg_new_module}
<!--@else-->
{$lang->msg_update_module}
<!--@end-->
</div>
<form action="./admin.php" method="post" onsubmit="return procFormFilter(this, insert, procInsert)" enctype="multipart/form-data">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procInsert" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<!--@if($module_info->is_default=='Y')-->
<input type="hidden" name="is_default" value="Y" />
<!--@end-->
<table>
<tr>
<th rowspan="2">{$lang->mid}</th>
<td><input type="text" name="mid" value="{$module_info->mid}" /></td>
</tr>
<tr>
<td>{$lang->about_mid}</td>
</tr>
<tr>
<th rowspan="2">{$lang->skin}</th>
<td>
<select name="skin">
<!--@foreach($skins as $key=>$val)-->
<option value="{$val}">{$val}</option>
<!--@end-->
</select>
</td>
</tr>
<tr>
<td>{$lang->about_skin}</td>
</tr>
<tr>
<th rowspan="2">{$lang->use_category}</th>
<td><input type="checkbox" name="use_category" value="Y" <!--@if($module_info->use_category=='Y')-->checked="true"<!--@end--> /></td>
</tr>
<tr>
<td>{$lang->about_use_category}</td>
</tr>
<tr>
<th rowspan="2">{$lang->browser_title}</th>
<td><input type="text" name="browser_title" value="{$module_info->browser_title}" /></td>
</tr>
<tr>
<td>{$lang->about_browser_title}</td>
</tr>
<!--@if($module_info->is_default!='Y')-->
<tr>
<th rowspan="2">{$lang->is_default}</th>
<td><input type="checkbox" name="is_default" value="Y" <!--@if($module_info->is_default=='Y')-->checked="true"<!--@end-->/></td>
</tr>
<tr>
<td>{$lang->about_default}</td>
</tr>
<!--@end-->
<tr>
<th rowspan="2">{$lang->description}</th>
<td><textarea name="description">{htmlspecialchars($module_info->description)}</textarea></td>
</tr>
<tr>
<td>{$lang->about_description}</td>
</tr>
<tr>
<th rowspan="2">{$lang->header_text}</th>
<td><textarea name="header_text">{htmlspecialchars($module_info->header_text)}</textarea></td>
</tr>
<tr>
<td>{$lang->about_header_text}</td>
</tr>
<tr>
<th rowspan="2">{$lang->footer_text}</th>
<td><textarea name="footer_text">{htmlspecialchars($module_info->footer_text)}</textarea></td>
</tr>
<tr>
<td>{$lang->about_footer_text}</td>
</tr>
<tr>
<th rowspan="2">{$lang->admin_id}</th>
<td><textarea name="admin_id">{$module_info->admin_id}</textarea></td>
</tr>
<tr>
<td>{$lang->about_admin_id}</td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('act','dispInfo')}'" />
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,95 @@
/**
* @file : modules/board/js/admin.js
* @author : zero <zero@nzeo.com>
* @desc : board 모듈의 관리자용 javascript
**/
/* 모듈 생성 후 */
function procInsert(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var sid = ret_obj['sid'];
var act = ret_obj['act'];
var page = ret_obj['page'];
var module_srl = ret_obj['module_srl'];
alert(message);
url = "./admin.php?sid="+sid+"&module_srl="+module_srl+"&page="+page+"&act="+act;
location.href = url;
}
/* 모듈 삭제 후 */
function procDelete(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var sid = ret_obj['sid'];
var act = ret_obj['act'];
var page = ret_obj['page'];
alert(message);
url = "./admin.php?sid="+sid+"&page="+page+"&act="+act;
location.href = url;
}
/* 카테고리 관련 작업들 */
function doUpdateCategory(category_srl, mode, message) {
if(typeof(message)!='undefined'&&!confirm(message)) return;
var fo_obj = xGetElementById('fo_category_info');
fo_obj.category_srl.value = category_srl;
fo_obj.mode.value = mode;
procFormFilter(fo_obj, update_category, procReload);
}
/* 카테고리 정보 수정 후 */
function procUpdateCategory(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var module_srl = ret_obj['module_srl'];
alert(message);
var url = "./admin.php?sid=board&module_srl="+module_srl+"&act=dispCategoryInfo";
location.href = url;
}
/* 메세지 출력후 현페이지 리로드 */
function procReload(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
if(message) alert(message);
location.href = location.href;
}
/* 권한 관련 */
function procSelectAll(obj, key) {
var fo_obj = obj.parentNode;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
for(var i=0;i<fo_obj.length;i++) {
var tobj = fo_obj[i];
if(tobj.name == key) tobj.checked=true;
}
}
function procUnSelectAll(obj, key) {
var fo_obj = obj.parentNode;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
for(var i=0;i<fo_obj.length;i++) {
var tobj = fo_obj[i];
if(tobj.name == key) tobj.checked = false;
}
}
function procInsertGrant(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var sid = ret_obj['sid'];
var act = ret_obj['act'];
var page = ret_obj['page'];
var module_srl = ret_obj['module_srl'];
alert(message);
url = "./admin.php?sid="+sid+"&module_srl="+module_srl+"&page="+page+"&act="+act;
location.href = url;
}

View file

@ -0,0 +1,58 @@
<!--%import("js/admin.js")-->
<!-- 게시판 정보 -->
<div>
{number_format($total_count)},
{$lang->page_count} : {number_format($page)} / {number_format($total_page)}
</div>
<!-- 목록 -->
<div>
<table>
<tr>
<th>{$lang->no}</th>
<th>{$lang->mid}</th>
<th>{$lang->browser_title}</th>
<th>{$lang->is_default}</th>
<th>{$lang->skin}</th>
<th>{$lang->admin_id}</th>
<th>{$lang->regdate}</th>
<th>{$lang->cmd_move}</th>
<th>{$lang->cmd_delete}</th>
</tr>
<!--@foreach($board_list as $no => $val)-->
<tr>
<td>{$no}</td>
<td><a href="{getUrl('act','dispInfo','module_srl',$val->module_srl)}">{$val->mid}</a></td>
<td>{$val->browser_title}</td>
<td>{$val->is_default}</td>
<td>{$val->skin}</td>
<td>{$val->admin_id}</td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
<td><a href="./?mid={$val->mid}" target="_blank">{$lang->cmd_move}</a></td>
<td><!--@if($val->is_default!='Y')--><a href="{getUrl('act','dispDeleteForm','module_srl', $val->module_srl)}">{$lang->cmd_delete}</a><!--@end--></td>
</tr>
<!--@end-->
</table>
</div>
<!-- 버튼 -->
<div>
[<a href="{getUrl('act','dispInsert','module_srl','')}">{$lang->cmd_make}</a>]
</div>
<!-- 페이지 네비게이션 -->
<div>
<a href="{getUrl('page','','module_srl','')}">[{$lang->first_page}]</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
{$page_no}
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl','')}">[{$page_no}]</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}">[{$lang->last_page}]</a>
</div>

View file

@ -0,0 +1,119 @@
<!--#include("./header.html")-->
<form action="./admin.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="sid" value="{$sid}" />
<input type="hidden" name="act" value="procUpdateSkinInfo" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="page" value="{$page}" />
<div style="margin-bottom:10px;">
<table>
<tr>
<th colspan="2">{$lang->skin_default_info}</th>
</tr>
<tr>
<th>{$lang->skin}</th>
<td>{$skin_info->title}</td>
</tr>
<tr>
<th>{$lang->skin_maker}</th>
<td>{$skin_info->maker->name} (<a href="mailto:{$skin_info->maker->email_address}">{$skin_info->maker->email_address}</a>)</td>
</tr>
<tr>
<th>{$lang->skin_maker_homepage}</th>
<td><a href="{$skin_info->maker->homepage}" target="_blank">{$skin_info->maker->homepage}</a></td>
</tr>
<tr>
<th>{$lang->date}</th>
<td>{$skin_info->maker->date}</td>
</tr>
<tr>
<th>{$lang->description}</th>
<td>{nl2br($skin_info->maker->description)}</td>
</tr>
<tr valign="top">
<th>{$lang->colorset}</th>
<td>
<!--@foreach($skin_info->colorset as $key => $val)-->
<div>
<!--@if($val->screenshot)-->
<img src="{$val->screenshot}" align="left" alt="{$val->title}" />
<!--@end-->
<input type="radio" name="colorset" value="{$val->name}" id="colorset_{$key}" <!--@if($module_info->colorset==$val->name)-->checked="true"<!--@end-->/>
<label for="colorset_{$key}">{$val->title}</label>
</div>
<!--@end-->
</td>
</tr>
</table>
</div>
<!--@if($skin_info->extra_vars)-->
<div>
<table>
<tr>
<th colspan="2">{$lang->extra_vars}</th>
</tr>
<!--@foreach($skin_info->extra_vars as $key => $val)-->
<tr>
<th <!--@if($val->description)-->rowspan="2"<!--@end-->>{$val->title}</th>
<td>
<!--@if($val->type=="text")-->
<input type="text" name="{$val->name}" value="{$val->value}" />
<!--@elseif($val->type=="textarea")-->
<textarea name="{$val->name}">{$val->value}</textarea>
<!--@elseif($val->type=="select")-->
<select name="{$val->name}">
<!--@foreach($val->default as $k=>$v)-->
<option value="{$v}" <!--@if($v==$val->value)-->selected="true"<!--@end-->>{$v}</option>
<!--@end-->
</select>
<!--@elseif($val->type=="checkbox")-->
<!--@foreach($val->default as $k=>$v)-->
<span>
<input type="checkbox" name="{$val->name}[]" value="{$v}" id="ch_{$key}_{$k}" <!--@if(in_array($v, $val->value))-->checked="true"<!--@end-->/>
<label for="ch_{$key}_{$k}">{$v}</label>
</span>
<!--@end-->
<!--@elseif($val->type=="radio")-->
<!--@foreach($val->default as $k=>$v)-->
<span>
<input type="radio" name="{$val->name}" value="{$v}" id="ch_{$key}_{$k}" <!--@if($v==$val->value)-->checked="true"<!--@end-->/>
<label for="ch_{$key}_{$k}">{$v}</label>
</span>
<!--@end-->
<!--@elseif($val->type=="image")-->
<!--@if($val->value)-->
<div>
<img src="{$val->value}" /><br />
<input type="checkbox" name="del_{$val->name}" value="Y" id="del_{$val->name}" />
<label for="del_{$val->name}">{$lang->cmd_delete}</label>
</div>
<!--@end-->
<input type="file" name="{$val->name}" value="" />
<!--@end-->
</td>
</tr>
<!--@if($val->description)-->
<tr>
<td>{nl2br($val->description)}</td>
</tr>
<!--@end-->
<!--@end-->
</table>
</div>
<!--@end-->
<div>
<input type="submit" value="{$lang->cmd_registration}" />
</div>
</form>

View file

@ -0,0 +1,403 @@
<?php
/**
* @file : modules/board/board.admin.php
* @author : zero <zero@nzeo.com>
* @desc : board의 관리자 파일
* Module class에서 상속을 받아서 사용
* action 경우 disp/proc 2가지만 존재하며 이는 action명세서에
* 미리 기록을 하여야
**/
class board_admin extends Module {
/**
* 기본 action 지정
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
**/
var $default_act = 'dispContent';
/**
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
* css/js파일의 load라든지 lang파일 load등을 미리 선언
*
* Init() => 공통
* dispInit() => disp시에
* procInit() => proc시에
*
* $this->module_path는 현재 모듈파일의 위치를 나타낸다
* (ex: $this->module_path = "./modules/system_install/";
**/
// 초기화
function init() {/*{{{*/
// 기본 정보를 읽음
Context::loadLang($this->module_path.'lang');
// 스킨의 종류를 읽음
$oModule = getModule('module_manager');
$skins = $oModule->getSkins($this->module_path);
Context::set('skins', $skins);
}/*}}}*/
// disp 초기화
function dispInit() {/*{{{*/
// module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
$module_srl = Context::get('module_srl');
if($module_srl) {
$oModule = getModule('module_manager');
$module_info = $oModule->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) {
Context::set('module_srl','');
$this->act = 'dispContent';
} else Context::set('module_info',$module_info);
}
return true;
}/*}}}*/
// proc 초기화
function procInit() {/*{{{*/
return true;
}/*}}}*/
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
**/
// 출력 부분
function dispContent() {/*{{{*/
// 등록된 board 모듈을 불러와 세팅
$oDB = &DB::getInstance();
$args->sort_index = "module_srl";
$args->page = Context::get('page');
$args->list_count = 40;
$args->page_count = 10;
$output = $oDB->executeQuery('board.getBoardList', $args);
// 템플릿에 쓰기 위해서 context::set
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('board_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿 파일 지정
$this->setTemplateFile('list');
}/*}}}*/
function dispInfo() {/*{{{*/
if(!Context::get('module_srl')) return $this->dispContent();
// 템플릿 파일 지정
$this->setTemplateFile('info');
}/*}}}*/
function dispCategoryInfo() {/*{{{*/
$module_srl = Context::get('module_srl');
// 카테고리의 목록을 구해옴
$oDocument = getModule('document');
$category_list = $oDocument->getCategoryList($module_srl);
Context::set('category_list', $category_list);
// 수정하려는 카테고리가 있다면해당 카테고리의 정보를 가져옴
$category_srl = Context::get('category_srl');
if($category_srl) {
$selected_category = $oDocument->getCategory($category_srl);
if(!$selected_category) Context::set('category_srl','');
else Context::set('selected_category',$selected_category);
$this->setTemplateFile('category_update_form');
} else {
$this->setTemplateFile('category_list');
}
}/*}}}*/
function dispGrantInfo() {/*{{{*/
$module_srl = Context::get('module_srl');
// 현 모듈의 권한 목록을 가져옴
$oBoard = getModule('board');
$grant_list = $oBoard->grant_list;
// 권한 목록 세팅
Context::set('grant_list', $grant_list);
// 권한 그룹의 목록을 가져온다
$oMember = getModule('member');
$group_list = $oMember->getGroups();
Context::set('group_list', $group_list);
$this->setTemplateFile('grant_list');
}/*}}}*/
function dispSkinInfo() {/*{{{*/
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
$module_info = Context::get('module_info');
$skin = $module_info->skin;
$oModule = getModule('module_manager');
$skin_info = $oModule->loadSkinInfo($this->module_path, $skin);
// skin_info에 extra_vars 값을 지정
if(count($skin_info->extra_vars)) {
foreach($skin_info->extra_vars as $key => $val) {
$name = $val->name;
$type = $val->type;
$value = $module_info->{$name};
if($type=="checkbox"&&!$value) $value = array();
$skin_info->extra_vars[$key]->value= $value;
}
}
Context::set('skin_info', $skin_info);
$this->setTemplateFile('skin_info');
}/*}}}*/
function dispInsert() {/*{{{*/
// 템플릿 파일 지정
$this->setTemplateFile('insert_form');
}/*}}}*/
function dispDeleteForm() {/*{{{*/
if(!Context::get('module_srl')) return $this->dispContent();
$module_info = Context::get('module_info');
$oDocument = getModule('document');
$document_count = $oDocument->getDocumentCount($module_info->module_srl);
$module_info->document_count = $document_count;
Context::set('module_info',$module_info);
// 템플릿 파일 지정
$this->setTemplateFile('delete_form');
}/*}}}*/
// 실행 부분
function procInsert() {/*{{{*/
// 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리
$args = Context::gets('module_srl','mid','skin','use_category','browser_title','description','is_default','header_text','footer_text','admin_id');
$args->module = 'board';
if($args->is_default!='Y') $args->is_default = 'N';
if($args->use_category!='Y') $args->use_category = 'N';
// 기본 값외의 것들을 정리
$extra_var = delObjectVars(Context::getRequestVars(), $args);
unset($extra_var->sid);
unset($extra_var->act);
unset($extra_var->page);
// module_srl이 있으면 원본을 구해온다
$oModule = getModule('module_manager');
// module_srl이 넘어오면 원 모듈이 있는지 확인
if($args->module_srl) {
$module_info = $oModule->getModuleInfoByModuleSrl($args->module_srl);
// 만약 원래 모듈이 없으면 새로 입력하기 위한 처리
if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
}
// $extra_var를 serialize
$args->extra_var = serialize($extra_var);
// is_default=='Y' 이면
if($args->is_default=='Y') $oModule->clearDefaultModule();
// module_srl의 값에 따라 insert/update
if(!$args->module_srl) {
$output = $oModule->insertModule($args);
$msg_code = 'success_registed';
} else {
$output = $oModule->updateModule($args);
$msg_code = 'success_updated';
}
if(!$output->toBool()) return $output;
$this->add('sid','board');
$this->add('act','dispInfo');
$this->add('page',Context::get('page'));
$this->add('module_srl',$output->get('module_srl'));
$this->setMessage($msg_code);
}/*}}}*/
function procDelete() {/*{{{*/
$module_srl = Context::get('module_srl');
// 원본을 구해온다
$oModule = getModule('module_manager');
$output = $oModule->deleteModule($module_srl);
if(!$output->toBool()) return $output;
$this->add('sid','board');
$this->add('act','dispContent');
$this->add('page',Context::get('page'));
$this->setMessage('success_deleted');
}/*}}}*/
function procInsertCategory() {/*{{{*/
// 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리
$module_srl = Context::get('module_srl');
$category_title = Context::get('category_title');
// module_srl이 있으면 원본을 구해온다
$oDocument = getModule('document');
$output = $oDocument->insertCategory($module_srl, $category_title);
if(!$output->toBool()) return $output;
$this->add('sid','board');
$this->add('act','dispCategoryInfo');
$this->add('page',Context::get('page'));
$this->add('module_srl',$module_srl);
$this->setMessage('success_registed');
}/*}}}*/
function procUpdateCategory() {/*{{{*/
$category_srl = Context::get('category_srl');
$mode = Context::get('mode');
$oDocument = getModule('document');
switch($mode) {
case 'up' :
$output = $oDocument->moveCategoryUp($category_srl);
$msg_code = 'success_moved';
break;
case 'down' :
$output = $oDocument->moveCategoryDown($category_srl);
$msg_code = 'success_moved';
break;
case 'delete' :
$output = $oDocument->deleteCategory($category_srl);
$msg_code = 'success_deleted';
break;
case 'update' :
$selected_category = $oDocument->getCategory($category_srl);
$args->category_srl = $selected_category->category_srl;
$args->title = Context::get('category_title');
$args->list_order = $selected_category->list_order;
$output = $oDocument->updateCategory($args);
$msg_code = 'success_updated';
break;
}
if(!$output->toBool()) return $output;
$this->add('module_srl', $selected_category->module_srl);
$this->setMessage($msg_code);
}/*}}}*/
function procUpdateSkinInfo() {/*{{{*/
// module_srl에 해당하는 정보들을 가져오기
$module_srl = Context::get('module_srl');
$oModule = getModule('module_manager');
$module_info = $oModule->getModuleInfoByModuleSrl($module_srl);
$skin = $module_info->skin;
// 스킨의 정볼르 구해옴 (extra_vars를 체크하기 위해서)
$oModule = getModule('module_manager');
$skin_info = $oModule->loadSkinInfo($this->module_path, $skin);
// 입력받은 변수들을 체크 (sid, act, module_srl, page등 기본적인 변수들 없앰)
$obj = Context::getRequestVars();
unset($obj->sid);
unset($obj->act);
unset($obj->module_srl);
unset($obj->page);
// 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// 삭제 요청에 대한 변수를 구함
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
@unlink($module_info->{$vars->name});
continue;
}
// 업로드 되지 않았다면 이전 데이터를 그대로 사용
if(!$image_obj['tmp_name']) {
$obj->{$vars->name} = $module_info->{$vars->name};
continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
if(!is_uploaded_file($image_obj['tmp_name'])) {
unset($obj->{$vars->name});
continue;
}
// 이미지 파일이 아니어도 무시
if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) {
unset($obj->{$vars->name});
continue;
}
// 경로를 정해서 업로드
$path = sprintf("./files/attach/images/%s/", $module_srl);
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
$filename = $path.$image_obj['name'];
// 파일 이동
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
unset($obj->{$vars->name});
continue;
}
// 변수를 바꿈
unset($obj->{$vars->name});
$obj->{$vars->name} = $filename;
}
}
// serialize하여 저장
$extra_vars = serialize($obj);
$oModule = getModule('module_manager');
$oModule->updateModuleExtraVars($module_srl, $extra_vars);
$url = sprintf("./admin.php?sid=%s&module_srl=%s&act=dispSkinInfo&page=%s", 'board', $module_srl, Context::get('page'));
print "<script type=\"text/javascript\">location.href=\"".$url."\";</script>";
exit();
}/*}}}*/
function procInsertGrant() {/*{{{*/
$module_srl = Context::get('module_srl');
// 현 모듈의 권한 목록을 가져옴
$oBoard = getModule('board');
$grant_list = $oBoard->grant_list;
if(count($grant_list)) {
foreach($grant_list as $grant) {
$arr_grant[$grant] = explode(',',Context::get($grant));
}
$grant = serialize($arr_grant);
}
$oModule = getModule('module_manager');
$oModule->updateModuleGrant($module_srl, $grant);
$this->add('sid','board');
$this->add('act','dispGrantInfo');
$this->add('page',Context::get('page'));
$this->add('module_srl',Context::get('module_srl'));
$this->setMessage('success_registed');
}/*}}}*/
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
**/
}
?>

View file

@ -0,0 +1,667 @@
<?php
/**
* @file : modules/board/board.module.php
* @author : zero <zero@nzeo.com>
* @desc : 기본 모듈중의 하나인 board module
* Module class에서 상속을 받아서 사용
* action 경우 disp/proc 2가지만 존재하며 이는 action명세서에
* 미리 기록을 하여야
**/
class board extends Module {
/**
* 기본 action 지정
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
**/
var $default_act = 'dispContent';
// 검색 옵션
var $search_option = array('title','content','title_content','user_name');
// 모듈에서 사용할 변수들
var $skin = "default";
var $list_count = 3;
var $page_count = 10;
var $category_list = NULL;
// 권한의 종류를 미리 설정
var $grant_list = array(
'list',
'view',
'write_document',
'write_comment',
'fileupload',
'management',
);
// 에디터
var $editor = 'default';
/**
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
* css/js파일의 load라든지 lang파일 load등을 미리 선언
*
* Init() => 공통
* dispInit() => disp시에
* procInit() => proc시에
*
* $this->module_path는 현재 모듈파일의 위치를 나타낸다
* (ex: $this->module_path = "./modules/system_install/";
**/
// 초기화
function init() {/*{{{*/
}/*}}}*/
// disp 초기화
function dispInit() {/*{{{*/
// lang
Context::loadLang($this->template_path.'lang/');
// 카테고리를 사용한다면 카테고리 목록을 구해옴
if($this->module_info->use_category=='Y') {
$oDocument = getModule('document');
$this->category_list = $oDocument->getCategoryList($this->module_srl);
Context::set('category_list', $this->category_list);
}
// 에디터 세팅
Context::set('editor', $this->editor);
$editor_path = sprintf("./editor/%s/", $this->editor);
Context::set('editor_path', $editor_path);
Context::loadLang($editor_path);
return true;
}/*}}}*/
// proc 초기화
function procInit() {/*{{{*/
// lang
Context::loadLang($this->template_path.'lang/');
// 파일 업로드일 경우 $act값을 procUploadFile() 로 변경
if(Context::isUploaded()) $this->act = 'procUploadFile';
return true;
}/*}}}*/
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 error, message가 지정되어야 한다
**/
// 출력 부분
function dispContent() {/*{{{*/
// 목록 구현에 필요한 변수들을 가져온다
$document_srl = Context::get('document_srl');
$page = Context::get('page');
// document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;
$oDocument = getModule('document');
// document_srl이 있다면 해당 글을 구해오자
if($document_srl) {
$document = $oDocument->getDocument($document_srl);
// 글이 찾아지지 않으면 무효화
if(!$document) {
Context::set('document_srl','');
$document_srl = NULL;
unset($document);
}
}
// 글이 찾아지면 조회수 업데이트 및 기타 등등
if($document) {
// 비밀글이고 권한이 없을 경우 인증페이지로
if($document->is_secret=='Y' && !$document->is_granted) return $this->setTemplateFile('input_password_form');
// 조회수 업데이트
if($oDocument->updateReadedCount($document_srl)) $document->readed_count++;
// 댓글 가져오기
if($document->comment_count && $document->allow_comment == 'Y') {
$oComment = getModule('comment');
$comment_list = $oComment->getCommentList($document_srl);
Context::set('comment_list', $comment_list);
}
// 트랙백 가져오기
if($document->trackback_count && $document->allow_trackback == 'Y') {
$oTrackback = getModule('trackback');
$trackback_list = $oTrackback->getTrackbackList($document_srl);
Context::set('trackback_list', $trackback_list);
}
// 첨부파일 가져오기
if($document->uploaded_count) {
$file_list = $oDocument->getFiles($document_srl);
$document->uploaded_list = $file_list;
}
Context::set('document', $document);
}
// 만약 document_srl은 있는데 page가 없다면 글만 호출된 경우,
// 그럼 page를 구해서 세팅해주자..
if($document_srl && !$page) {
$page = $oDocument->getDocumentPage($document_srl, $this->module_srl, $this->list_count);
Context::set('page', $page);
}
// 검색옵션
$search_target = Context::get('search_target');
$keyword = Context::get('keyword');
if($search_target && $keyword) {
$keyword = str_replace(' ','%',$keyword);
switch($search_target) {
case 'title' :
$search_obj->s_title = $keyword;
break;
case 'content' :
$search_obj->s_content = $keyword;
break;
case 'title_content' :
$search_obj->s_title = $keyword;
$search_obj->s_content = $keyword;
break;
case 'user_name' :
$search_obj->s_user_name = $keyword;
break;
}
}
// 카테고리
$category = Context::get('category');
if($category) $search_obj->category_srl = $category;
// 목록의 경우 document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
$output = $oDocument->getDocumentList($this->module_srl, 'list_order', $page, $this->list_count, $this->page_count, $search_obj);
// 템플릿에 쓰기 위해서 context::set
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('document_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿에서 사용할 검색옵션 세팅
$count_search_option = count($this->search_option);
for($i=0;$i<$count_search_option;$i++) {
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
}
Context::set('search_option', $search_option);
$this->setTemplateFile('list');
}/*}}}*/
function dispWriteForm() {/*{{{*/
// 목록 구현에 필요한 변수들을 가져온다
$document_srl = Context::get('document_srl');
// document 모듈 객체 생성
$oDocument = getModule('document');
// 지정된 글이 없다면 (신규) 새로운 번호를 만든다
if(!$document_srl) {
$oDB = &DB::getInstance();
$document_srl = $oDB->getNextSequence();
// 글의 수정일 경우 원본 글을 가져와서 확인을 한다
} else {
$document = $oDocument->getDocument($document_srl);
if(!$document) {
$oDB = &DB::getInstance();
$document_srl = $oDB->getNextSequence();
}
}
// 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력화면으로
if($document&&!$document->is_granted) return $this->setTemplateFile('input_password_form');
Context::set('document_srl',$document_srl);
Context::set('document', $document);
$this->setTemplateFile('write_form');
}/*}}}*/
function dispDeleteForm() {/*{{{*/
// 삭제할 문서번호를 가져온다
$document_srl = Context::get('document_srl');
// 지정된 글이 있는지 확인
if($document_srl) {
$oDocument = getModule('document');
$document = $oDocument->getDocument($document_srl);
}
// 삭제하려는 글이 없으면 에러
if(!$document) return $this->dispContent();
// 권한이 없는 경우 비밀번호 입력화면으로
if($document&&!$document->is_granted) return $this->setTemplateFile('input_password_form');
Context::set('document',$document);
$this->setTemplateFile('delete_form');
}/*}}}*/
function dispCommentModifyForm() {/*{{{*/
// 목록 구현에 필요한 변수들을 가져온다
$document_srl = Context::get('document_srl');
$comment_srl = Context::get('comment_srl');
// 지정된 댓글이 없다면 오류
if(!$comment_srl) return new Output(-1, 'msg_invalid_request');
// 해당 댓글를 찾아본다
$oComment = getModule('comment');
$comment = $oComment->getComment($comment_srl);
// 댓글이 없다면 오류
if(!$comment) return new Output(-1, 'msg_invalid_request');
// 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력화면으로
if($comment_srl&&$comment&&!$_SESSION['own_comment'][$comment_srl]) return $this->setTemplateFile('input_password_form');
// 필요한 정보들 세팅
Context::set('document_srl',$document_srl);
Context::set('comment_srl',$comment_srl);
Context::set('comment', $comment);
$this->setTemplateFile('comment_form');
}/*}}}*/
function dispCommentDeleteForm() {/*{{{*/
// 삭제할 댓글번호를 가져온다
$comment_srl = Context::get('comment_srl');
// 삭제하려는 댓글가 있는지 확인
if($comment_srl) {
$oComment = getModule('comment');
$comment = $oComment->getComment($comment_srl);
}
// 삭제하려는 글이 없으면 에러
if(!$comment) return $this->dispContent();
// 권한이 없는 경우 비밀번호 입력화면으로
if($comment_srl&&$comment&&!$_SESSION['own_comment'][$comment_srl]) return $this->setTemplateFile('input_password_form');
Context::set('comment',$comment);
$this->setTemplateFile('delete_comment_form');
}/*}}}*/
function dispCommentReplyForm() {/*{{{*/
// 목록 구현에 필요한 변수들을 가져온다
$document_srl = Context::get('document_srl');
$parent_srl = Context::get('comment_srl');
// 지정된 원 댓글이 없다면 오류
if(!$parent_srl) return new Output(-1, 'msg_invalid_request');
// 해당 댓글를 찾아본다
$oComment = getModule('comment');
$source_comment = $oComment->getComment($parent_srl);
// 댓글이 없다면 오류
if(!$source_comment) return new Output(-1, 'msg_invalid_request');
// 필요한 정보들 세팅
Context::set('document_srl',$document_srl);
Context::set('parent_srl',$parent_srl);
Context::set('comment_srl',NULL);
Context::set('source_comment',$source_comment);
$this->setTemplateFile('comment_form');
}/*}}}*/
function dispTrackbackDeleteForm() {/*{{{*/
// 삭제할 댓글번호를 가져온다
$trackback_srl = Context::get('trackback_srl');
// 삭제하려는 댓글가 있는지 확인
$oTrackback = getModule('trackback');
$output = $oTrackback->getTrackback($trackback_srl);
$trackback = $output->data;
// 삭제하려는 글이 없으면 에러
if(!$trackback) return $this->dispContent();
Context::set('trackback',$trackback);
$this->setTemplateFile('delete_trackback_form');
}/*}}}*/
function dispLogin() {/*{{{*/
if(Context::get('is_logged')) return $this->dispContent();
$this->setTemplateFile('login_form');
}/*}}}*/
function dispLogout() {/*{{{*/
if(!Context::get('is_logged')) return $this->dispContent();
$this->setTemplateFile('logout');
}/*}}}*/
function dispError() {/*{{{*/
}/*}}}*/
function dispRss() {/*{{{*/
$page = Context::get('page');
// 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 = sprintf("%s?mid=%s", Context::getRequestUri(), Context::get('mid'));
// 컨텐츠 추출
$oDocument = getModule('document');
$output = $oDocument->getDocumentList($this->module_srl, 'update_order', $page, 20, 20, NULL);
$document_list = $output->data;
// 출력하고 끝내기
$oRss = getModule('rss');
$oRss->printRssDocument($info, $document_list);
exit();
}/*}}}*/
function dispAdminIndex() {/*{{{*/
$this->setTemplateFile('module_list');
}/*}}}*/
// 실행 부분
function procInsertDocument() {/*{{{*/
// 글작성시 필요한 변수를 가져옴
$obj = Context::getRequestVars();
//$obj = Context::gets('document_srl','user_name','email_address','homepage','tags','title','content','password','allow_comment','lock_comment','allow_trackback','category_srl','is_notice','is_secret');
$obj->module_srl = $this->module_srl;
if($obj->is_notice!='Y') $obj->is_notice = 'N';
if($obj->is_secret!='Y') $obj->is_secret = 'N';
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
if($obj->lock_comment!='Y') $obj->lock_comment = 'N';
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
// document module 객체 생성
$oDocument = getModule('document');
// 첨부 파일의 갯수를 구함
$obj->uploaded_count = $oDocument->getFilesCount($obj->document_srl);
// 이미 존재하는 글인지 체크
$document = $oDocument->getDocument($obj->document_srl);
// 이미 존재하는 경우 수정
if($document->document_srl == $obj->document_srl) {
$output = $oDocument->updateDocument($document, $obj);
$msg_code = 'success_updated';
// 그렇지 않으면 신규 등록
} else {
$output = $oDocument->insertDocument($obj);
$msg_code = 'success_registed';
$obj->document_srl = $output->get('document_srl');
}
// 트랙백 발송
$trackback_url = Context::get('trackback_url');
$trackback_charset = Context::get('trackback_charset');
if($trackback_url) {
$oTrackback = getModule('trackback');
$oTrackback->sendTrackback($obj, $trackback_url, $trackback_charset);
}
if(!$output->toBool()) return $output;
$this->setMessage($msg_code);
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $output->get('document_srl'));
}/*}}}*/
function procDeleteDocument() {/*{{{*/
// 문서 번호 확인
$document_srl = Context::get('document_srl');
if(!$document_srl) return $this->doError('msg_invalid_document');
// 문서 있는지 확인
$oDocument = getModule('document');
$document = $oDocument->getDocument($document_srl);
if($document->document_srl!=$document_srl) return $this->doError('msg_invalid_document');
// 글 삭제
$output = $oDocument->deleteDocument($document);
if(!$output->toBool()) return $output;
$this->add('mid', Context::get('mid'));
$this->add('page', $output->get('page'));
$this->setMessage('success_deleted');
}/*}}}*/
function procVoteDocument() {/*{{{*/
$oDocument = getModule('document');
$document_srl = Context::get('document_srl');
return $oDocument->updateVotedCount($document_srl);
}/*}}}*/
function procInsertComment() {/*{{{*/
// 댓글 입력에 필요한 데이터 추출
$obj = Context::gets('document_srl','comment_srl','parent_srl','content','password','nick_name','user_name','member_srl','email_address','homepage');
$obj->module_srl = $this->module_srl;
// comment 객체 생성
$oComment = getModule('comment');
// comment_srl이 없을 경우 신규 입력
if(!$obj->comment_srl) {
// parent_srl이 있으면 답변으로
if($obj->parent_srl) {
$comment = $oComment->getComment($obj->parent_srl);
if(!$comment) return new Output(-1, 'msg_invalid_request');
$output = $oComment->insertComment($obj);
$comment_srl = $output->get('comment_srl');
// 없으면 신규
} else {
$output = $oComment->insertComment($obj);
}
// comment_srl이 있으면 수정으로
} else {
$comment = $oComment->getComment($obj->comment_srl);
if(!$comment) return new Output(-1, 'msg_invalid_request');
$obj->parent_srl = $comment->parent_srl;
$output = $oComment->updateComment($obj);
$comment_srl = $obj->comment_srl;
}
if(!$output->toBool()) return $output;
$this->setMessage('success_registed');
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $obj->document_srl);
$this->add('comment_srl', $comment_srl);
}/*}}}*/
function procDeleteComment() {/*{{{*/
// 댓글 번호 확인
$comment_srl = Context::get('comment_srl');
if(!$comment_srl) return $this->doError('msg_invalid_request');
// 삭제
$oComment = getModule('comment');
$output = $oComment->deleteComment($comment_srl);
if(!$output->toBool()) return $output;
$this->add('mid', Context::get('mid'));
$this->add('page', Context::get('page'));
$this->add('document_srl', $output->get('document_srl'));
$this->setMessage('success_deleted');
}/*}}}*/
function procReceiveTrackback() {/*{{{*/
$obj = Context::gets('document_srl','url','title','excerpt');
$oTrackback = getModule('trackback');
$oTrackback->insertTrackback($obj);
}/*}}}*/
function procDeleteTrackback() {/*{{{*/
$trackback_srl = Context::get('trackback_srl');
$oTrackback = getModule('trackback');
$output = $oTrackback->deleteTrackback($trackback_srl);
$this->add('mid', Context::get('mid'));
$this->add('page', Context::get('page'));
$this->add('document_srl', $output->get('document_srl'));
$this->setMessage('success_deleted');
}/*}}}*/
function procLogin() {/*{{{*/
// 아이디, 비밀번호를 받음
$user_id = Context::get('user_id');
$password = Context::get('password');
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogin($user_id, $password);
}/*}}}*/
function procLogout() {/*{{{*/
// member모듈 객체 생성
$oMember = getModule('member');
return $oMember->doLogout();
}/*}}}*/
function procVerificationPassword() {/*{{{*/
// 비밀번호와 문서 번호를 받음
$password = md5(Context::get('password'));
$document_srl = Context::get('document_srl');
$comment_srl = Context::get('comment_srl');
// comment_srl이 있을 경우 댓글이 대상
if($comment_srl) {
// 문서번호에 해당하는 글이 있는지 확인
$oComment = getModule('comment');
$data = $oComment->getComment($comment_srl);
// comment_srl이 없으면 문서가 대상
} else {
// 문서번호에 해당하는 글이 있는지 확인
$oDocument = getModule('document');
$data = $oDocument->getDocument($document_srl);
}
// 글이 없을 경우 에러
if(!$data) return $this->doError('msg_invalid_request');
// 문서의 비밀번호와 입력한 비밀번호의 비교
if($data->password != $password) return $this->doError('msg_invalid_password');
// 해당 글에 대한 권한 부여
if($comment_srl) $_SESSION['own_comment'][$comment_srl] = true;
else $_SESSION['own_document'][$document_srl] = true;
}/*}}}*/
function procUploadFile() {/*{{{*/
// 기본적으로 필요한 변수인 document_srl, module_srl을 설정
$document_srl = Context::get('document_srl');
$module_srl = $this->module_srl;
// document모듈 객체 생성후 걍 넘겨버림
$oDocument = getModule('document');
$output = $oDocument->insertFile($module_srl, $document_srl);
print $this->printUploadedFileList($document_srl);
exit();
}/*}}}*/
function procDeleteFile() {/*{{{*/
// 기본적으로 필요한 변수인 document_srl, module_srl을 설정
$document_srl = Context::get('document_srl');
$module_srl = $this->module_srl;
$file_srl = Context::get('file_srl');
// document모듈 객체 생성후 걍 넘겨버림
$oDocument = getModule('document');
$output = $oDocument->deleteFile($file_srl);
print $this->printUploadedFileList($document_srl);
exit();
}/*}}}*/
function procDownload() {/*{{{*/
// 다운로드에 필요한 변수 체크
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// document module 객체 생성후 해당 파일의 정보를 체크
$oDocument = getModule('document');
$file_obj = $oDocument->getFile($file_srl);
if($file_obj->file_srl!=$file_srl||$file_obj->sid!=$sid) exit();
// 이상이 없으면 download_count 증가
$args->file_srl = $file_srl;
$oDB = &DB::getInstance();
$oDB->executeQuery('document.updateFileDownloadCount', $args);
// 파일 출력
$filename = $file_obj->source_filename;
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$filename = urlencode($filename);
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
}
$uploaded_filename = $file_obj->uploaded_filename;
if(!file_exists($uploaded_filename)) exit();
$fp = fopen($uploaded_filename, 'rb');
if(!$fp) exit();
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Content-Length: " .(string)($file_obj->file_size));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
fpassthru($fp);
exit();
}/*}}}*/
function procClearFile() {/*{{{*/
$document_srl = Context::get('document_srl');
// document_srl의 글이 등록되어 있다면 pass
$oDocument = getModule('document');
$data = $oDocument->getDocument($document_srl);
if($data) exit();
// 등록되어 있지 않다면 첨부파일 삭제
$oDocument->deleteFiles($this->module_srl, $document_srl);
}/*}}}*/
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
**/
function printUploadedFileList($document_srl) {/*{{{*/
// 첨부파일들의 정보를 취합해서 return
$oDocument = getModule('document');
$file_list = $oDocument->getFiles($document_srl);
$file_count = count($file_list);
$buff = "";
for($i=0;$i<$file_count;$i++) {
$file_info = $file_list[$i];
if(!$file_info->file_srl) continue;
$buff .= sprintf("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $document_srl, $file_info->file_srl, $file_info->source_filename, $file_info->file_size, FileHandler::filesize($file_info->file_size), $file_info->direct_download=='Y'?$file_info->uploaded_filename:'', $file_info->sid);
}
$buff = sprintf("<script type=\"text/javascript\">\nparent.editor_upload_clear_list(\"%s\");\n%s</script>", $document_srl, $buff);
return $buff;
}/*}}}*/
}
?>

View file

@ -0,0 +1,56 @@
<?php
/**
* @file : modules/board/lang/ko.lang.php
* @author : zero <zero@nzeo.com>
* @desc : 게시판(board) 모듈의 기본 언어팩
**/
// 버튼에 사용되는 언어
$lang->cmd_view_info = "모듈정보";
$lang->cmd_manage_category = "분류관리";
$lang->cmd_manage_grant = "권한관리";
$lang->cmd_manage_skin = "스킨관리";
// 항목
$lang->mid = "모듈이름";
$lang->header_text = "상단 내용";
$lang->footer_text = "하단 내용";
$lang->skin = "스킨";
$lang->use_category = "분류 사용";
$lang->category_title = "분류명";
$lang->module = "모듈";
$lang->skin_default_info = "기본정보";
$lang->skin_maker = "스킨제작자";
$lang->skin_maker_homepage = "홈페이지";
$lang->colorset = "컬러셋";
$lang->extra_vars = "확장변수";
// 권한의 명칭
$lang->grant_title = array(
'list' => "목록 접근 권한",
'view' => "내용 접근 권한",
'write_document' => "게시물 작성 권한",
'write_comment' => "코멘트 작성 권한",
'fileupload' => "파일첨부 권한",
'management' => "관리 권한",
);
// 주절 주절..
$lang->about_mid = "모듈이름은 http://주소/?mid=모듈이름 처럼 직접 호출할 수 있는 값입니다. (영문+숫자만 가능)";
$lang->about_browser_title = "브라우저의 제목에 나타나는 값입니다. RSS/Trackback에서도 사용됩니다.";
$lang->about_description= "관리용으로 사용되는 설명입니다";
$lang->about_default = "선택하시면 사이트에 mid값 없이 접속하였을 경우 기본으로 보여줍니다";
$lang->about_header_text = "모듈의 상단에 표시되는 내용입니다 (html 태그 사용 가능)";
$lang->about_footer_text = "모듈의 하단에 표시되는 내용입니다 (html 태그 사용 가능)";
$lang->about_skin = "모듈의 스킨을 선택하실 수 있습니다";
$lang->about_use_category = "선택하시면 분류기능을 사용할 수 있습니다";
$lang->about_admin_id = "해당 모듈에 대해 최고 권한을 가지는 관리자를 지정할 수 있습니다. ,(콤마)로 다수 아이디 지정이 가능합니다. (관리자페이지 접근은 불가능)";
$lang->about_grant = "특정 권한의 대상을 모두 해제하시면 로그인하지 않은 회원까지 권한을 가질 수 있습니다";
$lang->msg_new_module = "모듈 생성";
$lang->msg_update_module = "모듈 수정";
$lang->msg_category_is_null = "등록된 분류가 없습니다";
$lang->msg_grant_is_null = "등록된 권한 대상이 없습니다";
?>

11
modules/board/module.xml Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">게시판</title>
<title xml:lang="en">BBS</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">board</description>
</author>
<module>

View file

@ -0,0 +1,20 @@
<query id="getBoardList" action="select">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="like" column="mid" var="s_mid" />
<condition operation="like" column="title" var="s_title" pipe="or" />
<condition operation="like" column="comment" var="s_comment" pipe="or" />
<condition operation="equal" column="module" var="s_module" pipe="or" />
</conditions>
<navigation>
<index var="sort_index" order="desc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,53 @@
<!--#include("header.html")-->
<!-- 댓글 정보 출력 -->
<div>
{$lang->comment} : {count($comment_list)}
</div>
<!-- 댓글 출력 -->
<div>
<!-- 댓글 목록 -->
<!--@if($comment_list)-->
<!--@foreach($comment_list as $key => $val)-->
<a name="comment_{$key}"></a>
<div style="margin-left:{$val->depth*15}px" >
<table>
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->date}</th>
<td>{zdate($val->regdate, "Y-m-d H:i:s")}</td>
</tr>
<tr>
<th>{$lang->user_name}</th>
<td>{$val->user_name}</td>
</tr>
<tr>
<th>{$lang->content}</th>
<td height="100" valign="top">{nl2br($val->content)}</td>
</tr>
<tr>
<th>ipaddress</th>
<td>{$val->ipaddress}</td>
</tr>
<tr>
<td colspan="2">
<a href="{getUrl('act','dispCommentModifyForm','comment_srl',$val->comment_srl)}">[{$lang->cmd_modify}]</a>
<a href="{getUrl('act','dispCommentReplyForm','comment_srl',$val->comment_srl)}">[{$lang->cmd_reply}]</a>
<a href="{getUrl('act','dispCommentDeleteForm','comment_srl',$val->comment_srl)}">[{$lang->cmd_delete}]</a>
</td>
</tr>
</table>
</div>
<!--@end-->
<!--@end-->
<!-- 댓글 입력 폼 -->
<!--@if($document->lock_comment == 'N')-->
<!--#include("./comment_form.html")-->
<!--@end-->
</div>

View file

@ -0,0 +1,77 @@
<!--%import("filter/filter.insert_comment.xml")-->
<!--#include("header.html")-->
<!-- 만약 댓글의 답을 다는 것이라면 원문 보여줌 -->
<!--@if($source_comment)-->
<div>
<table>
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->date}</th>
<td>{$source_comment->regdate}</td>
</tr>
<tr>
<th>{$lang->user_name}</th>
<td>{$source_comment->user_name}</td>
</tr>
<tr>
<th>{$lang->readed_count}</th>
<td>{$source_comment->readed_count}</td>
</tr>
<tr>
<th>{$lang->voted_count}</th>
<td>{$source_comment->voted_count}</td>
</tr>
<tr>
<th>{$lang->content}</th>
<td height="100" valign="top">{nl2br($source_comment->content)}</td>
</tr>
</table>
</div>
<!--@end-->
<!-- 글쓰기 폼 -->
<form action="./" method="get" onsubmit="return procFormFilter(this, insert_comment, procInsertComment)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procInsertComment" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<input type="hidden" name="comment_srl" value="{$comment_srl}" />
<input type="hidden" name="content" value="{htmlspecialchars($comment->content)}" />
<input type="hidden" name="parent_srl" value="{$parent_srl}" />
<table width="100%">
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->user_name}</th>
<td><input type="text" name="user_name" value="{$comment->user_name}" /></td>
</tr>
<tr>
<th>{$lang->password}</th>
<td><input type="password" name="password" value="" /></td>
</tr>
<tr>
<th>{$lang->email_address}</th>
<td><input type="text" name="email_address" value="{$comment->email_address}"/></td>
</tr>
<tr>
<th>{$lang->homepage}</th>
<td><input type="text" name="homepage" value="{$comment->homepage}" /></td>
</tr>
<tr>
<th>{$lang->content}</th>
<td><!--#include("$editor_path/editor.html")--></td>
</tr>
<tr>
<td colspan="2">
<!--@if($act&&$act!='dispContent')-->
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
<!--@end-->
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,23 @@
<!--%import("filter/filter.delete_comment.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, delete_comment, procDeleteComment)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procDeleteComment" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<input type="hidden" name="comment_srl" value="{$comment_srl}" />
<table>
<tr>
<th colspan="2">{$lang->confirm_delete}</th>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_delete}" />
<input type="button" value="{$lang->cmd_back}" onclick="location.href='{@getUrl('act','')}'" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,26 @@
<!--%import("filter/filter.delete_document.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, delete_document, procDeleteDocument)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procDeleteDocument" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<table>
<tr>
<th colspan="2">{$lang->confirm_delete}</th>
</tr>
<tr>
<th>{$lang->title}</th>
<td>{$document->title}</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_delete}" />
<input type="button" value="{$lang->cmd_back}" onclick="location.href='{@getUrl('act','')}'" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,23 @@
<!--%import("filter/filter.delete_trackback.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, delete_trackback, procDeleteTrackback)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procDeleteTrackback" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<input type="hidden" name="trackback_srl" value="{$trackback_srl}" />
<table>
<tr>
<th colspan="2">{$lang->confirm_delete}</th>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_delete}" />
<input type="button" value="{$lang->cmd_back}" onclick="location.href='{@getUrl('act','')}'" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,19 @@
<filter id="delete_comment">
<field>
<item target="comment_srl" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="page" target="page" />
<item param="document_srl" target="document_srl" />
<item param="comment_srl" target="comment_srl" />
</parameter>
<response>
<item name="error" />
<item name="message" />
<item name="mid" />
<item name="document_srl" />
<item name="page" />
</response>
</filter>

View file

@ -0,0 +1,17 @@
<filter id="delete_document">
<field>
<item target="document_srl" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="page" target="page" />
<item param="document_srl" target="document_srl" />
</parameter>
<response>
<item name="error" />
<item name="message" />
<item name="mid" />
<item name="page" />
</response>
</filter>

View file

@ -0,0 +1,19 @@
<filter id="delete_trackback">
<field>
<item target="trackback_srl" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="page" target="page" />
<item param="document_srl" target="document_srl" />
<item param="trackback_srl" target="trackback_srl" />
</parameter>
<response>
<item name="error" />
<item name="message" />
<item name="mid" />
<item name="document_srl" />
<item name="page" />
</response>
</filter>

View file

@ -0,0 +1,17 @@
<filter id="input_password">
<field>
<item target="document_srl" required="true" />
<item target="password" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="document_srl" target="document_srl" />
<item param="comment_srl" target="comment_srl" />
<item param="password" target="password" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1,18 @@
<filter id="insert" confirm_msg_code="confirm_submit">
<field>
<item target="document_srl" required="true" />
<item target="user_name" required="true" />
<item target="password" required="true" />
<item target="email_address" maxlength="250" />
<item target="homepage" maxlength="250"/>
<item target="title" required="true" minlength="1" maxlength="250" />
<item target="content" required="true" />
</field>
<response>
<item name="error" />
<item name="message" />
<item name="mid" />
<item name="document_srl" />
<item name="category_srl" />
</response>
</filter>

View file

@ -0,0 +1,29 @@
<filter id="insert_comment" confirm_msg_code="confirm_submit">
<field>
<item target="document_srl" required="true" />
<item target="user_name" required="true" />
<item target="password" required="true" />
<item target="email_address" maxlength="250" />
<item target="homepage" maxlength="250"/>
<item target="content" required="true" minlength="1" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="document_srl" target="document_srl" />
<item param="comment_srl" target="comment_srl" />
<item param="parent_srl" target="parent_srl" />
<item param="user_name" target="user_name" />
<item param="password" target="password" />
<item param="email_address" target="email_address" />
<item param="homepage" target="homepage" />
<item param="content" target="content" />
</parameter>
<response>
<item name="error" />
<item name="message" />
<item name="mid" />
<item name="document_srl" />
<item name="comment_srl" />
</response>
</filter>

View file

@ -0,0 +1,16 @@
<filter id="login">
<field>
<item target="user_id" required="true" filter="user_id"/>
<item target="password" required="true" />
</field>
<parameter>
<item param="user_id" target="user_id" />
<item param="password" target="password" />
<item param="mid" target="mid" />
<item param="act" target="act" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1,14 @@
<filter id="logout">
<field>
<item target="mid" required="true" />
<item target="act" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1,15 @@
<filter id="search">
<field>
<item target="search_target" required="true" />
<item target="keyword" minlegnth="2" maxlength="40" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="search_target" target="search_target" />
<item param="keyword" target="keyword" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1,14 @@
<filter id="vote" confirm_msg_code="confirm_vote">
<field>
<item target="document_srl" required="true" />
</field>
<parameter>
<item param="mid" target="mid" />
<item param="act" target="act" />
<item param="document_srl" target="document_srl" />
</parameter>
<response>
<item name="error" />
<item name="message" />
</response>
</filter>

View file

@ -0,0 +1 @@
<!--%import("js/board.js")-->

View file

@ -0,0 +1,26 @@
<!--%import("filter/filter.input_password.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, input_password, procReload)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procVerificationPassword" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<input type="hidden" name="comment_srl" value="{$comment_srl}" />
<table>
<tr>
<th colspan="2">{$lang->msg_input_password}</th>
</tr>
<tr>
<th>{$lang->password}</th>
<td><input type="password" name="password" value="" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_input}" />
<input type="button" value="{$lang->cmd_back}" onclick="location.href='{@getUrl('act','','document_srl','','comment_srl','')}'" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,39 @@
/**
* @file : modules/board/js/admin.js
* @author : zero <zero@nzeo.com>
* @desc : board 모듈의 관리자용 javascript
**/
/* 모듈 생성 후 */
function procInsertModule(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var sid = ret_obj['sid'];
var act = ret_obj['act'];
var page = ret_obj['page'];
var module_srl = ret_obj['module_srl'];
alert(message);
url = "./admin.php?sid="+sid+"&module_srl="+module_srl+"&page="+page+"&act="+act;
location.href = url;
}
/* 카테고리 관련 작업들 */
function doUpdateCategory(category_srl, mode, message) {
if(typeof(message)!='undefined'&&!confirm(message)) return;
var fo_obj = xGetElementById('fo_module_category_info');
fo_obj.category_srl.value = category_srl;
fo_obj.mode.value = mode;
procFormFilter(fo_obj, update_category_info, procReload);
}
/* 메세지 출력후 현페이지 리로드 */
function procReload(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
if(message) alert(message);
location.href = location.href;
}

View file

@ -0,0 +1,107 @@
/**
* @file : modules/board/js/board.js
* @author : zero <zero@nzeo.com>
* @desc : board 모듈의 javascript
**/
/* 글쓰기 작성후 */
function procInsert(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var document_srl = ret_obj['document_srl'];
var category_srl = ret_obj['category_srl'];
alert(message);
url = "./?mid="+mid+"&document_srl="+document_srl;
if(category_srl) url += '&category='+category_srl;
location.href = url;
}
/* 글 삭제 */
function procDeleteDocument(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var page = ret_obj['page'];
var url = "./?mid="+mid;
if(page) url += "&page="+page;
alert(message);
location.href = url;
}
/* 검색 실행 */
function procSearch(fo_obj, args) {
fo_obj.submit();
}
/* 추천, 추천은 별도의 폼입력이 필요 없어 직접 필터 사용 */
function doVote() {
var fo_obj = document.getElementById('fo_document_info');
procFormFilter(fo_obj, vote, procVote)
}
function procVote(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
alert(message);
location.href = location.href;
}
// 현재 페이지 reload
function procReload(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
location.href = location.href;
}
/* 댓글 글쓰기 작성후 */
function procInsertComment(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var document_srl = ret_obj['document_srl'];
var comment_srl = ret_obj['comment_srl'];
var url = "./?mid="+mid+"&document_srl="+document_srl;
if(comment_srl) url += "#comment_"+comment_srl;
alert(message);
location.href = url;
}
/* 댓글 삭제 */
function procDeleteComment(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var document_srl = ret_obj['document_srl'];
var page = ret_obj['page'];
var url = "./?mid="+mid+'&document_srl='+document_srl;
if(page) url += "&page="+page;
alert(message);
location.href = url;
}
/* 트랙백 삭제 */
function procDeleteTrackback(ret_obj, response_tags) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var document_srl = ret_obj['document_srl'];
var page = ret_obj['page'];
var url = "./?mid="+mid+'&document_srl='+document_srl;
if(page) url += "&page="+page;
alert(message);
location.href = url;
}
/* 카테고리 이동 */
function procChangeCategory(sel_obj, url) {
var category_srl = sel_obj.options[sel_obj.selectedIndex].value;
if(!category_srl) location.href=url;
else location.href=url+'&category='+category_srl;
}

View file

@ -0,0 +1,124 @@
<!--%import("filter/filter.search.xml")-->
<!--#include("header.html")-->
{$module_info->header_text}
<!-- 게시판 제목/ 설명 -->
<!--@if($module_info->title || $module_info->desc)-->
<div>
<table>
<tr>
<td>{$module_info->title}</td>
</tr>
<!--@if($module_info->desc)-->
<tr>
<td>{nl2br($module_info->desc)}</td>
</tr>
<!--@end-->
</table>
</div>
<!--@end-->
<!-- 게시판 정보 -->
<div>
{$lang->document_count} : {number_format($total_count)},
{$lang->page_count} : {number_format($page)} / {number_format($total_page)}
<a href="./rss.php?mid={$mid}">rss</a>
<!--@if($is_logged)-->
<a href="{getUrl('act','dispLogout')}">[{$lang->cmd_logout}]</a>
<!--@else-->
<a href="{getUrl('act','dispLogin')}">[{$lang->cmd_login}]</a>
<!--@end-->
<!--@if($logged_info->is_admin=='Y')-->
<a href="./admin.php?sid=board&amp;act=dispModuleInfo&amp;module_srl={$module_srl}" target="_blank">[{$lang->cmd_management}]</a>
<!--@end-->
</div>
<!-- 게시물 내용 include -->
<!--@if($document)-->
<!--#include("./view_document.html")-->
<!--@end-->
<!-- 목록 -->
<div>
<table>
<tr>
<th>{$lang->no}</th>
<!--@if($category_list)-->
<th>
<form action="./" method="get">
<select name="category" onchange="procChangeCategory(this, '{getUrl('category','')}')" >
<option value="">{$lang->category}</option>
<!--@foreach($category_list as $val)-->
<option value="{$val->category_srl}" <!--@if($category==$val->category_srl)-->selected="true"<!--@end-->>{$val->title} <!--@if($val->document_count)-->({$val->document_count})<!--@end--></option>
<!--@end-->
</select>
</form>
</th>
<!--@end-->
<th>{$lang->title}</th>
<th>{$lang->user_name}</th>
<th>{$lang->readed_count}</th>
<th>{$lang->voted_count}</th>
<th>{$lang->date}</th>
</tr>
<!--@foreach($document_list as $no => $val)-->
<tr>
<td>{$no}</td>
<!--@if($category_list)-->
<td>{$category_list[$val->category_srl]->title}</td>
<!--@end-->
<td>
<a href="{getUrl('document_srl',$val->document_srl)}">{$val->title}</a>
<!--@if($val->comment_count>0)-->
[{$val->comment_count}]
<!--@end-->
<!--@if($val->trackback_count>0)-->
[{$val->trackback_count}]
<!--@end-->
</td>
<td>{$val->user_name}</td>
<td>{$val->readed_count}</td>
<td>{$val->voted_count}</td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
</tr>
<!--@end-->
</table>
</div>
<!-- 버튼 -->
<div>
<a href="{getUrl('act','dispWriteForm','document_srl','')}">[{$lang->cmd_write}]</a>
</div>
<!-- 검색 -->
<div>
<form action="./" method="get" onsubmit="return procFormFilter(this, search, procSearch)">
<input type="hidden" name="mid" value="{$mid}" />
<select name="search_target">
<!--@foreach($search_option as $key => $val)-->
<option value="{$key}" <!--@if($search_target==$key)-->selected="true"<!--@end-->>{$val}</option>
<!--@end-->
</select>
<input type="text" name="keyword" value="{htmlspecialchars($keyword)}" />
<input type="submit" value="{$lang->cmd_search}" />
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('search_target','','keyword','','page','1','document_srl','')}'"/>
</form>
</div>
<!-- 페이지 네비게이션 -->
<div>
<a href="{getUrl('page','','document_srl','')}">[{$lang->first_page}]</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
{$page_no}
<!--@else-->
<a href="{getUrl('page',$page_no,'document_srl','')}">[{$page_no}]</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'document_srl','')}">[{$lang->last_page}]</a>
</div>
{$module_info->footer_text}

View file

@ -0,0 +1,26 @@
<!--%import("filter/filter.login.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, login, procReload)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procLogin" />
<table>
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->user_id}</th>
<td><input type="text" name="user_id" /></td>
</tr>
<tr>
<th>{$lang->password}</th>
<td><input type="password" name="password" value="" /></td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_login}" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,22 @@
<!--%import("filter/filter.logout.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFormFilter(this, logout, procReload)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procLogout" />
<table>
<tr>
<th>{$lang->cmd_logout}</th>
</tr>
<tr>
<td>{$lang->confirm_logout}</td>
</tr>
<tr>
<td>
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{@getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_logout}" />
</td>
</tr>
</table>
</form>

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<skin>
<title xml:lang="ko">게시판 기본 스킨</title>
<title xml:lang="en">BBS default skin</title>
<maker 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">board모듈의 default스킨</description>
<description xml:lang="en">default skin of the board module</description>
</maker>
<colorset>
<color name="normal" src="screenshot/normal.gif">
<title xml:lang="ko">기본</title>
<title xml:lang="en">normal</title>
</color>
<color name="deep" src="screenshot/blue.gif">
<title xml:lang="ko">이상한거</title>
<title xml:lang="en">deep</title>
</color>
</colorset>
<extra_vars>
<var name="title" type="text">
<title xml:lang="ko">제목</title>
<title xml:lang="en">title</title>
<description xml:lang="ko">그냥 테스트용입니다</description>
<description xml:lang="en">just for test..</description>
</var>
<var name="title2" type="text">
<title xml:lang="ko">제목 2</title>
<title xml:lang="en">title 2</title>
<default>haha</default>
</var>
<var name="memo" type="textarea">
<title xml:lang="ko">내용</title>
<title xml:lang="en">memo</title>
<default lang="ko">내용의 기본값</default>
<default lang="en">default value of memo</default>
</var>
<var name="select" type="select">
<title xml:lang="ko">선택1</title>
<title xml:lang="en">select 1</title>
<default>1</default>
<default>2</default>
<default>3</default>
<default>4</default>
<default>5</default>
</var>
<var name="checkbox" type="checkbox">
<title xml:lang="ko">다중선택</title>
<title xml:lang="en">multi select</title>
<default>a</default>
<default>b</default>
<default>c</default>
</var>
<var name="radio" type="radio">
<title xml:lang="ko">하나선택</title>
<title xml:lang="en">one select</title>
<default>A</default>
<default>B</default>
<default>C</default>
</var>
<var name="logo_image" type="image" width="60" height="60">
<title xml:lang="ko">로고이미지</title>
<title xml:lang="en">logo image</title>
</var>
</extra_vars>
<skin>

View file

@ -0,0 +1,50 @@
<!--#include("header.html")-->
<!-- 엮인글 정보 출력 -->
<div>
{$lang->trackback} : {count($trackback_list)}
</div>
<!-- 엮인글 출력 -->
<div>
<!-- 엮인글 목록 -->
<!--@if($trackback_list)-->
<!--@foreach($trackback_list as $key => $val)-->
<a name="trackback_{$key}"></a>
<div style="margin-left:{$val->depth*15}px" >
<table>
<col width="120" />
<col width="*" />
<tr>
<th>{$lang->title}</th>
<td>{$val->title}</td>
</tr>
<tr>
<th>{$lang->date}</th>
<td>{zdate($val->regdate, "Y-m-d H:i:s")}</td>
</tr>
<tr>
<th>{$lang->blog_name}</th>
<td><a href="{$val->url}">{$val->blog_name}</a></td>
</tr>
<tr>
<th>{$lang->excerpt}</th>
<td height="100" valign="top">{nl2br($val->excerpt)}</td>
</tr>
<tr>
<th>ipaddress</th>
<td>{$val->ipaddress}</td>
</tr>
<tr>
<td colspan="2">
<a href="{getUrl('act','dispTrackbackDeleteForm','trackback_srl',$val->trackback_srl)}">[{$lang->cmd_delete}]</a>
</td>
</tr>
</table>
</div>
<!--@end-->
<!--@end-->
</div>

View file

@ -0,0 +1,108 @@
<!--%import("filter/filter.vote.xml")-->
<!--#include("header.html")-->
<!-- 현 글의 기본 정보를 담고 있는 form. 필수 -->
<form id="fo_document_info" action="./" method="get">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procVoteDocument" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
</form>
<!-- 글 내용 보여주기 -->
<div>
<table width="100%" style="table-layout:fixed">
<col width="120" />
<col width="*" />
<!--@if($category_list && $document->category_srl)-->
<tr>
<th>{$lang->category}</th>
<td>{$category_list[$document->category_srl]->title}</td>
</tr>
<!--@end-->
<tr>
<th>{$lang->title}</th>
<td>{$document->title}</td>
</tr>
<tr>
<th>{$lang->date}</th>
<td>{zdate($document->regdate,"Y-m-d H:i:s")}</td>
</tr>
<tr>
<th>{$lang->user_name}</th>
<td>{$document->user_name}</td>
</tr>
<tr>
<th>{$lang->readed_count}</th>
<td>{$document->readed_count}</td>
</tr>
<tr>
<th>{$lang->voted_count}</th>
<td>{$document->voted_count}</td>
</tr>
<tr>
<th>{$lang->content}</th>
<td height="100" valign="top">{Document::transContent($document->content)}</td>
</tr>
<tr>
<td colspan="2">
{$lang->document_url} : {getUrl()}?document_srl={$document->document_srl}
<!--@if($document->allow_trackback=='Y')-->
<br />
{$lang->trackback_url} : {getUrl()}trackback.php?document_srl={$document->document_srl}
<!--@end-->
</td>
</tr>
<!--@if($document->tags)-->
<tr>
<th>{$lang->tag}</th>
<td>{$document->tags}</td>
</tr>
<!--@end-->
<!--@if($document->uploaded_count && $document->uploaded_list)-->
<tr>
<td>{$lang->uploaded_file}</td>
<td>
<!--@foreach($document->uploaded_list as $key => $file)-->
<div><a href="./?mid={$mid}&amp;act=procDownload&amp;file_srl={$file->file_srl}&amp;sid={$file->sid}&amp;document_srl={$file->document_srl}">{$file->source_filename} ({FileHandler::filesize($file->file_size)})</a> ({number_format($file->download_count)})</div>
<!--@end-->
</td>
</tr>
<!--@end-->
<tr>
<th>ipaddress</th>
<td>{$document->ipaddress}</td>
</tr>
<tr>
<td colspan="2">
<!--@if($document->allow_comment=='Y')-->
{$lang->allow_comment}
<!--@end-->
<!--@if($document->lock_comment=='Y')-->
{$lang->lock_comment}
<!--@end-->
<!--@if($document->allow_trackback=='Y')-->
{$lang->allow_trackback}
<!--@end-->
</td>
</tr>
</table>
</div>
<!-- 관련 링크 -->
<div>
<a href="{getUrl('document_srl','')}">[{$lang->cmd_list}]</a>
<a href="#" onclick="doVote();return false;">[{$lang->cmd_vote}]</a>
<a href="{getUrl('act','dispWriteForm')}">[{$lang->cmd_modify}]</a>
<a href="{getUrl('act','dispDeleteForm')}">[{$lang->cmd_delete}]</a>
</div>
<!-- 엮인글 파일 include -->
<!--@if($document->allow_trackback=='Y')-->
<!--#include("./trackback.html")-->
<!--@end-->
<!-- 댓글 파일 include -->
<!--@if($document->allow_comment=='Y')-->
<!--#include("./comment.html")-->
<!--@end-->

View file

@ -0,0 +1,100 @@
<!--%import("filter/filter.insert.xml")-->
<!--#include("header.html")-->
<form action="./" method="post" onsubmit="return procFormFilter(this, insert, procInsert)" <!--@if($grant->fileupload)-->enctype="multipart/form-data"<!--@end-->>
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procInsertDocument" />
<input type="hidden" name="content" value="{htmlspecialchars($document->content)}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<table width="100%">
<col width="120" />
<col width="*" />
<!--@if($category_list)-->
<tr>
<th>{$lang->category}</th>
<td>
<select name="category_srl" >
<option value="">{$lang->category}</option>
<!--@foreach($category_list as $val)-->
<option value="{$val->category_srl}" <!--@if($category==$val->category_srl||$val->category_srl==$document->category_srl)-->selected="true"<!--@end-->>{$val->title} <!--@if($val->document_count)-->({$val->document_count})<!--@end--></option>
<!--@end-->
</select>
</td>
<!--@end-->
<tr>
<th>{$lang->user_name}</th>
<td><input type="text" name="user_name" value="{$document->user_name}" /></td>
</tr>
<tr>
<th>{$lang->password}</th>
<td><input type="password" name="password" value="" /></td>
</tr>
<tr>
<th>{$lang->email_address}</th>
<td><input type="text" name="email_address" value="{$document->email_address}"/></td>
</tr>
<tr>
<th>{$lang->homepage}</th>
<td><input type="text" name="homepage" value="{$document->homepage}" /></td>
</tr>
<tr>
<th>{$lang->title}</th>
<td><input type="text" name="title" value="{$document->title}" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="checkbox" name="is_notice" value="Y" <!--@if($document->is_notice== "Y")-->checked="true"<!--@end--> id="is_notice" />
<label for="is_notice">{$lang->notice}</label>
<input type="checkbox" name="is_secret" value="Y" <!--@if($document->is_secret== "Y")-->checked="true"<!--@end--> id="is_secret" />
<label for="is_secret">{$lang->secret}</label>
<input type="checkbox" name="allow_comment" value="Y" <!--@if($document->allow_comment != "N")-->checked="true"<!--@end--> id="allow_comment" />
<label for="allow_comment">{$lang->allow_comment}</label>
<input type="checkbox" name="lock_comment" value="Y" <!--@if($document->lock_comment == "Y")-->checked="true"<!--@end--> id="lock_comment" />
<label for="lock_comment">{$lang->lock_comment}</label>
<input type="checkbox" name="allow_trackback" value="Y" <!--@if($document->allow_trackback != "N")-->checked="true"<!--@end--> id="allow_trackback" />
<label for="allow_trackback">{$lang->allow_trackback}</label>
</td>
</tr>
<tr>
<th>{$lang->content}</th>
<td>
<!--#include("$editor_path/editor.html")-->
<!--#include("$editor_path/editor_uploader.html")-->
</td>
</tr>
<tr>
<th>{$lang->cmd_send_trackback}</th>
<td>
<input type="text" name="trackback_url" />
<select name="trackback_charset">
<option value='UTF-8'>UTF-8</option>
<option value='EUC-KR'>EUC-KR</option>
<option value='EUC-JP'>EUC-JP</option>
<option value='SHIFT_JIS'>SHIFT_JIS</option>
<option value='EUC-CN'>EUC-CN</option>
<option value='HZ'>HZ</option>
<option value='BIG5'>BIG5</option>
</select>
</td>
</tr>
<tr>
<th>{$lang->tag}</th>
<td>
<input type="text" name="tags" value="{htmlspecialchars($document->tags)}" /> <br />
{$lang->about_tag}
</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,267 @@
<?php
/**
* @file : modules/comment/comment.module.php
* @author : zero <zero@nzeo.com>
* @desc : 기본 모듈중의 하나인 comment module
* Module class에서 상속을 받아서 사용
* action 경우 disp/proc 2가지만 존재하며 이는 action명세서에
* 미리 기록을 하여야
**/
class comment extends Module {
/**
* 모듈의 정보
**/
var $cur_version = "20070130_0.01";
/**
* 기본 action 지정
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
**/
var $default_act = '';
/**
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
* css/js파일의 load라든지 lang파일 load등을 미리 선언
*
* Init() => 공통
* dispInit() => disp시에
* procInit() => proc시에
*
* $this->module_path는 현재 모듈파일의 위치를 나타낸다
* (ex: $this->module_path = "./modules/install/";
**/
// 초기화
function init() {/*{{{*/
//Context::loadLang($this->module_path.'lang');
}/*}}}*/
// disp 초기화
function dispInit() {/*{{{*/
}/*}}}*/
// proc 초기화
function procInit() {/*{{{*/
}/*}}}*/
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 comment, comment가 지정되어야 한다
**/
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
**/
// 코멘트의 권한 부여
// 세션값으로 현 접속상태에서만 사용 가능
// public void addGrant($comment_srl) {/*{{{*/
function addGrant($comment_srl) {
$_SESSION['own_comment'][$comment_srl] = true;
}/*}}}*/
// public void isGranted($comment_srl) {/*{{{*/
function isGranted($comment_srl) {
return $_SESSION['own_comment'][$comment_srl];
}/*}}}*/
// 코멘트
// public boolean insertComment($obj)/*{{{*/
// 댓글 입력
function insertComment($obj) {
// document_srl에 해당하는 글이 있는지 확인
$document_srl = $obj->document_srl;
if(!$document_srl) return new Output(-1,'msg_invalid_document');
$oDocument = getModule('document');
$document = $oDocument->getDocument($document_srl);
if(!$document_srl) return new Output(-1,'msg_invalid_document');
if($document->lock_comment=='Y') return new Output(-1,'msg_invalid_request');
// 댓글를 입력
$oDB = &DB::getInstance();
$obj->comment_srl = $oDB->getNextSequence();
$obj->list_order = $obj->comment_srl * -1;
if($obj->password) $obj->password = md5($obj->password);
$output = $oDB->executeQuery('comment.insertComment', $obj);
// 입력에 이상이 없으면 해당 글의 댓글 수를 올림
if(!$output->toBool()) return $output;
// 해당 글의 전체 댓글 수를 구해옴
$comment_count = $this->getCommentCount($document_srl);
// 해당글의 댓글 수를 업데이트
$output = $oDocument->updateCommentCount($document_srl, $comment_count);
// 댓글의 권한을 부여
$this->addGrant($obj->comment_srl);
$output->add('comment_srl', $obj->comment_srl);
return $output;
}/*}}}*/
// public boolean updateComment($obj)/*{{{*/
// 댓글 수정
function updateComment($obj) {
// 권한이 있는지 확인
if(!$this->isGranted($obj->comment_srl)) return new Output(-1, 'msg_not_permitted');
// 업데이트
$oDB = &DB::getInstance();
if($obj->password) $obj->password = md5($obj->password);
$output = $oDB->executeQuery('comment.updateComment', $obj);
$output->add('comment_srl', $obj->comment_srl);
return $output;
}/*}}}*/
// public boolean deleteComment($comment_srl)/*{{{*/
// 댓글 삭제
function deleteComment($comment_srl) {
// 기존 댓글이 있는지 확인
$comment = $this->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) return new Output(-1, 'msg_invalid_request');
$document_srl = $comment->document_srl;
// 해당 댓글에 child가 있는지 확인
$child_count = $this->getChildCommentCount($comment_srl);
if($child_count>0) return new Output(-1, 'fail_to_delete_have_children');
// 권한이 있는지 확인
if(!$this->isGranted($comment_srl)) return new Output(-1, 'msg_not_permitted');
// 삭제
$oDB = &DB::getInstance();
$args->comment_srl = $comment_srl;
$output = $oDB->executeQuery('comment.deleteComment', $args);
if(!$output->toBool()) return new Output(-1, 'msg_error_occured');
// 댓글 수를 구해서 업데이트
$comment_count = $this->getCommentCount($document_srl);
// 해당글의 댓글 수를 업데이트
$oDocument = getModule('document');
$output = $oDocument->updateCommentCount($document_srl, $comment_count);
$output->add('document_srl', $document_srl);
return $output;
}/*}}}*/
// public boolean deleteComments($document_srl)/*{{{*/
// 특정 글의 모든 댓글 삭제
function deleteComments($document_srl) {
// 권한이 있는지 확인
if(!$this->isGranted($document_srl)) return new Output(-1, 'msg_not_permitted');
// 삭제
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('comment.deleteComments', $args);
return $output;
}/*}}}*/
// public boolean deleteMoudleComments($module_srl)/*{{{*/
// 특정 모듈의 모든 댓글 삭제
function deleteModuleComments($module_srl) {
// 삭제
$oDB = &DB::getInstance();
$args->module_srl = $module_srl;
$output = $oDB->executeQuery('comment.deleteModuleComments', $args);
return $output;
}/*}}}*/
// public int getChildCommentCount($comment_srl)/*{{{*/
// 자식 답글의 갯수 리턴
function getChildCommentCount($comment_srl) {
$oDB = &DB::getInstance();
$args->comment_srl = $comment_srl;
$output = $oDB->executeQuery('comment.getChildCommentCount', $args);
return (int)$output->data->count;
}/*}}}*/
// public boolean getComment($comment_srl)/*{{{*/
// 댓글 가져오기
function getComment($comment_srl) {
$oDB = &DB::getInstance();
$args->comment_srl = $comment_srl;
$output = $oDB->executeQuery('comment.getComment', $args);
return $output->data;
}/*}}}*/
// public boolean getComments($comment_srl_list)/*{{{*/
// 여러개의 댓글들을 가져옴 (페이징 아님)
function getComments($comment_srl_list) {
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
$oDB = &DB::getInstance();
$args->comment_srls = $comment_srls;
$output = $oDB->executeQuery('comment.getComments', $args);
return $output->data;
}/*}}}*/
// public number getCommentCount($module_srl, $search_obj = NULL)/*{{{*/
// document_srl 에 해당하는 댓글의 전체 갯수를 가져옴
function getCommentCount($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count;
return (int)$total_count;
}/*}}}*/
// public boolean getCommentList($document_srl)/*{{{*/
// module_srl값을 가지는 댓글의 목록을 가져옴
function getCommentList($document_srl) {
// 댓글 목록을 가져옴
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->list_order = 'list_order';
$output = $oDB->executeQuery('comment.getCommentList', $args);
if(!$output->toBool()) return $output;
$source_list= $output->data;
if(!is_array($source_list)) $source_list = array($source_list);
// 댓글를 계층형 구조로 정렬
$comment_count = count($source_list);
$root = NULL;
$list = NULL;
for($i=$comment_count-1;$i>=0;$i--) {
$comment_srl = $source_list[$i]->comment_srl;
$parent_srl = $source_list[$i]->parent_srl;
if(!$comment_srl) continue;
$list[$comment_srl] = $source_list[$i];
if($parent_srl) {
$list[$parent_srl]->child[] = &$list[$comment_srl];
} else {
$root->child[] = &$list[$comment_srl];
}
}
$this->_arrangeComment($comment_list, $root->child, 0);
return $comment_list;
}/*}}}*/
// private object _arrangeComment(&$comment_list, $list, $depth)/*{{{*/
// 댓글를 계층형으로 재배치
function _arrangeComment(&$comment_list, $list, $depth) {
if(!count($list)) return;
foreach($list as $key => $val) {
if($val->child) {
$tmp = $val;
$tmp->depth = $depth;
$comment_list[$tmp->comment_srl] = $tmp;
$this->_arrangeComment($comment_list,$val->child,$depth+1);
}
else {
$val->depth = $depth;
$comment_list[$val->comment_srl] = $val;
}
}
}/*}}}*/
}
?>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">댓글</title>
<title xml:lang="en">comment</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">comment</description>
</author>
<module>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,11 @@
<query id="getCommentCount" action="select">
<tables>
<table name="comments" />
</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

@ -0,0 +1,14 @@
<query id="getCommentList" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="list_order" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,11 @@
<query id="getComments" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="comment_srl" var="comment_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,21 @@
<query id="insertComment" action="insert">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="comment_srl" var="comment_srl" notnull="notnull" />
<column name="module_srl" var="module_srl" filter="number" notnull="notnull" />
<column name="parent_srl" var="parent_srl" filter="number" default="0" />
<column name="document_srl" var="document_srl" filter="number" notnull="notnull" />
<column name="content" var="content" notnull="notnull" minlength="2" maxlength="250" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="nick_name" var="nick_name" minlength="2" maxlength="40" />
<column name="user_name" var="user_name" default="" minlength="1" maxlength="80" />
<column name="member_srl" var="member_srl" default="0" filter="number" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" default="0" />
</columns>
</query>

View file

@ -0,0 +1,20 @@
<query id="updateComment" action="update">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="parent_srl" var="parent_srl" filter="number" default="0" />
<column name="content" var="content" notnull="notnull" minlength="2" maxlength="250" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="user_name" var="user_name" default="" minlength="1" maxlength="80" />
<column name="nick_name" var="nick_name" minlength="2" maxlength="40" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
</columns>
<conditions>
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,18 @@
<table name="comments">
<column name="comment_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="document_srl" type="number" size="11" default="0" notnull="notnull" index="idx_document_srl" />
<column name="parent_srl" type="number" size="11" default="0" notnull="notnull" />
<column name="is_secret" type="char" size="1" default="N" notnull="notnull" />
<column name="content" type="text" 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="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" />
</table>

View file

@ -0,0 +1,702 @@
<?php
/**
* @file : modules/document/document.module.php
* @author : zero <zero@nzeo.com>
* @desc : 기본 모듈중의 하나인 document module
* Module class에서 상속을 받아서 사용
* action 경우 disp/proc 2가지만 존재하며 이는 action명세서에
* 미리 기록을 하여야
**/
class document extends Module {
/**
* 모듈의 정보
**/
var $cur_version = "20070130_0.01";
// 공지사항의 고정된 list_order
var $notice_list_order = -1000000000;
/**
* 기본 action 지정
* $act값이 없거나 잘못된 값이 들어올 경우 $default_act 값으로 진행
**/
var $default_act = '';
/**
* 현재 모듈의 초기화를 위한 작업을 지정해 놓은 method
* css/js파일의 load라든지 lang파일 load등을 미리 선언
*
* Init() => 공통
* dispInit() => disp시에
* procInit() => proc시에
*
* $this->module_path는 현재 모듈파일의 위치를 나타낸다
* (ex: $this->module_path = "./modules/install/";
**/
// 초기화
function init() {/*{{{*/
//Context::loadLang($this->module_path.'lang');
}/*}}}*/
// disp 초기화
function dispInit() {/*{{{*/
}/*}}}*/
// proc 초기화
function procInit() {/*{{{*/
}/*}}}*/
/**
* 여기서부터는 action의 구현
* request parameter의 경우 method의 첫번째 인자로 넘어온다
*
* dispXXXX : 출력을 위한 method, output에 tpl file이 지정되어야 한다
* procXXXX : 처리를 위한 method, output에는 document, document가 지정되어야 한다
**/
/**
* 여기부터는 모듈과 관련된 라이브러리 개념의 method들
**/
// 문서의 권한 부여
// 세션값으로 현 접속상태에서만 사용 가능
// public void addGrant($document_srl) {/*{{{*/
function addGrant($document_srl) {
$_SESSION['own_document'][$document_srl] = true;
}/*}}}*/
// public void isGranted($document_srl) {/*{{{*/
function isGranted($document_srl) {
return $_SESSION['own_document'][$document_srl];
}/*}}}*/
// 문서
// public object insertDocument($obj)/*{{{*/
// 문서 입력
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;
}
// 태그 처리
$oTag = getModule('tag');
$obj->tags = $oTag->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;
}/*}}}*/
// public object updateDocument($source_obj, $obj)/*{{{*/
// 문서 수정
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;
}
// 태그 처리
$oTag = getModule('tag');
$obj->tags = $oTag->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;
}/*}}}*/
// public object deleteDocument($obj)/*{{{*/
// 문서 삭제
function deleteDocument($obj) {
// 변수 세팅
$document_srl = $obj->document_srl;
$category_srl = $obj->category_srl;
// 기존 문서가 있는지 확인
$document = $this->getDocument($document_srl);
if($document->document_srl != $document_srl) return false;
// 권한이 있는지 확인
if(!$document->is_granted) return new Output(-1, 'msg_not_permitted');
// 글 삭제
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.deleteDocument', $args);
if(!$output->toBool()) return $output;
// 댓글 삭제
$oComment = getModule('comment');
$output = $oComment->deleteComments($document_srl);
// 엮인글 삭제
$oTrackback = getModule('trackback');
$output = $oTrackback->deleteTrackbacks($document_srl);
// 태그 삭제
$oTag = getModule('tag');
$oTag->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;
}/*}}}*/
// public object deleteModuleDocument($module_srl) /*{{{*/
function deleteModuleDocument($module_srl) {
$args->module_srl = $module_srl;
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('document.deleteModuleDocument', $args);
return $output;
}/*}}}*/
// public object getDocument($document_srl)/*{{{*/
// 문서 가져오기
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;
}/*}}}*/
// public object getDocuments($document_srl_list)/*{{{*/
// 여러개의 문서들을 가져옴 (페이징 아님)
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;
// 권한 체크
$oMember = getModule('member');
$member_srl = $oMember->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;
}/*}}}*/
// public object getDocumentCount($module_srl, $search_obj = NULL)/*{{{*/
// 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;
}/*}}}*/
// public object getDocumentList($module_srl, $sort_index='list_order', $page=1, $list_order=20, $page_count=10, $search_obj = NULL)/*{{{*/
// module_srl값을 가지는 문서의 목록을 가져옴
function getDocumentList($module_srl, $sort_index = 'list_order', $page = 1, $list_count = 20, $page_count = 10, $search_obj = NULL) {
$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;
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('document.getDocumentList', $args);
if(!count($output->data)) return $output;
// 권한 체크
$oMember = getModule('member');
$member_srl = $oMember->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;
}/*}}}*/
// public object getDocumentPage($document_srl, $module_srl, $list_count)/*{{{*/
// 해당 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;
}/*}}}*/
// public object updateReadedCount($document_srl)/*{{{*/
// 해당 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;
}/*}}}*/
// public object updateVotedCount($document_srl)/*{{{*/
// 해당 document의 추천수 증가
function updateVotedCount($document_srl) {
if($_SESSION['voted_document'][$document_srl]) return new Output(-1, 'failed_voted');
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.updateVotedCount', $args);
$_SESSION['voted_document'][$document_srl] = true;
return new Output(0, 'success_voted');
}/*}}}*/
// public object updateCommentCount($document_srl, $comment_count)/*{{{*/
// 해당 document의 댓글 수 증가
function updateCommentCount($document_srl, $comment_count) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->comment_count = $comment_count;
$output = $oDB->executeQuery('document.updateCommentCount', $args);
return new Output();
}/*}}}*/
// public object updateTrackbackCount($document_srl, $trackback_count)/*{{{*/
// 해당 document의 엮인글 수증가
function updateTrackbackCount($document_srl, $trackback_count) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$args->trackback_count = $trackback_count;
$output = $oDB->executeQuery('document.updateTrackbackCount', $args);
return new Output();
}/*}}}*/
// 카테고리 관리
// public object getCategory($category_srl) /*{{{*/
function getCategory($category_srl) {
$args->category_srl = $category_srl;
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('document.getCategory', $args);
return $output->data;
}/*}}}*/
// public object getCategoryList($module_srl) /*{{{*/
function getCategoryList($module_srl) {
$args->module_srl = $module_srl;
$args->sort_index = 'list_order';
$oDB = &DB::getInstance();
$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;
}/*}}}*/
// public object insertCategory($module_srl, $title) /*{{{*/
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);
}/*}}}*/
// public object updateCategory($args) /*{{{*/
function updateCategory($args) {
$oDB = &DB::getInstance();
return $oDB->executeQuery('document.updateCategory', $args);
}/*}}}*/
// public object updateCategoryCount($category_srl, $document_count = 0) /*{{{*/
function updateCategoryCount($category_srl, $document_count = 0) {
if(!$document_count) $document_count = $this->getCategoryDocumentCount($category_srl);
$args->category_srl = $category_srl;
$args->document_count = $document_count;
$oDB = &DB::getInstance();
return $oDB->executeQuery('document.updateCategoryCount', $args);
}/*}}}*/
// public int getCategoryDocumentCount($category_srl) /*{{{*/
function getCategoryDocumentCount($category_srl) {
$args->category_srl = $category_srl;
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('document.getCategoryDocumentCount', $args);
return (int)$output->data->count;
}/*}}}*/
// public object deleteCategory($category_srl) /*{{{*/
function deleteCategory($category_srl) {
$args->category_srl = $category_srl;
$oDB = &DB::getInstance();
// 카테고리 정보를 삭제
$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;
}/*}}}*/
// public object deleteModuleCategory($module_srl) /*{{{*/
function deleteModuleCategory($module_srl) {
$args->module_srl = $module_srl;
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('document.deleteModuleCategory', $args);
return $output;
}/*}}}*/
// public object moveCategoryUp($category_srl) /*{{{*/
function moveCategoryUp($category_srl) {
// 선택된 카테고리의 정보를 구한다
$oDB = &DB::getInstance();
$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 = $this->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Output();
$prev_category = NULL;
foreach($category_list as $key => $val) {
if($key==$category_srl) break;
$prev_category = $val;
}
// 이전 카테고리가 없으면 그냥 return
if(!$prev_category) return new Output(-1,Context::getLang('msg_category_not_moved'));
// 선택한 카테고리가 가장 위의 카테고리이면 그냥 return
if($category_srl_list[0]==$category_srl) return new Output(-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 Output();
}/*}}}*/
// public object moveCategoryDown($category_srl) /*{{{*/
function moveCategoryDown($category_srl) {
// 선택된 카테고리의 정보를 구한다
$oDB = &DB::getInstance();
$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 = $this->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Output();
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 Output(-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 Output();
}/*}}}*/
// 파일 관리
// public int getFilesCount($document_srl) /*{{{*/
function getFilesCount($document_srl) {
$oDB = &DB::getInstance();
$args->document_srl = $document_srl;
$output = $oDB->executeQuery('document.getFilesCount', $args);
return (int)$output->data->count;
}/*}}}*/
// public object getFile($file_srl) /*{{{*/
function getFile($file_srl) {
$oDB = &DB::getInstance();
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('document.getFile', $args);
return $output->data;
}/*}}}*/
// public object getFiles($document_srl) /*{{{*/
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;
}/*}}}*/
// public object insertFile($module_srl, $document_sr) /*{{{*/
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;
// 사용자 정보를 구함
$oMember = getModule('member');
$member_srl = $oMember->getMemberSrl();
// 파일 정보를 정리
$oDB = &DB::getInstance();
$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;
}/*}}}*/
// public object deleteFile($file_srl) /*{{{*/
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 Output(-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;
}/*}}}*/
// public object deleteFiles($module_srl, $document_srl) /*{{{*/
function deleteFiles($module_srl, $document_srl) {
// DB에서 삭제
$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;
}/*}}}*/
// public object deleteModuleFiles($module_srl) /*{{{*/
function deleteModuleFiles($module_srl) {
// DB에서 삭제
$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;
}/*}}}*/
// 기타 기능
// public string transContent($content) {/*{{{*/
// 내용 관리
// 내용의 플러그인이나 기타 기능에 대한 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;
}/*}}}*/
// public string _transMultimedia($matches)/*{{{*/
// <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\">document.writeln(displayMultimedia(\"%s\", \"%s\", \"%s\"));</script>", $obj->type, $obj->src, $style);
}/*}}}*/
}
?>

View file

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

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">문서</title>
<title xml:lang="en">document</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>
</author>
<module>

View file

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,19 @@
<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

@ -0,0 +1,26 @@
<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

@ -0,0 +1,12 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,8 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,14 @@
<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

@ -0,0 +1,34 @@
<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

@ -0,0 +1,20 @@
<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

@ -0,0 +1,13 @@
<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

@ -0,0 +1,12 @@
<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

@ -0,0 +1,11 @@
<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

@ -0,0 +1,31 @@
<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

@ -0,0 +1,11 @@
<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>

Some files were not shown because too many files have changed in this diff Show more