/** * 게시글 등록 및 수정 */ public function editorExecute() { global $user_ID; if (isset($_POST['kboard-editor-execute-nonce']) && wp_verify_nonce($_POST['kboard-editor-execute-nonce'], 'kboard-editor-execute')) { header('Content-Type: text/html; charset=UTF-8'); $uid = intval(isset($_POST['uid']) ? $_POST['uid'] : ''); $board_id = intval(isset($_POST['board_id']) ? $_POST['board_id'] : ''); $board = new KBoard($board_id); if (!$board->id) { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } if ($board->isWriter() && $board->permission_write == 'all' && $_POST['title']) { if (!$user_ID && !$_POST['password']) { die('<script>alert("' . __('Please enter your password.', 'kboard') . '");history.go(-1);";</script>'); } } $content = new KBContent(); $content->initWithUID($uid); $content->setBoardID($board_id); if (!$uid && !$board->isWriter()) { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } else { if ($uid && !$board->isEditor($content->member_uid)) { if ($board->permission_write == 'all') { if (!$board->isConfirm($content->password, $content->uid)) { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } } else { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } } } $execute_uid = $content->execute(); // 비밀번호가 입력되면 즉시 인증과정을 거친다. if ($content->password) { $board->isConfirm($content->password, $execute_uid); } $url = new KBUrl(); $next_page_url = $url->set('uid', $execute_uid)->set('mod', 'document')->toString(); $next_page_url = apply_filters('kboard_after_executing_url', $next_page_url, $execute_uid, $board_id); if ($content->execute_action == 'insert') { if ($board->meta->conversion_tracking_code) { echo $board->meta->conversion_tracking_code; echo "<script>location.href='{$next_page_url}';</script>"; exit; } } wp_redirect($next_page_url); } else { wp_redirect(site_url()); } exit; }
/** * 게시판 에디터 페이지를 생성한다. */ public function builderEditor() { global $user_ID; $userdata = get_userdata($user_ID); $url = new KBUrl(); if ($this->board->isWriter() && $this->board->permission_write == 'all' && $_POST['title']) { $next_url = $url->set('uid', $this->uid)->set('mod', 'editor')->toString(); if (!$user_ID && !$_POST['password']) { die('<script>alert("' . __('Please enter your password.', 'kboard') . '");location.href="' . $next_url . '";</script>'); } } $content = new KBContent($this->board_id); $content->initWithUID($this->uid); $skin_path = KBOARD_URL_PATH . "/skin/{$this->skin}"; $board = $this->board; $boardBuilder = $this; if (!$this->uid && !$this->board->isWriter()) { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } else { if ($this->uid && !$this->board->isEditor($content->member_uid)) { if ($this->board->permission_write == 'all') { if (!$this->board->isConfirm($content->password, $content->uid)) { $confirm_view = true; } } else { die('<script>alert("' . __('You do not have permission.', 'kboard') . '");history.go(-1);</script>'); } } } if ($confirm_view) { include KBOARD_DIR_PATH . "/skin/{$this->skin}/confirm.php"; } else { $execute_uid = $content->execute(); if ($execute_uid) { // 비밀번호가 입력되면 즉시 인증과정을 거친다. if ($content->password) { $this->board->isConfirm($content->password, $execute_uid); } $next_url = $url->set('uid', $execute_uid)->set('mod', 'document')->toString(); die("<script>location.href='" . apply_filters('kboard_after_executing_url', $next_url) . "';</script>"); } // execute후 POST 데이터를 지우고 다시 초기화 한다. $content->initWithUID($this->uid); // 내용이 없으면 등록된 기본 양식을 가져온다. if (!$content->content) { $content->content = $this->meta->default_content; } // 새로운 답글 쓰기에서만 실행한다. if ($_GET['parent_uid'] && !$content->uid && !$content->parent_uid) { $parent = new KBContent(); $parent->initWithUID($_GET['parent_uid']); // 부모 고유번호가 있으면 답글로 등록하기 위해서 부모 고유번호를 등록한다. $content->parent_uid = $parent->uid; // 비밀글이면 부모 비밀번호를 가져온다. if ($parent->secret == 'true' && !$content->notice && ($this->board->isEditor($parent->member_uid) || $this->board->isConfirm($parent->password, $parent->uid))) { $content->password = $parent->password; } // 답글 기본 내용을 설정한다. if ($this->meta->reply_copy_content == '1') { $content->content = $parent->content; } else { if ($this->meta->reply_copy_content == '2') { $content->content = $this->meta->default_content; } else { $content->content = ''; } } } include KBOARD_DIR_PATH . "/skin/{$this->skin}/editor.php"; } }