mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5785 201d5d3c-b55e-5fd7-737f-ddc643e51545
59 lines
2.2 KiB
PHP
59 lines
2.2 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(!$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';
|
|
debugPrint($obj);
|
|
|
|
// 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);
|
|
}
|
|
}
|
|
|
|
?>
|