묻고답하기

안녕하세요. 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 남기남
별사탕FS 그림과 같이 로그인 폼의 글씨 색상을 바꾸고 싶습니다. [2] file 2008.11.04 by 별사탕FS
완전초보 수원사시는 제로보드xe 잘아시는분 댓글요~!! ㅠ_ㅠ [6] 2008.11.04 by 뉴자인
쿨김 CSS menu에 대한질문 file  
님아제발 관리자 비번 오류? [2] 2008.11.04 by 님아제발
snowmas 회원정보를 최고 관리자만 보게하려면(1.0.6에서)  
칼잇으마 오픈아이디는 회원정보가 DB에 남지 않나요? [1] 2008.11.04 by Xeicus
게리Gerry 질문좀 드릴께요 ㅡㅡa [1] 2008.11.04 by Xeicus
초보자 질문 올립니다 로그인 최근게시물 [1] 2008.11.04 by 백성찬
이은호198 유저별 언어를 설정할 수 있나요?  
정경진180 세션관리 or 캐쉬파일정리후 xe_document.MYI파일이 날라갔네요..흘. [1] 2008.11.04 by findwind
백동진640 이미지 공간 띄위기. [1] file 2008.11.04 by findwind
팔뚜기 이거 무슨문제인가요? [2] 2008.11.04 by 팔뚜기
부안프로그래밍 파일 첨부가 안됩니다... [2] 2008.11.04 by 부안프로그래밍
황성환823 설치 파일 생성시 오류가 발생하였습니다. file  
부안프로그래밍 메뉴옮길려고 하면 이런 창이 떠요.. [1] 2008.11.04 by SMaker
팔뚜기 권한 Alert 창 띄우려면어찌하나요?  
무돌이 특정 게시물에 달린 댓글만 출력할수 있나요? [3] 2008.11.04 by 무돌이
공기정화 위젯(최근게시물)사이즈를 css소스로 바꿀순 없을까요?  
제로왕초보2 플래너 위젯 에러 (일정의 첫날 에러)  
울리는짱구 페이지 내용직접추가 질문드려요 [5] 2008.11.05 by 백성찬
NauTe 고수님들께 레이아웃 제작에 관해서 여쭙니다. [2] file 2008.11.05 by NauTe
스프카 1차메뉴 color 변경하려면. [1] file 2008.11.05 by kunner
이호재 제로보드XE 1.0.6 애드온 오류(흰색백지가되어버림) [1] 2008.11.05 by 넨네
갈기머리 다국어 관련 - 페이지 모듈이나 게시판 모듈에서 php 코드 적용 가능한가요? [2] 2008.11.05 by 갈기머리
김진철 r4734 에서 복수 그룹 지정이 안되는 문제 발생 [2] 2008.11.05 by 최강현빈
초보616 로그인후 글쓰기에서 파일첨부가 안되는 현상. [4] 2008.11.05 by 랜슬롯
훈훈훈이 업데이트 [1] 2008.11.05 by 네비™
kiss "이미 존재하는 모듈 이름입니다." ? [3] 2008.11.05 by 느까끼
나임 mjworks 레이아웃 쓰시는 분 로고요~ [1] 2008.11.05 by 느까끼
zins 답변이 없으셔서 다시 질문드립니다. [5] 2008.11.05 by zins