묻고답하기

안녕하세요. xe 초보입니다.


혼자서 xe 를 좀 익혀보고자 게시판 dx 라는 모듈의  코드를 뒤적거리고 있는데요...


beluxe.controller.php  파일에서 궁금한 점이 하나 생겨서 질문 드리게 되었습니다.


이 파일의 function 중에 procBoardInsertDocument 라는 것이 

쓴 글을 게시판에 등록해주는 역할을 담당하고 있는 부분이라고 생각되는데요.



이 파일에 등록되어 있는 다른 대부분의 function 들이 대부분 executequery 명령을 실행하는 것과는 달리 

여기에는 executequery 나 그 비슷한 명령들이 안보이는 것 같아서요.


내용을 디비에 등록하려면 쿼리를 실행하는 부분이 분명히 있을거라고 생각하는데, 능력이 부족해 찾을수가 없으니 답답합니다.


설명 가능하신분은 좀 알려주시면 감사하겠습니다.^^;


아래는 해당 function 부분의 코드입니다.





function procBoardInsertDocument()

{

if(!$this->grant->write_document) return new Object(-1, 'msg_not_permitted');


// TODO 카테고리 grant 체크해라, 근데 코어에서 해야될거 같거든?

$args = Context::getRequestVars();


$mod_srl = (int) $args->module_srl;

$doc_srl = (int) $args->document_srl;

if(!$mod_srl || $this->module_srl != $mod_srl) return new Object(-1,'msg_invalid_request');


$oLogIfo = Context::get('logged_info');

$log_mbr_srl = $oLogIfo->member_srl;


// 회원이라면 닉,암호 제거, 상담기능 사용시 비회원 에러

if(Context::get('is_logged'))

{

unset($args->nick_name);

unset($args->password);

}

else if($this->module_info->consultation == 'Y')

{

return new Object(-1,'msg_invalid_request');

}


if(!$this->grant->manager)

{

// 제목 색상 변경 허용이 아니라면 게시글 색상/굵기 제거

if($this->module_info->use_title_color != 'Y')

{

unset($args->title_color);

unset($args->title_bold);

}


if($this->module_info->allow_comment == 'Y' || $this->module_info->allow_comment == 'N')

{

$args->allow_comment = $this->module_info->allow_comment == 'Y' ? 'Y' : 'N';

}


if($this->module_info->allow_trackback == 'Y' || $this->module_info->allow_trackback == 'N')

{

$args->allow_trackback = $this->module_info->allow_trackback == 'Y' ? 'Y' : 'N';

}

}


$args->allow_comment = $args->allow_comment == 'Y' ? 'Y' : 'N';

$args->allow_trackback = $args->allow_trackback == 'Y' ? 'Y' : 'N';


// 사용 상태에 없는 값이면 임시로 설정

$use_status = explode(',', $this->module_info->use_status);

if(!in_array($args->status, $use_status)) $args->status = count($use_status) ? 'TEMP' : 'PUBLIC';


// 사용자 상태 사용시 관리자이고 공지가 아니면 is_notice 필드에 상태입력 TODO is_notice 필드 사용하는이유는 상태를 넣을 필드가 없어서...

if($args->is_notice != 'Y' || !$this->grant->manager) $args->is_notice = 'N';

$args->custom_status = (string) (((int) $args->custom_status < 1 && (int) $args->custom_status > 9) ? 'N' : $args->custom_status);

if($this->module_info->custom_status && $this->grant->manager && $args->is_notice != 'Y'+ ') $args->is_notice = $args->custom_status;


// 값 체크

settype($args->title, "string");

if($args->title == '') $args->title = cut_str(strip_tags($args->content), 20);

if($args->title == '') $args->title = 'Untitled';

if($args->tags) $args->tags = preg_replace('/\s+/', ',', strip_tags($args->tags));


// 포인트 사용이 아니면 포인트 값 제거

$args->use_point = (int) $args->use_point;

$is_use_point = Context::get('is_logged') && ($this->module_info->use_restrict_view == 'P' || $this->module_info->use_restrict_down == 'P');

if(!$is_use_point) unset($args->use_point);


// document module의 객체 생성

$cmDocument = &getModel('document');

$ccDocument = &getController('document');


// 이미 존재하는 글인지 체크

$oDocIfo = $cmDocument->getDocument($doc_srl, FALSE, FALSE);

if($oDocIfo->isExists() && $oDocIfo->get('module_srl') != $mod_srl) return new Object(-1, 'msg_invalid_request');


// 사용자 정의 확장 필드 최대 20개로 제한함

$outvars = $this->_arrangeExtraField($oDocIfo->isExists() ? $oDocIfo->get('extra_vars') : NULL, &$args);

if(!$outvars->toBool()) return $outvars;

if(count($args->extra_vars->beluxe->extra) > 20) return new Object(-1, 'msg_max_extra_fields');


// 포인트  없으면 중단

if($is_use_point && $args->use_point > 0)

{

$cmPoint = &getModel('point');

if($cmPoint->getPoint($log_mbr_srl) < $args->use_point) return new Object(-1, 'msg_not_enough_point');

}


// 익명 사용중인지 체크

$is_anonymous = $log_mbr_srl && in_array($this->module_info->use_anonymous, array('Y', 'S'));

$args->anonymous = ($is_anonymous && ($this->module_info->use_anonymous == 'Y' || $args->anonymous == 'Y')) ? 'Y' : 'N';


$oDB = &DB::getInstance();

if($oDB)

{

$oDB->begin();


// 이미 존재하는 경우 수정

if($oDocIfo->isExists())

{

// 권한 체크

if(!$oDocIfo->isGranted())

{

$oDB->rollback();

return new Object(-1,'msg_not_permitted');

}


if(!$this->grant->manager)

{

//수정,삭제 잠금

if($this->module_info->use_lock_document == 'Y')

{

$is_lock = TRUE;

}

else if($this->module_info->use_lock_document == 'C')

{

$is_lock = (int) $this->module_info->use_lock_document_option <= $oDocIfo->get('comment_count');

}

else if($this->module_info->use_lock_document == 'T')

{

$is_lock = (time() - ztime($oDocIfo->get('regdate'))) > ((int) $this->module_info->use_lock_document_option * 60 * 60 * 24);

}


if($is_lock)

{

$oDB->rollback();

return new Object(-1,'msg_is_locked_document');

}

}


// 관리자 아니면 수정 불가

if(!$this->grant->manager) $args->is_notice = $oDocIfo->get('is_notice');


$out = $ccDocument->updateDocument($oDocIfo, $args);


// 익명 사용시 멥버 정보만 따로 업데이트

if($out->toBool() && $log_mbr_srl && $is_anonymous)

{

$cmMember = &getModel('member');

$oMbrIfo = $cmMember->getMemberInfoByMemberSrl(abs($oDocIfo->get('member_srl')));

$this->_setAnonymous($args, $oMbrIfo);

executeQuery('beluxe.updateDocumentMemberInfo', $args);

}


$is_upCateCnt = $oDocIfo->get('category_srl') != $args->category_srl;

$msg_code = 'success_updated';

$page = Context::get('page');

}

else

{

// 그렇지 않으면 신규 등록

//익명 사용시

if($is_anonymous = $args->anonymous == 'Y') $this->_setAnonymous($args, $oLogIfo);


// 신규에 srl 이 있으면 첨부 파일이 들어있는 경우

$out = $ccDocument->insertDocument($args, $is_anonymous);

$doc_srl = $out->get('document_srl');


// 관리자 메일이 등록되어 있으면 메일 발송

if($out->toBool() && $this->module_info->admin_mail)

{

$tmp_url = getFullUrl(''+ ','document_srl',$doc_srl);

$this->_sendMail(

($is_anonymous || $args->user_name) ? $args->user_name : $oLogIfo->user_name,

($is_anonymous || $args->email_address) ? $args->email_address : $oLogIfo->email_address,

$this->module_info->admin_mail,

$args->title,

sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", $tmp_url, $tmp_url, $args->content)

);

}


$is_upCateCnt = TRUE;

$msg_code = 'success_registed';

}


// 오류 발생시 멈춤

if(!$out->toBool())

{

$oDB->rollback();

return $out;

}


$doc_srl = $out->get('document_srl');


// 포인트 사용이면 빼기

if($is_use_point && $args->use_point)

{

$ccPoint = &getController('point');

$ccPoint->setPoint($log_mbr_srl, $args->use_point, 'minus');

}


$oDB->commit();

}

else return new Object(-1,'msg_dbconnect_failed');


// 캐쉬 갱신

if($is_upCateCnt)

{

require_once(__XEFM_PATH__ . 'classes.cache.php');

BeluxeCache::categoryList($mod_srl);

}


// addons 에서 사용하기에 variables 입력 필요.

$this->add('mid', Context::get('mid'));

$this->add('document_srl', $doc_srl);


$this->setMessage($msg_code);

$this->_setLocation('document_srl', $doc_srl);

}


글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
일등고구마 화일첨부가 안 되네요 [1] 2008.10.31 by 백성찬
개돌 파일 첨부 문제 수정 관련 질문 [2] 2008.10.31 by 개돌
박서영824 관리자 페이지가 안 떠요 ㅜ [5] 2008.10.31 by 박서영824
개돌 첨부파일 썸네일이 안나오네요 [1] 2008.10.31 by 백성찬
Eris ● 최근게시물, 카운터 등 위치에 대해 [2] 2008.10.31 by hOZooinfo
kangho 답변채택기능 추가.... [1] 2008.10.31 by 느까끼
TizTom 웹페이지 안에 제로보드 게시판을 넣고 싶습니다. [1] 2008.10.31 by 느까끼
노을사랑 정말 갑갑합니다 [1] 2008.10.31 by 느까끼
kangho 메일인증 내용이......  
댄디짱 게시판의 파일첨부기능 오류 [1] 2008.11.01 by 백성찬
비스무리 상단2차메뉴가 Log Out시 비활성화???  
Badboy 홈페이지 기본 페이지 index.html [1] 2008.11.01 by 백성찬
휘잉 [해결][이미지첨부] 로그인 화면이 어긋납니다. [6] file 2008.11.01 by 휘잉
휘잉 메뉴이동이 안되고 listorder값을 입력하라고 하네요.. [3] file 2008.11.01 by 백성찬
나진짜 메일인증 재 발송  
huksley db선택하고 다음눌르면 이런에러가..... [3] file 2008.11.01 by 애니맥스
あきら XE레이아웃 메뉴얼 위치변경 문의 [2] 2008.11.01 by あきら
박성우167 XE버젼 에서도 [1] 2008.11.01 by 백성찬
박서영824 회원가입 새창으로 띄우기  
셀군 외부페이지관련 [1] 2008.11.01 by 느까끼
돌풍 Fatal error file  
souffle [질문]혹시 제로보드 영문판이 따로 있는지요..? [6] 2008.11.21 by 토리세상
참악동 이런 식으로 구성 하려면 어찌 해야 하나요? [4] file 2008.11.01 by 참악동
QT [회원가입 폼] 정보 기입 쉽게 안돼요.  
이수형639 로고 이미지가 보이고 안보이고 이상해요 ㅠㅠ 고수님들 봐주세요 [2] 2008.11.01 by 이수형639
행운아 제로보드 저작권 표시부분 감추는 방법 없나요 [2] 2008.11.01 by 행운아
PPoZZak ''이 댓글을...'' 이거 삭제하고픈데요 [2] file 2008.11.01 by PPoZZak
박성우167 스킨을 업테이트했는데 이런 메세지가 떠요 [2] 2008.11.01 by 성우
&d 게시판 상단 내용 글색상 변경 [2] file 2008.11.01 by &d
오타왕자 첨부화일 클릭오류 관련 질문드립니다. [2] 2008.11.01 by 일등고구마