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; } }
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; }
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;