묻고답하기

안녕하세요. 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 남기남
Konghee 위키 어떻게 사용하나요  
redviolet212 링크걸리는게 이상해서 그런데 꼭좀 부탁드려요.. [2] 2012.02.01 by 때린데 또때려
lisleader [질문] xe_menu_item 이상 데이타 생성으로 인한 서버 부하 폭증, 다운, 장애  
슈퍼보드맨 페이지추가후,자바스크립트 노출.  
kei309 가입한 회원 수정 불가  
whitemind XE관련은 아니지만 한글이 깨져서 나옵니다. [1] 2012.02.01 by 송동우
럭셜진 확장변수 다중선택 때문에 그러는데요... [1] 2012.02.01 by 송동우
IU 사이트맵질문 [1] file 2012.02.01 by 황비
운명같은사람 게시판 관리모드에서 스킨정보를 누르니까 [한번만 도와주세요] [5] 2012.02.01 by 황비
WSJ 첨부파일 박스 크기 [1] file 2012.02.01 by 송동우
M3 분류 관리에서 분류 항목 삭제가 안됩니다 [3] file 2012.02.01 by 송동우
leebackup 이런건 어떻게 만드는 거에여? [1] file 2012.02.01 by 도라미
leebackup 게시판 댓글쪽에 닉네임이 길어서 계단현상이 일어나네요 [1] 2012.02.01 by 송동우
ddddggfrfv 게시판 스킨 수정 중에 [2] 2012.02.01 by 송동우
곰은어흥 몇가지 질문이 있습니다. [1] 2012.02.01 by 송동우
bonafide ko.lang 파일에 출력문구를 수정하면 에러가 납니다. [1] 2012.02.01 by 송동우
ezisis 로그인시 메뉴가 사라지는 문제. [1] 2012.02.01 by 송동우
iMint 댓글에 넥네임 대신 이름이 표시되도록 하려면 어디를 수정해야하나요??? [1] 2012.02.01 by 황비
명불허전 레이아웃 수정 문제 질문합니다. [1] 2012.01.31 by 황비
마법의가을 카페 XE관련 질문 드립니다.  
재문아빠 게시판의 module_srl을 알고 싶은데요. [1] file 2012.01.31 by 황비
리남철 새로고침하면 창이 닫힙니다. [1] 2012.01.31 by 황비
자유신 황비님 강의글 본 후 어떤것들을 추가로 배우면 좋을까요// [1] 2012.01.31 by 황비
손주사랑 윈도우7에는 F 드라이브가없나요? [1] file 2012.01.31 by 황비
acsl 문제 3가지가 있습니다.ㅠ(파일첨부,게시판관리, 위젯사이트연결) [1] 2012.01.31 by 황비
오골계 설치후 첫 로그인에서 이메일 주소 자체가 없답니다. ;;;;[사진첨부] [2] file 2012.01.31 by 황비
낑깡호두 메인페이지 xe없애는 법 [1] file 2012.01.31 by 황비
redviolet212 헤더부분을 수정할려면 어디서..?  
mskiller XE 설치에서 "DB 선택" 화면에서 mssql 선택이 안되요 [1] 2012.01.31 by mskiller
달빛영혼 메타태그로 도메인접속시 바로 -> XE 접속되게 했을경우..