/**
  * 게시글 등록 및 수정
  */
 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 single_row($item)
 {
     echo '<tr data-uid="' . $item->uid . '">';
     echo '<th scope="row" class="check-column">';
     echo '<input type="checkbox" name="uid[]" value="' . $item->uid . '">';
     echo '</th>';
     echo '<td class="kboard-content-list-board">';
     if ($item->board_id) {
         echo '<select class="kboard-id-select" name="board_id_' . $item->uid . '">';
         while ($this->board->hasNext()) {
             echo '<option value="' . $this->board->uid . '"' . ($item->board_id == $this->board->uid ? ' selected' : '') . '>' . $this->board->board_name . '</option>';
         }
         echo '</select>';
     } else {
         echo '답글입니다.';
     }
     echo '</td>';
     echo '<td class="kboard-content-list-title">';
     $url = new KBUrl();
     echo '<h4>' . mb_strimwidth(strip_tags($item->title), 0, 300, '...', 'UTF-8') . '</h4>';
     echo '<span class="row-actions"><span class="edit"> | <a href="' . $url->getDocumentRedirect($item->uid) . '" onclick="window.open(this.href);return false;">새창열기</a></span></span>';
     echo '<p>' . mb_strimwidth(strip_tags($item->content), 0, 300, '...', 'UTF-8') . '</p>';
     echo '</td>';
     echo '<td>';
     if ($item->member_uid) {
         echo '<a href="' . admin_url('/user-edit.php?user_id=' . $item->member_uid) . '">';
     }
     echo $item->member_display;
     if ($item->member_uid) {
         echo '</a>';
     }
     echo '</td>';
     echo '<td>';
     echo $item->view;
     echo '</td>';
     echo '<td>';
     echo $item->secret ? '예' : '아니오';
     echo '</td>';
     echo '<td>';
     echo $item->notice ? '예' : '아니오';
     echo '</td>';
     echo '<td>';
     echo date('Y-m-d H:i:s', strtotime($item->date));
     echo '</td>';
     echo '</tr>';
 }
示例#3
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();
 }
示例#4
0
<?php

list($path) = explode(DIRECTORY_SEPARATOR . 'wp-content', dirname(__FILE__) . DIRECTORY_SEPARATOR);
include $path . DIRECTORY_SEPARATOR . 'wp-load.php';
$url = new KBUrl();
$list = new KBContentList();
$list->rpp = 20;
$list->initWithRSS();
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<rss version="2.0">
	<channel>
		<title><?php 
echo __('WordPress KBoard feed', 'kboard');
?>
</title>
		<link><?php 
echo plugins_url();
?>
/kboard/rss.php</link>
		<description><?php 
echo __('WordPress KBoard feed', 'kboard');
?>
</description>
		<?php 
while ($content = $list->hasNext()) {
    $kboard = new KBoard($content->board_id);
    ?>
		<item>
			<title><![CDATA[<?php 
    echo $content->title;
示例#5
0
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<?php 
}
?>
				
				<?php 
while ($comment = $commentList->hasNext()) {
    ?>
				<?php 
    $content = new KBContent();
    $content->initWithUID($comment->content_uid);
    $board = new KBoard($content->board_id);
    $url = new KBUrl();
    ?>
				<tr>
					<th class="check-column"><input type="checkbox" name="comment_uid[]" value="<?php 
    echo $comment->uid;
    ?>
"></th>
					<td><a class="row-title" href="<?php 
    echo KBOARD_SETTING_PAGE;
    ?>
&board_id=<?php 
    echo $board->uid;
    ?>
" title="편집"><?php 
    echo $board->board_name;
    ?>
示例#6
0
 /**
  * 게시글의 댓글 개수를 반환한다.
  * @param string $prefix
  * @param string $endfix
  * @return string
  */
 public function getCommentsCount($prefix = '(', $endfix = ')')
 {
     if ($this->uid) {
         $meta = new KBoardMeta($this->board_id);
         if ($meta->comments_plugin_id && $meta->use_comments_plugin) {
             $url = new KBUrl();
             return '<span class="cosmosfarm-comments-plugin-count" data-url="' . $url->getCommentsPluginURLWithUID($this->uid) . '"></span>';
         } else {
             if ($this->comment) {
                 return "{$prefix}{$this->comment}{$endfix}";
             }
         }
     }
     return '';
 }
 /**
  * 게시물 삭제 페이지를 생성한다. (완료 후 바로 리다이렉션)
  */
 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>");
     }
 }
示例#8
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 '';
 }