mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 15:21:40 +09:00
- 위젯 추가/복사등을 할 때 페이지 리로드 없이 바로 적용되도록 변경 - 위젯 스타일 수정 또는 추가시 위젯의 스타일값이 변경되는 오류 수정 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5917 201d5d3c-b55e-5fd7-737f-ddc643e51545
157 lines
6.5 KiB
PHP
157 lines
6.5 KiB
PHP
<?php
|
|
|
|
class wikiController extends wiki {
|
|
|
|
function init() {
|
|
}
|
|
|
|
function procWikiInsertDocument() {
|
|
// 권한 체크
|
|
if(!$this->grant->write_document) return new Object(-1, 'msg_not_permitted');
|
|
$entry = Context::get('entry');
|
|
|
|
// 글작성시 필요한 변수를 세팅
|
|
$obj = Context::getRequestVars();
|
|
$obj->module_srl = $this->module_srl;
|
|
if($this->module_info->use_comment != 'N')
|
|
{
|
|
$obj->allow_comment = 'Y';
|
|
}
|
|
else
|
|
{
|
|
$obj->allow_comment = 'N';
|
|
}
|
|
|
|
if(!$obj->nick_name) $obj->nick_name = "anonymous";
|
|
if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';
|
|
|
|
settype($obj->title, "string");
|
|
if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
|
|
//그래도 없으면 Untitled
|
|
if($obj->title == '') $obj->title = 'Untitled';
|
|
|
|
// document module의 model 객체 생성
|
|
$oDocumentModel = &getModel('document');
|
|
|
|
// document module의 controller 객체 생성
|
|
$oDocumentController = &getController('document');
|
|
|
|
// 이미 존재하는 글인지 체크
|
|
$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
|
|
|
|
// 이미 존재하는 경우 수정
|
|
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
|
|
$output = $oDocumentController->updateDocument($oDocument, $obj);
|
|
$msg_code = 'success_updated';
|
|
|
|
// 그렇지 않으면 신규 등록
|
|
} else {
|
|
$output = $oDocumentController->insertDocument($obj);
|
|
$msg_code = 'success_registed';
|
|
$obj->document_srl = $output->get('document_srl');
|
|
$oDocumentController->insertAlias($obj->module_srl, $obj->document_srl, $obj->title);
|
|
}
|
|
|
|
// 오류 발생시 멈춤
|
|
if(!$output->toBool()) return $output;
|
|
|
|
// 결과를 리턴
|
|
$this->add('mid', Context::get('mid'));
|
|
$this->add('document_srl', $output->get('document_srl'));
|
|
|
|
// 성공 메세지 등록
|
|
$this->setMessage($msg_code);
|
|
}
|
|
|
|
function procWikiInsertComment() {
|
|
// 권한 체크
|
|
if(!$this->grant->write_comment) return new Object(-1, 'msg_not_permitted');
|
|
|
|
// 댓글 입력에 필요한 데이터 추출
|
|
$obj = Context::gets('document_srl','comment_srl','parent_srl','content','password','nick_name','nick_name','member_srl','email_address','homepage','is_secret','notify_message');
|
|
$obj->module_srl = $this->module_srl;
|
|
|
|
// 원글이 존재하는지 체크
|
|
$oDocumentModel = &getModel('document');
|
|
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
|
|
if(!$oDocument->isExists()) return new Object(-1,'msg_not_permitted');
|
|
|
|
// comment 모듈의 model 객체 생성
|
|
$oCommentModel = &getModel('comment');
|
|
|
|
// comment 모듈의 controller 객체 생성
|
|
$oCommentController = &getController('comment');
|
|
|
|
// comment_srl이 존재하는지 체크
|
|
// 만일 comment_srl이 n/a라면 getNextSequence()로 값을 얻어온다.
|
|
if(!$obj->comment_srl) {
|
|
$obj->comment_srl = getNextSequence();
|
|
} else {
|
|
$comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
|
|
}
|
|
|
|
// comment_srl이 없을 경우 신규 입력
|
|
if($comment->comment_srl != $obj->comment_srl) {
|
|
|
|
// parent_srl이 있으면 답변으로
|
|
if($obj->parent_srl) {
|
|
$parent_comment = $oCommentModel->getComment($obj->parent_srl);
|
|
if(!$parent_comment->comment_srl) return new Object(-1, 'msg_invalid_request');
|
|
|
|
$output = $oCommentController->insertComment($obj);
|
|
|
|
// 없으면 신규
|
|
} else {
|
|
$output = $oCommentController->insertComment($obj);
|
|
}
|
|
|
|
// 문제가 없고 모듈 설정에 관리자 메일이 등록되어 있으면 메일 발송
|
|
if($output->toBool() && $this->module_info->admin_mail) {
|
|
$oMail = new Mail();
|
|
$oMail->setTitle($oDocument->getTitleText());
|
|
$oMail->setContent( sprintf("From : <a href=\"%s#comment_%d\">%s#comment_%d</a><br/>\r\n%s", $oDocument->getPermanentUrl(), $obj->comment_srl, $oDocument->getPermanentUrl(), $obj->comment_srl, $obj->content));
|
|
$oMail->setSender($obj->user_name, $obj->email_address);
|
|
|
|
$target_mail = explode(',',$this->module_info->admin_mail);
|
|
for($i=0;$i<count($target_mail);$i++) {
|
|
$email_address = trim($target_mail[$i]);
|
|
if(!$email_address) continue;
|
|
$oMail->setReceiptor($email_address, $email_address);
|
|
$oMail->send();
|
|
}
|
|
}
|
|
|
|
// comment_srl이 있으면 수정으로
|
|
} else {
|
|
$obj->parent_srl = $comment->parent_srl;
|
|
$output = $oCommentController->updateComment($obj, $this->grant->manager);
|
|
$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', $obj->comment_srl);
|
|
}
|
|
|
|
function procWikiDeleteComment() {
|
|
// check the comment's sequence number
|
|
$comment_srl = Context::get('comment_srl');
|
|
if(!$comment_srl) return $this->doError('msg_invalid_request');
|
|
|
|
// create controller object of comment module
|
|
$oCommentController = &getController('comment');
|
|
|
|
$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
|
|
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');
|
|
}
|
|
}
|
|
|
|
?>
|