/**
  * 게시글 등록 및 수정
  */
 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;
 }
Пример #2
0
 /**
  * 게시판 목록 페이지로 이동한다.
  * @param int $board_id
  */
 private function boardRedirect($board_id)
 {
     global $wpdb;
     $board = new KBoard($board_id);
     if ($board->uid) {
         $meta = new KBoardMeta($board_id);
         if ($meta->auto_page) {
             $page_id = $meta->auto_page;
         } else {
             $page_id = $wpdb->get_var("SELECT `ID` FROM `" . KBOARD_DB_PREFIX . "posts` WHERE `post_content` LIKE '%[kboard id={$board_id}]%' AND `post_type`='page'");
         }
         if ($page_id) {
             $url = new KBUrl();
             $board_url = $url->set('kboard_content_redirect', '')->set('kboard_redirect', '')->toStringWithPath(get_permalink($page_id));
         } else {
             $board_url = plugins_url("board.php?board_id={$board_id}", __FILE__);
         }
         header("Location:{$board_url}");
         exit;
     }
     $this->error();
 }
Пример #3
0
 /**
  * 게시물 삭제 페이지를 생성한다. (완료 후 바로 리다이렉션)
  */
 public function builderRemove()
 {
     if (!stristr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
         echo '<script>alert("KBoard : ' . __('This page is restricted from external access.', 'kboard') . '");</script>';
         return;
     }
     $url = new KBUrl();
     $content = new KBContent($this->board_id);
     $content->initWithUID($this->uid);
     if (!$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) {
         $skin_path = KBOARD_URL_PATH . "/skin/{$this->skin}";
         $board = $this->board;
         include KBOARD_DIR_PATH . "/skin/{$this->skin}/confirm.php";
     } else {
         $content->remove();
         // 삭제뒤 게시판 리스트로 이동한다.
         $next = $url->set('mod', 'list')->toString();
         die("<script>location.href='{$next}';</script>");
     }
 }
Пример #4
0
 /**
  * 게시판 목록 페이지 주소를 반환한다.
  * @param int $board_id
  * @return string
  */
 public function getBoardURL($board_id)
 {
     global $wpdb;
     $board_id = intval($board_id);
     $board = new KBoard($board_id);
     if ($board->uid) {
         $meta = new KBoardMeta($board_id);
         if ($meta->auto_page) {
             $page_id = $meta->auto_page;
         } else {
             $page_id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->prefix}posts` WHERE `post_content` LIKE '%[kboard id={$board_id}]%' AND `post_type`='page'");
         }
         if ($page_id) {
             $url = new KBUrl();
             $board_url = $url->set('kboard_content_redirect', '')->set('kboard_redirect', '')->toStringWithPath(get_permalink($page_id));
         } else {
             $board_url = get_home_url() . "?kboard_id={$board_id}";
         }
         return $board_url;
     }
     return '';
 }