echo apply_filters('kkb_comment_content_inner_after', null, $board_id, $entry_id, $comment->comment_ID);
                ?>
      </div>
    </div>
<?php 
                $comment_after = apply_filters('kingkongboard_comment_after', $board_id, $entry_id, $comment->comment_ID);
                if ($comment_after != $board_id) {
                    echo $comment_after;
                }
                ?>
  </div>
  <div class="comment-controller">
<?php 
                $controller = new kkbController();
                $controllers = null;
                if ($controller->actionCommentPermission($board_id, $comment->comment_ID, 'modify') == true) {
                    $modify_args = apply_filters('kkb_read_arg_after', array('view' => 'cmtcheck', 'cid' => $comment->comment_ID, 'id' => $entry_id, 'mod' => 'modify'), $board_id);
                    $controllers['modify'] = array('label' => __('수정', 'kingkongboard'), 'class' => 'kkblc-comment-modify', 'aclass' => null, 'ahref' => add_query_arg($modify_args, get_the_permalink()), 'data' => null);
                }
                if ($controller->actionCommentPermission($board_id, $comment->comment_ID, 'delete') == true) {
                    $controllers['delete'] = array('label' => __('삭제', 'kingkongboard'), 'class' => 'kkblc-comment-delete', 'aclass' => 'kkb-check-comment-delete', 'ahref' => null, 'data' => $comment->comment_ID);
                }
                if ($controller->actionCommentPermission($board_id, $comment->comment_ID, 'write') == true) {
                    $controllers['write'] = array('label' => __('댓글', 'kingkongboard'), 'class' => 'kkblc-comment-reply', 'aclass' => 'btn-kkb-comment-reply', 'ahref' => null, 'data' => null);
                }
                if (isset($controllers)) {
                    foreach ($controllers as $controller) {
                        $controller['ahref'] != null ? $ahref = 'href="' . $controller['ahref'] . '"' : ($ahref = null);
                        $controller['aclass'] != null ? $aclass = 'class="' . $controller['aclass'] . '"' : ($aclass = null);
                        $controller['data'] != null ? $data = 'data-id="' . $controller['data'] . '"' : ($data = null);
                        ?>
Пример #2
0
 public function kkb_comment_save($data)
 {
     $entry_id = kingkongboard_xssfilter(kingkongboard_htmlclear($data['entry_id']));
     $controller = new kkbController();
     $board_id = $controller->getMeta($entry_id, 'board_id');
     $comment_html_use = get_post_meta($board_id, 'kkb_comment_html_use', true);
     if ($comment_html_use == 'T') {
         $content = kingkongboard_xssfilter($data['kkb_comment_content']);
     } else {
         $content = kingkongboard_xssfilter(kingkongboard_htmlclear($data['kkb_comment_content']));
     }
     $content = apply_filters('kkb_comment_write_content_xssfilter_after', $content, $data['kkb_comment_content'], $board_id);
     isset($data['comment_parent']) ? $comment_parent = kingkongboard_xssfilter(kingkongboard_htmlclear($data['comment_parent'])) : ($comment_parent = null);
     if ($controller->actionCommentPermission($board_id, null, 'write') == true) {
         if ($comment_parent) {
             $parent = $comment_parent;
         } else {
             $parent = 0;
         }
         if (is_user_logged_in()) {
             global $current_user;
             get_currentuserinfo();
             $writer = $current_user->display_name;
             $email = $current_user->user_email;
             $user_id = $current_user->ID;
         } else {
             $writer = kingkongboard_xssfilter(kingkongboard_htmlclear($data['writer']));
             $email = kingkongboard_xssfilter(kingkongboard_htmlclear($data['email']));
             $user_id = 0;
         }
         if (!empty($data['comment_origin'])) {
             $origin = sanitize_text_field($data['comment_origin']);
         } else {
             $origin = 0;
         }
         if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
             $ip = $_SERVER['HTTP_CLIENT_IP'];
         } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
         } else {
             $ip = $_SERVER['REMOTE_ADDR'];
         }
         $time = current_time('mysql');
         $comment = array('comment_post_ID' => $entry_id, 'comment_author' => $writer, 'comment_author_email' => $email, 'comment_author_url' => '', 'comment_content' => $content, 'comment_type' => '', 'comment_parent' => $parent, 'user_id' => $user_id, 'comment_author_IP' => $ip, 'comment_agent' => $_SERVER['HTTP_USER_AGENT'], 'comment_date' => $time, 'comment_approved' => 1);
         $comment_id = wp_insert_comment($comment);
         if (!is_wp_error($comment_id)) {
             $parent_depth = $this->kkb_get_comment_meta($comment_parent, 'depth');
             $parent_origin = $this->kkb_get_comment_meta($comment_parent, 'origin');
             if (!$parent_depth) {
                 $parent_depth = 0;
             }
             if ($parent_origin) {
                 if ($parent_origin == $comment_parent) {
                     $origin = $comment_parent;
                 } else {
                     $origin = $parent_origin;
                 }
             } else {
                 $origin = $comment_id;
             }
             $input_meta = array('lnumber' => 1, 'eid' => $entry_id, 'cid' => $comment_id, 'origin' => $origin, 'parent' => $comment_parent, 'depth' => $parent_depth + 1);
             $this->kkb_update_comment_meta($input_meta);
             if (!is_user_logged_in()) {
                 update_comment_meta($comment_id, 'kkb_comment_password', md5($data['password']));
             }
             do_action('kingkongboard_save_comment_after', $entry_id, $comment_id, $content);
             return $comment_id;
         }
     }
 }
Пример #3
0
 public function view($view)
 {
     global $post;
     switch ($view) {
         case 'list':
             ob_start();
             require_once KINGKONGBOARD_ABSPATH . "includes/view.list.php";
             $content = ob_get_contents();
             ob_end_clean();
             break;
         case 'read':
             $entry_type = parent::getMeta($this->entry_id, 'type');
             if ($this->entry_id && parent::actionPermission($this->board_id, $this->entry_id, 'read') == true && $entry_type <= 1) {
                 switch (parent::checkSecret($this->board_id, $this->entry_id)) {
                     case 0:
                         // 열람가능
                         ob_start();
                         require_once kkb_template_path("view.read.php");
                         $content = ob_get_contents();
                         ob_end_clean();
                         break;
                     case 1:
                         ob_start();
                         require_once kkb_template_path("view.read.check.php");
                         $content = ob_get_contents();
                         ob_end_clean();
                         break;
                     case 2:
                         // 회원, 본인글이 아니므로 열람 불가하다.
                         return apply_filters('kkb_read_secret_denied', __('비밀글 입니다. 작성자 본인과 관리자만 열람할 수 있습니다.', 'kingkongboard'), $this->board_id);
                         break;
                 }
             } else {
                 $content = apply_filters('kkb_loop_read_denied_message', __('권한이 없거나 게시글이 존재하지 않습니다.', 'kingkongboard'), $this->board_id);
             }
             break;
         case 'write':
             if (parent::actionPermission($this->board_id, null, 'write') == true) {
                 ob_start();
                 require_once kkb_template_path("view.write.php");
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 $content = apply_filters('kkb_loop_write_denied_message', __('글 쓰기 권한이 없습니다.', 'kingkongboard'), $this->board_id);
             }
             break;
         case 'modify':
             if (parent::actionPermission($this->board_id, $this->entry_id, 'modify') == true) {
                 ob_start();
                 require_once kkb_template_path("view.modify.php");
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 $content = apply_filters('kkb_loop_modify_denied_message', __('글수정 권한이 없습니다.', 'kingkongboard'), $this->board_id);
             }
             break;
         case 'reply':
             $parent_type = parent::getMeta($this->entry_id, 'type');
             if (parent::actionPermission($this->board_id, $this->entry_id, 'reply') == true && $parent_type != 1) {
                 ob_start();
                 require_once kkb_template_path("view.reply.php");
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 $content = apply_filters('kkb_loop_reply_denied_message', __('답글쓰기가 허용되지 않습니다.', 'kingkongboard'), $this->board_id);
             }
             break;
         case 'delete':
             if (parent::actionPermission($this->board_id, $this->entry_id, 'delete') == true) {
                 ob_start();
                 require_once kkb_template_path("view.delete.php");
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 $content = apply_filters('kkb_loop_delete_denied_message', __('글 삭제 권한이 없습니다.', 'kingkongboard'), $this->board_id);
             }
             break;
         case 'cmtcheck':
             if (isset($_GET['mod']) && isset($_GET['cid'])) {
                 $cid = sanitize_text_field($_GET['cid']);
                 $mod = sanitize_text_field($_GET['mod']);
                 $exists = get_comment($cid);
                 if (isset($exists->comment_ID)) {
                     if (parent::actionCommentPermission($this->board_id, $cid, $mod) == true) {
                         ob_start();
                         require_once KINGKONGBOARD_ABSPATH . "includes/view.read.comment.check.php";
                         $content = ob_get_contents();
                         ob_end_clean();
                     } else {
                         $content = apply_filters('kkb_comment_permission_denied_message', __('권한이 없습니다.', 'kingkongboard'), $this->board_id);
                     }
                 } else {
                     $content = apply_filters('kkb_comment_noexists_message', __('존재하지 않는 댓글 입니다.', 'kingkongboard'), $this->board_id);
                 }
             } else {
                 $content = apply_filters('kkb_comment_action_denied_message', __('잘못된 접근 입니다.', 'kingkongboard'), $this->board_id);
             }
             break;
     }
     return $content;
 }
if ($user->user_login == null) {
    $user_alt = __("비회원 프로필 이미지", "kingkongboard");
} else {
    $user_alt = $user->user_login;
}
is_user_logged_in() ? $readOnly = 'readonly' : ($readOnly = null);
is_user_logged_in() ? $userStatus = 1 : ($userStatus = 0);
?>
<div class="comment-section">
  <form method="post" enctype="multipart/form-data" action="<?php 
echo KINGKONGBOARD_PLUGINS_URL;
?>
/includes/view.read.comment.save.php" onsubmit="return kkb_comment_submit();">
<?php 
$controller = new kkbController();
if ($controller->actionCommentPermission($board_id, null, 'write') == true) {
    ?>
    
    <div class="comment-editor">
      <div class="comment-editor-top">
        <span class="kkb-list-icon kkblc-people"></span>
        <span style="width:auto"><h2 class="kkb-read-h2"><strong><?php 
    _e('댓글 쓰기', 'kingkongboard');
    ?>
</strong></h2></span>
      </div>
      <div class="comment-editor-content">
        <span class="comment-editor-avatar">
<?php 
    if (isset($matches[1])) {
        ?>
Пример #5
0
 public function kkb_comment_modify($data)
 {
     global $wpdb;
     $table = $wpdb->prefix . 'comments';
     $controller = new kkbController();
     $content = kingkongboard_xssfilter(kingkongboard_htmlclear($data['kkb_comment_modify_textarea']));
     $entry_id = kingkongboard_xssfilter(kingkongboard_htmlclear($data['entry_id']));
     $board_id = $controller->getMeta($entry_id, 'board_id');
     $cid = $data['cid'];
     if ($controller->actionCommentPermission($board_id, $cid, 'modify') == true) {
         $wpdb->update($table, array('comment_content' => $content), array('comment_ID' => $cid), array('%s'), array('%d'));
     }
 }