Exemplo n.º 1
0
 public function download()
 {
     if (parent::actionPermission($this->board_id, $this->entry_id, 'read') == true) {
         $filename = $this->filename;
         $filesize = filesize($this->fullpath);
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename=' . $filename);
         header('Content-Transfer-Encoding: binary');
         header('Connection: Keep-Alive');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Content-Length: ' . $filesize);
         ob_clean();
         flush();
         readfile($this->fullpath);
         do_action('kkb_download_after', $this->entry_id, $this->attach_id);
         exit;
     } else {
         $message = apply_filters('kkb_download_failed_alert', "<script>alert('" . __('파일 다운로드 권한이 없습니다.', 'kingkongboard') . "');</script>", $this->entry_id, $this->attach_id);
         echo $message;
     }
 }
<?php

$entry_id = $board_id;
$Board = new kkbController();
$board_id = $Board->getMeta($entry_id, 'board_id');
if (isset($_POST['entry_title'])) {
    $entry_title = sanitize_text_field($_POST['entry_title']);
} else {
    $entry_title = null;
}
if ($entry_title) {
    $Board->writeModify($_POST, 'admin');
}
$current_user = wp_get_current_user();
$hour_options = null;
$minute_options = null;
$second_options = null;
for ($i = 0; $i < 24; $i++) {
    if ($i == date('H', $Board->getMeta($entry_id, 'date'))) {
        $hour_options .= '<option selected>' . $i . '</option>';
    } else {
        $hour_options .= '<option>' . $i . '</option>';
    }
}
for ($i = 0; $i < 60; $i++) {
    if ($i == date('i', $Board->getMeta($entry_id, 'date'))) {
        $minute_options .= '<option selected>' . $i . '</option>';
    } else {
        $minute_options .= '<option>' . $i . '</option>';
    }
}
                echo apply_filters('kkb_comment_content_inner_before', null, $board_id, $entry_id, $comment->comment_ID);
                echo "<h2 class='kkb-read-h2'>" . nl2br($comment->comment_content) . "</h2>";
                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);
Exemplo n.º 4
0
 /**
  * 게시글의 태그를 불러온다.
  **/
 public function getTags($bid)
 {
     global $wpdb;
     $result_tags = null;
     $controller = new kkbController();
     $tax_table = $wpdb->prefix . 'term_taxonomy';
     $relation_table = $wpdb->prefix . 'term_relationships';
     $kkb_tags = $wpdb->get_results("SELECT term_taxonomy_id FROM {$tax_table} WHERE taxonomy = 'kkb_tag' ORDER BY count ASC");
     if ($kkb_tags) {
         foreach ($kkb_tags as $tag) {
             $term_ids[] = $tag->term_taxonomy_id;
         }
         if ($term_ids) {
             $term_ids = join(',', $term_ids);
             $relations = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM {$relation_table} WHERE term_taxonomy_id IN ({$term_ids})");
             if ($relations) {
                 foreach ($relations as $relation) {
                     $entry_id = $relation->object_id;
                     $get_board_id = $controller->getMeta($entry_id, 'board_id');
                     if ($bid == $get_board_id) {
                         $result_tags[] = $relation->term_taxonomy_id;
                     }
                 }
             }
         }
     }
     if ($result_tags) {
         $result_tags = join(',', $result_tags);
         $results = $wpdb->get_results("SELECT term_taxonomy_id FROM {$tax_table} WHERE term_taxonomy_id IN ({$result_tags}) ORDER BY count DESC LIMIT 8");
         foreach ($results as $result) {
             $terms[] = $result->term_taxonomy_id;
         }
         $result_tags = $terms;
     }
     return $result_tags;
 }
<?php

list($path) = explode(DIRECTORY_SEPARATOR . 'wp-content', dirname(__FILE__) . DIRECTORY_SEPARATOR);
include $path . DIRECTORY_SEPARATOR . 'wp-load.php';
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
if (!stristr($referer, $host)) {
    wp_die('KINGKONG BOARD : ' . __('지금 페이지는 외부 접근이 차단되어 있습니다.', 'kingkongboard'));
}
if (!isset($_POST)) {
    wp_die('KINGKONG BOARD : ' . __('잘못된 접근 입니다.', 'kingkongboard'));
}
include_once ABSPATH . 'wp-includes/pluggable.php';
$kkb_comment = new kkbComment();
$kkb_comment->kkb_comment_save($_POST);
$controller = new kkbController();
$post_id = $controller->getMeta($_POST['entry_id'], 'guid');
$board_id = $controller->getMeta($_POST['entry_id'], 'board_id');
$iframe_use = get_post_meta($board_id, 'kkb_iframe_use', true);
$return_args = array('view' => 'read', 'id' => $_POST['entry_id']);
if ($iframe_use == 'T') {
    $return_args['kkb_mod'] = 'iframe';
}
$return_path = add_query_arg($return_args, get_the_permalink($post_id));
header("Location: " . $return_path);
Exemplo n.º 6
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'));
     }
 }
<?php

if (isset($_POST['entry_title'])) {
    $entry_title = sanitize_text_field($_POST['entry_title']);
} else {
    $entry_title = null;
}
if ($entry_title) {
    $Board = new kkbController();
    $Board->writeEntry($board_id, $_POST, 'admin');
}
$current_user = wp_get_current_user();
$hour_options = null;
$minute_options = null;
$second_options = null;
for ($i = 0; $i < 24; $i++) {
    if ($i == date('H', current_time('timestamp', 0))) {
        $hour_options .= '<option selected>' . $i . '</option>';
    } else {
        $hour_options .= '<option>' . $i . '</option>';
    }
}
for ($i = 0; $i < 60; $i++) {
    if ($i == date('i', current_time('timestamp', 0))) {
        $minute_options .= '<option selected>' . $i . '</option>';
    } else {
        $minute_options .= '<option>' . $i . '</option>';
    }
}
for ($i = 0; $i < 60; $i++) {
    if ($i == date('s', current_time('timestamp', 0))) {
Exemplo n.º 8
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;
         }
     }
 }
Exemplo n.º 9
0
$return_args = array('pageid' => $pageid);
if ($iframe_use == 'T') {
    $return_args['kkb_mod'] = 'iframe';
}
$return_path = add_query_arg($return_args, get_the_permalink($post_id));
if (isset($_POST['g-recaptcha-response'])) {
    $cpt_response = sanitize_text_field($_POST['g-recaptcha-response']);
    $response = kingkongboard_captcha_initialize($board_id, $cpt_response);
} else {
    $response = true;
}
if ($response == false) {
    $result['status'] = 'failed';
    $result['message'] = __('자동글 방지에 체크하셔야 합니다.', 'kingkongboard');
} else {
    $Board = new kkbController();
    if ($_POST['write_type'] == 'write' || $_POST['write_type'] == 'reply') {
        $entry_id = $Board->writeEntry($board_id, $_POST, 'basic');
        if ($entry_id && is_numeric($entry_id)) {
            $upload = $Board->fileUploader($entry_id, $_POST, $_FILES);
            if ($upload) {
                if (is_array($upload)) {
                    $message = $upload['message'];
                    $result['status'] = 'failed';
                    $result['message'] = $message;
                } else {
                    $result['status'] = 'success';
                    $result['url'] = get_the_permalink($post_id);
                }
            } else {
                $result['status'] = 'success';
function KingkongBoard_Setting_Panel_Permission()
{
    $roles = get_editable_roles();
    if (isset($_GET['id'])) {
        $board_managers = get_post_meta(sanitize_text_field($_GET['id']), 'board_managers', true);
    } else {
        $board_managers = null;
    }
    $managers_value = '';
    if ($board_managers) {
        $board_managers = maybe_unserialize($board_managers);
        foreach ($board_managers as $manager) {
            $managers_value .= "<div class='each-manager-div'>" . $manager . "<div class='each-manager-remove'><img src='" . KINGKONGBOARD_PLUGINS_URL . "/assets/images/icon-close.png' style='width:12px; height:auto'></div><input type='hidden' name='board_manager[]' value='" . $manager . "'></div>";
        }
    }
    $controller = new kkbController();
    ?>

    <table>
      <tr>
        <th><?php 
    echo __('관리자 추가', 'kingkongboard');
    ?>
 :</th>
        <td>
          <input type="text" class="kkb-input manager-input" style="max-width:180px; width:100%">
          <button type="button" class="kkb-icon kkbblue button-add-manager"><i class="kkb-icon kkb-icon-plus" style="position:relative; top:3px"></i><?php 
    echo __('추가하기', 'kingkongboard');
    ?>
</button>
          <div class="description-container">
            <span class="description"><?php 
    echo __('사용자 아이디를 입력하세요, 콤마(,)로 구분.', 'kingkongboard');
    ?>
</span>
          </div>       
          <div class="kkb-read-role-box"><?php 
    echo $managers_value;
    ?>
</div>         
        </td>
      </tr>
      <tr>
        <td colspan="2" class="kkb-pannel-permission-td">
          <div class="pm-tab-wrapper">
            <span class="pm-tab pm-tab-entry active"><?php 
    _e('게시글 권한', 'kingkongboard');
    ?>
</span>
            <span class="pm-tab pm-tab-comment"><?php 
    _e('댓글 권한', 'kingkongboard');
    ?>
</span>
          </div>
          <div class="tab-entry">
            <table>
              <tr>
                <th><?php 
    echo __('User Role', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('읽기', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('쓰기', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('수정', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('삭제', 'kingkongboard');
    ?>
</th>
              </tr>
<?php 
    if (isset($_GET['id'])) {
        $board_id = sanitize_text_field($_GET['id']);
    } else {
        $board_id = null;
    }
    foreach ($roles as $role_name => $role_info) {
        $permission_read = $controller->checkPermissionByRole($board_id, 'entry', 'read', $role_name);
        $permission_write = $controller->checkPermissionByRole($board_id, 'entry', 'write', $role_name);
        $permission_delete = $controller->checkPermissionByRole($board_id, 'entry', 'delete', $role_name);
        $permission_modify = $controller->checkPermissionByRole($board_id, 'entry', 'modify', $role_name);
        $permission_read ? $read_checked = 'checked' : ($read_checked = null);
        $permission_write ? $write_checked = 'checked' : ($write_checked = null);
        $permission_delete ? $delete_checked = 'checked' : ($delete_checked = null);
        $permission_modify ? $modify_checked = 'checked' : ($modify_checked = null);
        ?>
              <tr>
                <td><?php 
        echo $role_name;
        ?>
</td>
                <td><input type="checkbox" name="permission_read[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $read_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_write[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $write_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_modify[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $modify_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_delete[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $delete_checked;
        ?>
></td>
              </tr>            
<?php 
    }
    $guest_permission_read = $controller->checkPermissionByRole($board_id, 'entry', 'read', 'guest');
    $guest_permission_write = $controller->checkPermissionByRole($board_id, 'entry', 'write', 'guest');
    $guest_permission_delete = $controller->checkPermissionByRole($board_id, 'entry', 'delete', 'guest');
    $guest_permission_modify = $controller->checkPermissionByRole($board_id, 'entry', 'modify', 'guest');
    $guest_permission_read ? $guest_read_checked = 'checked' : ($guest_read_checked = null);
    $guest_permission_write ? $guest_write_checked = 'checked' : ($guest_write_checked = null);
    $guest_permission_delete ? $guest_delete_checked = 'checked' : ($guest_delete_checked = null);
    $guest_permission_modify ? $guest_modify_checked = 'checked' : ($guest_modify_checked = null);
    ?>
              <tr>
                <td><?php 
    echo __('비회원', 'kingkongboard');
    ?>
</td>
                <td><input type="checkbox" name="permission_read[]" value="guest" <?php 
    echo $guest_read_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_write[]" value="guest" <?php 
    echo $guest_write_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_modify[]" value="guest" <?php 
    echo $guest_modify_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_delete[]" value="guest" <?php 
    echo $guest_delete_checked;
    ?>
></td>
              </tr>              
            </table>
          </div>
          <div class="tab-comment" style="display:none">
            <table>
              <tr>
                <th><?php 
    echo __('User Role', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('읽기', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('쓰기', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('수정', 'kingkongboard');
    ?>
</th>
                <th><?php 
    echo __('삭제', 'kingkongboard');
    ?>
</th>
              </tr>
<?php 
    foreach ($roles as $role_name => $role_info) {
        $permission_read = $controller->checkPermissionByRole($board_id, 'comment', 'read', $role_name);
        $permission_write = $controller->checkPermissionByRole($board_id, 'comment', 'write', $role_name);
        $permission_delete = $controller->checkPermissionByRole($board_id, 'comment', 'delete', $role_name);
        $permission_modify = $controller->checkPermissionByRole($board_id, 'comment', 'modify', $role_name);
        $permission_read ? $read_checked = 'checked' : ($read_checked = null);
        $permission_write ? $write_checked = 'checked' : ($write_checked = null);
        $permission_delete ? $delete_checked = 'checked' : ($delete_checked = null);
        $permission_modify ? $modify_checked = 'checked' : ($modify_checked = null);
        ?>
              <tr>
                <td><?php 
        echo $role_name;
        ?>
</td>
                <td><input type="checkbox" name="permission_comment_read[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $read_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_comment_write[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $write_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_comment_modify[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $modify_checked;
        ?>
></td>
                <td><input type="checkbox" name="permission_comment_delete[]" value="<?php 
        echo $role_name;
        ?>
" <?php 
        echo $delete_checked;
        ?>
></td>
              </tr>
<?php 
    }
    $guest_permission_read = $controller->checkPermissionByRole($board_id, 'comment', 'read', 'guest');
    $guest_permission_write = $controller->checkPermissionByRole($board_id, 'comment', 'write', 'guest');
    $guest_permission_delete = $controller->checkPermissionByRole($board_id, 'comment', 'delete', 'guest');
    $guest_permission_modify = $controller->checkPermissionByRole($board_id, 'comment', 'modify', 'guest');
    $guest_permission_read ? $guest_read_checked = 'checked' : ($guest_read_checked = null);
    $guest_permission_write ? $guest_write_checked = 'checked' : ($guest_write_checked = null);
    $guest_permission_delete ? $guest_delete_checked = 'checked' : ($guest_delete_checked = null);
    $guest_permission_modify ? $guest_modify_checked = 'checked' : ($guest_modify_checked = null);
    ?>
              <tr>
                <td><?php 
    echo __('비회원', 'kingkongboard');
    ?>
</td>
                <td><input type="checkbox" name="permission_comment_read[]" value="guest" <?php 
    echo $guest_read_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_comment_write[]" value="guest" <?php 
    echo $guest_write_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_comment_modify[]" value="guest" <?php 
    echo $guest_modify_checked;
    ?>
></td>
                <td><input type="checkbox" name="permission_comment_delete[]" value="guest" <?php 
    echo $guest_delete_checked;
    ?>
></td>
              </tr>  
            </table>
          </div>
        </td>
      </tr>
    </table>

<?php 
}
Exemplo n.º 11
0
}
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])) {
Exemplo n.º 12
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;
 }
Exemplo n.º 13
0
ob_end_clean();
ob_start();
require_once kkb_template_path('view.list.section.php');
$sectionContent = ob_get_contents();
$sectionContent = apply_filters('kkb_list_top_sections', $sectionContent, $board_id);
ob_end_clean();
ob_start();
require_once kkb_template_path('view.list.loop.php');
$loopContent = ob_get_contents();
$loopContent = apply_filters('kkb_list_loop', $loopContent, $board_id);
ob_end_clean();
ob_start();
require_once kkb_template_path('view.list.pagenation.php');
$pageContent = ob_get_contents();
$pageContent = apply_filters('kkb_list_pagenation', $pageContent, $board_id);
ob_end_clean();
$loopContent = apply_filters('kkb_loop_after', $loopContent, $board_id, $nResults, $bResults);
$controllerClass = apply_filters('kkb_loop_controller_extra_class', null, $board_id);
$controllerContent = '<div class="kingkongboard-controller ' . $controllerClass . '">';
$controller = new kkbController();
if ($controller->actionPermission($board_id, null, 'write') == true) {
    $write_args = apply_filters('kkb_read_arg_after', array('view' => 'write'), $board_id);
    $write_path = add_query_arg($write_args, get_the_permalink($post->ID));
    $controllerContent .= $searchContent;
    $controllerContent .= '<a href="' . $write_path . '" class="' . kkb_button_classer($board_id) . ' write-button"><span class="kkb-list-icon kkblc-write" style="margin-right:5px"></span><span style="vertical-align:middle">' . kkb_button_text($board_id, 'write') . '</span></a>';
}
$controllerContent .= '</div>';
$copyContent = '<div class="kingkongboard-copyrights"><a href="http://superrocket.io" target="_blank">Powered by Kingkong Board</a></div>';
$display = $sectionContent . $loopContent . $controllerContent . $pageContent . $copyContent;
$kkbContent = apply_filters('kkb_loop_display', $display, $searchContent, $loopContent, $pageContent, $controllerContent, $copyContent, $board_id);
echo $kkbContent;
<?php

$parent_id = '';
if (isset($_POST['entry_title'])) {
    $entry_title = sanitize_text_field($_POST['entry_title']);
} else {
    $entry_title = false;
}
if ($entry_title) {
    $Board = new kkbController();
    $board_id = $Board->getMeta($_GET['id'], 'board_id');
    $Board->writeEntry($board_id, $_POST, 'admin');
}
if (isset($_GET['parent'])) {
    $parent = sanitize_text_field($_GET['parent']);
} else {
    $parent = false;
}
if ($parent) {
    if ($parent != '') {
        $parent_id = $parent;
    }
} else {
    $parent_id = sanitize_text_field($_GET['id']);
}
$current_user = wp_get_current_user();
$hour_options = null;
$minute_options = null;
$second_options = null;
for ($i = 0; $i < 24; $i++) {
    if ($i == date('H', current_time('timestamp', 0))) {
Exemplo n.º 15
0
 public function comment_notification($entry_id, $comment_id, $content)
 {
     $controller = new kkbController();
     $board_id = $controller->getMeta($entry_id, 'board_id');
     $comment = get_comment($comment_id);
     $notice_comment = get_post_meta($board_id, 'kingkongboard_notice_comment', true);
     $emails = get_post_meta($board_id, 'kingkongboard_notice_emails', true);
     $board_title = get_the_title($board_id);
     $entry_title = get_the_title($entry_id);
     $entry_title = str_replace('Private:', '', $entry_title);
     $entry_title = str_replace('비공개: ', '', $entry_title);
     $headers[] = 'From: ' . __('관리자', 'kingkongboard') . ' <' . get_bloginfo('admin_email') . '>';
     $body = __('작성자', 'kingkongboard') . ': ' . $controller->getMeta($entry_id, 'writer') . "\r\n\r\n";
     $body .= __('댓글내용', 'kingkongboard') . ': ' . $content;
     $body .= "\r\n\r\n바로가기 : " . get_the_permalink($entry_id);
     if ($emails) {
         $emails = explode(",", $emails);
         if ($notice_comment == 'checked') {
             wp_mail($emails, '[' . get_bloginfo('name') . '] ' . sprintf(__('%s 글 신규댓글 알림 : %s', 'kingkongboard'), $entry_title, $comment->comment_content), $body, $headers);
         }
     }
 }
Exemplo n.º 16
0
 /**
  * 게시판 검색결과의 페이지 카운트를 불러온다.
  */
 public function searchCount($board_id, $data, $page)
 {
     $kkb = new kkbConfig();
     $config = $kkb->getBoard($board_id);
     $count = parent::getSearch($board_id, $data, $page, 'count');
     if ($count > 0) {
         $pages = $count / $config->rows;
         $pages = ceil($pages);
     } else {
         $pages = 0;
     }
     return $pages;
 }
Exemplo n.º 17
0
function admin_kingkong_board_manage_entry_column($entries, $entry_id)
{
    $return_content = '';
    $controller = new kkbController();
    foreach ($entries as $entry) {
        switch ($entry['value']) {
            case 'thumbnail':
                if (has_post_thumbnail($entry_id)) {
                    $thumbnail_id = get_post_thumbnail_id($entry_id);
                    $url = wp_get_attachment_image_src($thumbnail_id, 'thumbnail');
                    $image = '<img src="' . $url[0] . '" style="width:20px; height:auto">';
                } else {
                    $image = __('없음', 'kingkongboard');
                }
                $return_content .= '<td style="text-align:center">' . $image . '</td>';
                break;
            case "title":
                $entry_type = '';
                $entry_type = get_kingkong_board_meta_value($entry_id, 'type');
                $entry_attachment = get_post_meta($entry_id, 'kingkongboard_attached', true);
                $entry_secret = get_post_meta($entry_id, 'kingkongboard_secret', true);
                if ($entry_attachment) {
                    $entry_attach_text = "<i class='kkb-icon kkb-icon-attachment'></i>";
                } else {
                    $entry_attach_text = "";
                }
                if ($entry_secret) {
                    $entry_secret_icon = '<img src="' . KINGKONGBOARD_PLUGINS_URL . '/assets/images/icon-locked.png" style="width:12px; height:auto; position:relative; top:0px; margin-left:5px">';
                } else {
                    $entry_secret_icon = '';
                }
                $parent = get_kingkong_board_meta_value($entry_id, 'parent');
                $entry_depth = get_kingkong_board_meta_value($entry_id, 'depth');
                $writer = get_kingkong_board_meta_value($entry_id, 'writer');
                if ($entry_depth > 1) {
                    $padding = 10 * $entry_depth;
                    $reply_padding = 'style="padding-left:' . $padding . 'px;"';
                    $reply_icon = '<img src="' . KINGKONGBOARD_PLUGINS_URL . '/assets/images/icon-reply.gif" style="width:25px; height:auto; position:relative; top:3px; margin-right:5px">';
                    $parent_id = '&prnt=' . $parent;
                } else {
                    $reply_padding = '';
                    $reply_icon = '';
                    $parent_id = '';
                }
                $return_content .= "<td " . $reply_padding . ">" . $reply_icon . "<a href='?page=KingkongBoard&view=entry-view&id=" . $entry_id . $parent_id . "'>" . get_the_title($entry_id) . "</a>" . $entry_attach_text . $entry_secret_icon . "</td>";
                break;
            case "date":
                $return_content .= "<td>" . get_the_date('Y-m-d H:i:s', $entry_id) . "</td>";
                break;
            case "writer":
                $user_id = $controller->getMeta($entry_id, 'login_id');
                $post = get_post($entry_id);
                $writer = kingkongboard_text_cut($writer, 8, "...");
                $user_id > 1 ? $writer_path = '<a href="' . get_edit_user_link($user_id) . '">' . $writer . '</a>' : ($writer_path = $writer);
                $return_content .= "<td>" . $writer_path . "</td>";
                break;
            case "options":
                $guid = $controller->getMeta($entry_id, 'guid');
                $preview_path = add_query_arg(array('view' => 'read', 'id' => $entry_id), get_the_permalink($guid));
                $return_content .= "<td style='text-align:left'><a href='admin.php?page=KingkongBoard&view=entry-modify&id=" . $entry_id . "' class='button-kkb kkbgreen button-modify-each-entry' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-modify'></i></a> <a class='button-kkb kkbred button-remove-each-entry' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-trash'></i></a> <a href='" . $preview_path . "' target='_blank' class='button-kkb kkbyellow' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-preview'></i></a></td>";
                break;
        }
    }
    return $return_content;
}
Exemplo n.º 18
0
 public function boardList()
 {
     require_once KINGKONGBOARD_ABSPATH . '/class/class.controller.php';
     $controller = new kkbController();
     return $controller->getBoards();
 }