dbnt.co.kr2023/zadm/board/board.php

678 lines
24 KiB
PHP

<?
if (!$argu['p']) $argu['p'] = 1;
if(empty($argu['mode'])) $argu['mode'] = "LIST_FORM";
$default_querystring = "pagecode=".$argu["pagecode"]."&subpage=".$argu["subpage"]."&p=".$argu['p'];
if(isset($argu["b_class"]) && $argu['b_class']) $default_querystring .= "&b_class=".urlencode($argu['b_class']);
if(isset($argu["s_case"]) && $argu['s_case']) $default_querystring .= "&s_case=".urlencode($argu['s_case']);
if(isset($argu["s_string"]) && $argu['s_string']) $default_querystring .= "&s_string=".urlencode($argu['s_string']);
$_info = $Obj_board->get_boardconf_view($argu['b_class']);
switch ($argu['mode']) {
case "LIST_FORM":
$_list = $Obj_board->get_board_list($argu,$total);
break;
case "INSERT_FORM":
break;
case "INSERT_ACTION":
if($Obj_board->set_board_insert($argu)){
go_url("?mode=LIST_FORM&".$default_querystring,"등록 되었습니다");
exit;
}
break;
case "VIEW_FORM":
$_row = $data = $Obj_board->get_board_view($argu['b_class'],$argu['b_no']);
if($Obj_board->_b_role_cmt == "Y"){
$_cmt = $Obj_board->get_comment_list($argu['b_class'],$argu['b_no']);
}
case "MODIFY_FORM":
$_row = $data = $Obj_board->get_board_view($argu['b_class'],$argu['b_no']);
if($Obj_board->_b_role_fn > 0){
if($argu['mode'] == "MODIFY_FORM"){
$tem_arr = array_fill(0, $Obj_board->_b_role_fn, null);
$list = $Obj_board->get_boardfile_list($argu['b_class'],$argu['b_no']);
if(is_array($list)){
foreach($list as $key => $value){
$tem_arr[$value['bf_no']] = $value;
}
}
$_list = $tem_arr;
}else{
$_list = $Obj_board->get_boardfile_list($argu['b_class'],$argu['b_no']);
}
}
// $_prev_row = $Obj_board->get_board_prev($argu['b_class'],$argu['b_no']);
// $_next_row = $Obj_board->get_board_next($argu['b_class'],$argu['b_no']);
break;
case "MODIFY_ACTION":
if($Obj_board->set_board_modify($argu)){
go_url("?mode=VIEW_FORM&b_no={$argu['b_no']}&p={$argu['p']}&".$default_querystring,"수정 되었습니다");
exit;
}
break;
case "DELETE_ACTION":
if($Obj_board->set_board_delete($argu)){
go_url("?mode=LIST_FORM&".$default_querystring,"삭제 되었습니다");
exit;
}
break;
case "IMAGE_DELETE":
if($Obj_board->set_boardfile_delete($argu)){
go_url("?mode=MODIFY_FORM&b_no={$argu['b_no']}&".$default_querystring,"삭제 되었습니다");
exit;
}
break;
case "COMMENT_INSERT":
if($Obj_board->set_commemt_insert($argu)){
go_url($PHP_SELF."?mode=VIEW_FORM&b_no={$argu['b_no']}&".$default_querystring,"등록 되었습니다");
exit;
}
break;
case "COMMENT_DELETE":
//$comment_auth=$Obj_board->get_comment_auth($argu,"BD",$argu["bcm_no"]);
//if($comment_auth == "A"){
if($Obj_board->set_comment_delete($argu)){
go_url($PHP_SELF."?mode=VIEW_FORM&b_no={$argu['b_no']}&".$default_querystring,"삭제 되었습니다");
exit;
}
//}
//elseif($comment_auth=="F"){
// go_url("","입력하신 비밀번호가 일치하지 않습니다.");
//}
break;
case "LIST_DELETE_ACTION2":
$Obj_board->set_board_delete_list($argu);
go_url("?".$default_querystring."&mode=LIST_FORM&p={$argu['p']}","삭제 되었습니다.");
exit;
break;
case "RE_INSERT":
if($Obj_board->set_re_modify($argu)){
go_url("?mode=VIEW_FORM&b_no={$argu['b_no']}&p={$argu['p']}&".$default_querystring,"답변이 등록 되었습니다");
exit;
}
break;
exit;
}
?>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header"><?=$_info['bc_name']?></h1>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<?
/***********************************
===== 리스트 폼일경우 =====
***********************************/
if ($argu['mode'] == "LIST_FORM") {
?>
<form role="form" name="f" method="post" action="<?=$_SERVER["PHP_SELF"]?>">
<input type="hidden" name="mode" id="mode" value="LIST_FORM">
<input type="hidden" name="b_class" value="<?=$argu['b_class']?>">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<div class="row">
<?
if($_info["b_role_category"] == "Y"){
?>
<div class="col-sm-2">
<div class="form-group">
<select class="form-control" name="b_category" id="b_category" onchange="document.f.submit();">
<option value="">카테고리선택</option>
<?
$_b_category = explode("|",$_info["b_category"]);
foreach($_b_category as $key => $value){
$_selected = ($value == $argu["b_category"]) ? " selected" : "";
?>
<option value="<?=$value?>"<?=$_selected?>><?=$value?></option>
<?
}
?>
</select>
</div>
</div>
<?
}
?>
<div class="col-sm-2">
<div class="form-group">
<select class="form-control" name="s_case">
<option value="b_title"<?if( $argu['s_case'] == "b_title") echo" selected";?>>제목</option>
<option value="b_content"<?if( $argu['s_case'] == "b_content") echo" selected";?>>내용</option>
<option value="b_name"<?if( $argu['s_case'] == "b_name") echo" selected";?>>작성자</option>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group input-group">
<input type="text" class="form-control" name="s_string" value="<?=htmlspecialchars($argu['s_string'])?>">
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<colgroup>
<col width="80px" />
<col width="*" />
<col width="120px" />
<col width="120px" />
<col width="60px" />
</colgroup>
<thead>
<tr>
<th>번호</th>
<th>제목</th>
<th>작성자</th>
<th>작성일</th>
<th>조회</th>
</tr>
</thead>
<tbody>
<?
if(count($_list) > 0){ // 리스트가 있을경우
for($i=0;$i<count($_list);$i++){
$_list_subject=ksubstr(htmlspecialchars(strip_tags($_list[$i]['b_title'])),55);
if($_list[$i][b_depth] > 0){
$_list_subject="<img src=\"img/bt/re.jpg\" style=\"margin-left:".($_list[$i][b_depth]*10)."px;\"> Re : ".$_list_subject;
}
if($_list[$i]['new'] == "Y"){
$_list_subject.=" <span class=\"label label-default\" >New</span>";
}
$_list_link=$PHP_SELF."?mode=VIEW_FORM&b_no=".$_list[$i]['b_no']."&".$default_querystring;
$_notice = ($_list[$i]["b_notice"] == "1") ? "[공지]" : number_format($total - $Obj_board->_b_listnum * ($argu[p] - 1) - $i);
//$_use = ($_list[$i]["b_etc8"] == "Y") ? "공개" : "비공개";
$_category = ($_list[$i]["b_category"] != "") ? "[".$_list[$i]["b_category"]."]&nbsp;" : "";
?>
<tr>
<td><a href="<?=$_list_link?>" <?=$_target?>><?=$_notice?></a></td>
<td><?=$_category?><a href="<?=$_list_link?>" <?=$_target?>><?=$_s_lounge?><?=$_list_subject?></a></td>
<td><?=$_list[$i]['b_name']?></td>
<td><?=$_list[$i]['b_date']?></td>
<td><?=$_list[$i]['b_cnt']?></td>
</tr>
<?
}
}else{ // 리스트가 없을경우
?>
<tr>
<td colspan="5">등록된 내용이 없습니다</td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="row">
<div class="col-sm-6">
<button type="button" class="btn btn-outline btn-primary" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=INSERT_FORM');">등록</button>
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers">
<ul class="pagination">
<?=page_index_admin($total,$argu['p'],preg_replace(array("/^p=(\d+)/","/&p=(\d+)/","/&p=/i","/&amp;p=(\d+)/","/&amp;p=/i"),"",$_SERVER["QUERY_STRING"]),$Obj_board->_b_listnum,$scale=10,BOARD_FIRST_IMG,BOARD_LAST_IMG,BOARD_PREV_IMG,BOARD_NEXT_IMG);?>
</ul>
</div>
</div>
</div>
</form>
<?
}
/***********************************
===== 보기 폼일경우 =====
***********************************/
elseif ($argu['mode'] == "VIEW_FORM") {
?>
<form method="post" id="" name="fs">
<input type="hidden" name="mode" value="RE_INSERT">
<input type="hidden" name="b_class" value="<?=$argu["b_class"]?>">
<input type="hidden" name="b_no" value="<?=$argu["b_no"]?>">
<div class="table-responsive">
<table class="table table-bordered ">
<colgroup>
<col width="150px" />
<col width="*" />
<col width="150px" />
<col width="*" />
</colgroup>
<thead>
<tr>
<th colspan="8">
<h4><?=$_category?><?=$_notice?><?=$_s_lounge?><?=htmlspecialchars(strip_tags($_row['b_title']))?> <span class="badge"><?=number_format($_row['b_cnt'])?></span></h4>
</th>
</tr>
</thead>
<tbody>
<tr>
<th style="background-color: #f9f9f9;">작성자</th>
<td colspan="3"><?=htmlspecialchars($_row['b_name'])?></td>
<th style="background-color: #f9f9f9;">등록일</th>
<td colspan="3"><?=$_row['b_date']?></td>
</tr>
<?
if($argu["b_class"] == 1 || $argu["b_class"] == 2){
?>
<tr>
<th style="background-color: #f9f9f9;">인증번호</th>
<td colspan="7">
<?=$_row['b_etc1']?>
</td>
</tr>
<?
}
?>
<?
if($_info["b_role_thumb"] == "Y"){
?>
<tr>
<th style="background-color: #f9f9f9;">썸네일</th>
<td colspan="7">
<!-- <div class="row"> -->
<div class="col-md-4">
<div class="thumbnail">
<img src="/pds/<?=$Obj_board->_PDS_SUB.$_row[b_class]?>/thumb/<?=$_row['b_thumb']?>">
</div>
</div>
<!-- </div> -->
</td>
</tr>
<?
}
?>
<?
if($_info['b_role_md'] == "Y" && $_info['b_role_fn'] > 0){
?>
<tr>
<th style="background-color: #f9f9f9;">첨부파일</th>
<td colspan="7">
<?
if(count($_list)>0){
?>
<ul>
<?
for($i=0;$i< $_info[b_role_fn];$i++){
if($_list[$i][bf_no] !== null){
$ext = array_pop(explode(".",$_list[$i]['bf_name']));
$_fullpath = $Obj_board->_PDS_SUB.$_list[$i][b_class]."/".$_list[$i][b_no]."_".$_list[$i][bf_no].".".$ext;
?>
<li><a href="/common/download.php?fullpath=<?=$_fullpath."&filename=".urlencode($_list[$i]['bf_name'])?>"><?=$_list[$i][bf_name]?></a></li>
<?
}
}
?>
</ul>
<?
}
?>
</td>
</tr>
<?
}
?>
<tr>
<td colspan="8">
<?if($_row[b_tag] == "Y"){?>
<?=txtParse($_row[b_content],2)?>
<?}else{?>
<?=nl2br($_row[b_content])?>
<?}?>
</td>
</tr>
<?
if($_info["b_role_rp"] == "1"){
?>
<tr>
<th style="background-color: #f9f9f9;">답변</th>
<td colspan="7" style="padding:0 0 0 0;">
<textarea name="b_etc10" rows="10" cols="100" style="width:90%; height:212px;" class="{label:'답변',required:true}"><?=$_row["b_etc10"]?></textarea>
</td>
</tr>
<?
}
?>
</tbody>
</table>
<?
if($_info["b_role_rp"] == "1"){
?>
<button type="submit" class="btn btn-outline btn-default">답변등록</button>
<?
}
?>
<button type="button" class="btn btn-outline btn-success" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=MODIFY_FORM&p=<?=$argu['p']?>&b_no=<?=$_row['b_no']?>');">수정</button>
<button type="button" class="btn btn-outline btn-info" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=LIST_FORM&p=<?=$argu['p']?>');">목록</a></button>
<button type="button" class="btn btn-outline btn-danger" onclick="if(confirm('삭제 하시겠습니까?')){go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=DELETE_ACTION&p=<?=$argu['p']?>&b_no=<?=$_row['b_no']?>');}">삭제</button>
</div>
<?
if($_info[b_role_cmt]=="Y"){
?>
<div class="panel panel-default" style="margin-top:15px">
<h4>댓글</h4>
<div class="panel-body">
<div class="row">
<div class="col-sm-8">
<textarea class="form-control" rows="3" id="bcm_comment"></textarea>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-outline btn-info" onclick="comment_insert('<?=$argu["b_class"]?>','<?=$_row["b_no"]?>','COMMENT_INSERT');">댓글등록</button>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<colgroup>
<col width="10%" />
<col width="*" />
<col width="10%" />
<col width="10%" />
</colgroup>
<thead>
<tr>
<th>작성자</th>
<th>내용</th>
<th>작성일</th>
<th>삭제</th>
</tr>
</thead>
<tbody>
<?
if(count($_cmt) > 0){
for($c=0;$c<count($_cmt);$c++){
?>
<tr>
<td><?=$_cmt[$c]['bcm_name']?>(<?=$_cmt[$c]['user_id']?>)</td>
<td style="text-align:left"><?=nl2br($_cmt[$c]['bcm_comment'])?></td>
<td><?=$_cmt[$c]['bcm_date']?></td>
<td><a href="javascript:if(confirm('삭제 하시겠습니까?')){comment_delete('<?=$argu["b_class"]?>','<?=$_row["b_no"]?>','COMMENT_DELETE','<?=$_cmt[$c]['bcm_no']?>');}">삭제</a></td>
</tr>
<?
}
}else{ // 리스트가 없을경우
?>
<tr>
<td colspan="4">등록된 댓글이 없습니다.</td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<?
}
?>
</form>
<?
}
/***********************************
===== 쓰기 폼일경우 =====
***********************************/
elseif ($argu['mode'] == "INSERT_FORM") {
?>
<form name="f" method="post" enctype="multipart/form-data" style="margin:0;" >
<input type="hidden" name="mode" value="INSERT_ACTION">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<input type="hidden" name="b_class" value="<?=$_info['b_class']?>">
<input type="hidden" name="b_no" value="<?=$argu['b_no']?>">
<input type="hidden" name="b_tag" value="<?=$_info["b_role_editor"]?>">
<?
if($_info["b_role_category"] == "Y"){
?>
<div class="form-group">
<label for="b_title" >카테고리</label>
<select class="form-control {label:'카테고리',required:true}" name="b_category" id="b_category" >
<option value="">카테고리선택</option>
<?
$_b_category = explode("|",$_info["b_category"]);
foreach($_b_category as $key => $value){
?>
<option value="<?=$value?>"><?=$value?></option>
<?
}
?>
</select>
</div>
<?
}
?>
<?
if($_info["b_role_notice"] == "Y"){
?>
<div class="form-group">
<label>공지</label>
<label class="checkbox-inline">
<input type="checkbox" name="b_notice" value="1"<?if($_row["b_notice"] == "1") echo " checked";?>>사용여부
</label>
</div>
<?
}
?>
<div class="form-group">
<label for="b_title" >제목</label>
<input type="text" class="form-control {label:'제목',required:true}" id="b_title" name="b_title" placeholder="제목" value="<?=$_b_title?>">
</div>
<div class="form-group">
<label for="b_name" >작성자</label>
<input type="text" class="form-control {label:'작성자',required:true}" id="b_name" name="b_name" placeholder="작성자" value="<?=$user_info['user_name']?>">
</div>
<?
if($argu["b_class"] == 1 || $argu["b_class"] == 2){
?>
<div class="form-group">
<label for="b_etc1" >인증번호</label>
<input type="text" class="form-control" id="b_etc1" name="b_etc1" placeholder="인증번호">
</div>
<?
}
?>
<?
if($_info["b_role_thumb"] == "Y"){
?>
<div class="form-group">
<label>썸네일</label>
<input type="file" name="b_thumb" class="{label:'썸네일',required:true}">
</div>
<?
}
?>
<?
if($_info['b_role_md'] == "Y" && $_info['b_role_fn'] > 0){
for($i=0;$i<$_info[b_role_fn];$i++){
$_title = "첨부파일";
?>
<div class="form-group">
<label><?=$_title?></label>
<div style="margin-bottom:5px"><input type="file" name="bf_file[]"></div>
</div>
<?
}
}
?>
<?
if($_info["b_role_content"] == "Y"){
?>
<div class="form-group">
<label>내용</label>
<?if($_info["b_role_editor"] == "Y"){?>
<textarea class="summernote {label:'내용',required:true}" name="b_content"></textarea>
<?}else{?>
<textarea class="form-control {label:'내용',required:true}" name="b_content" rows="20"></textarea>
<?}?>
</div>
<?
}
?>
<button type="submit" class="btn btn-outline btn-success">확인</button>
<button type="button" class="btn btn-outline btn-info" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=LIST_FORM');">목록</a></button>
</form>
<?
}
/***********************************
===== 수정 폼일경우 =====
***********************************/
elseif ($argu['mode'] == "MODIFY_FORM") {
?>
<form name="f" method="post" enctype="multipart/form-data" style="margin:0;" >
<input type="hidden" name="mode" value="MODIFY_ACTION">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<input type="hidden" name="b_class" value="<?=$_info['b_class']?>">
<input type="hidden" name="b_no" value="<?=$argu['b_no']?>">
<input type="hidden" name="b_tag" value="<?=$_info["b_role_editor"]?>">
<input type="hidden" name="b_secert" value="<?=$_info["b_secert"]?>">
<?if($argu["b_class"] == 2){?>
<input type="hidden" name="b_etc1" value="<?=$_info["b_etc1"]?>">
<?}?>
<?
if($_info["b_role_category"] == "Y"){
?>
<div class="form-group">
<label for="b_title" >카테고리</label>
<select class="form-control {label:'카테고리',required:true}" name="b_category" id="b_category" >
<option value="">카테고리선택</option>
<?
$_b_category = explode("|",$_info["b_category"]);
foreach($_b_category as $key => $value){
$_selected = ($_row["b_category"] == $value) ? " selected" : "";
?>
<option value="<?=$value?>"<?=$_selected?>><?=$value?></option>
<?
}
?>
</select>
</div>
<?
}
?>
<?
if($_info["b_role_notice"] == "Y"){
?>
<div class="form-group">
<label>공지</label>
<label class="checkbox-inline">
<input type="checkbox" name="b_notice" value="1"<?if($_row["b_notice"] == "1") echo " checked";?>>사용여부
</label>
</div>
<?
}
?>
<div class="form-group">
<label for="b_title" >제목</label>
<input type="text" class="form-control {label:'제목',required:true}" id="b_title" name="b_title" placeholder="제목" value="<?=htmlspecialchars($_row['b_title'])?>">
</div>
<div class="form-group">
<label for="b_name" >작성자</label>
<input type="text" class="form-control {label:'작성자',required:true}" id="b_name" name="b_name" placeholder="작성자" value="<?=$_row['b_name']?>">
</div>
<?
if($argu["b_class"] == 1 || $argu["b_class"] == 2){
?>
<div class="form-group">
<label for="b_etc1" >인증번호</label>
<input type="text" class="form-control" id="b_etc1" name="b_etc1" placeholder="인증번호" value="<?=$_row['b_etc1']?>">
</div>
<?
}
?>
<?
if($_info["b_role_thumb"] == "Y"){
?>
<div class="form-group">
<label>썸네일</label>
<?if($_row["b_thumb"]){?>
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src="/pds/<?=$Obj_board->_PDS_SUB.$_row[b_class]?>/thumb/<?=$_row['b_thumb']?>">
</div>
</div>
</div>
<input type="file" name="b_thumb">
<input type="hidden" name="tmp_b_thumb" value="<?=$_row["b_thumb"]?>" />
<input type="hidden" name="tmp_b_thumb_list" value="<?=$_row["b_thumb_list"]?>" />
<?}else{?>
<input type="file" name="b_thumb" class="{label:'썸네일',required:true}">
<?}?>
</div>
<?
}
?>
<?
if($_info['b_role_md'] == "Y" && $_info['b_role_fn'] > 0){
for($i=0;$i<$_info[b_role_fn];$i++){
$_title = "첨부파일";
?>
<div class="form-group">
<label><?=$_title?></label>
<div style="margin-bottom:5px">
<input type="file" name="bf_file[<?=$i?>]">
<? if($_list[$i]['bf_no'] !== null){ ?>
<?=$_list[$i]['bf_name']?>
<label class="checkbox-inline"><input type="checkbox" name="del_file[]" value="<?=$i?>"> 삭제</label>
<? } ?>
</div>
</div>
<?
}
}
?>
<?
if($_info["b_role_content"] == "Y"){
?>
<div class="form-group">
<label>내용</label>
<?if($_info["b_role_editor"] == "Y"){?>
<textarea class="summernote {label:'내용',required:true}" name="b_content"><?=txtParse($_row["b_content"],2)?></textarea>
<?}else{?>
<textarea class="form-control {label:'내용',required:true}" name="b_content" rows="20"><?=$_row["b_content"]?></textarea>
<?}?>
</div>
<?
}
?>
<button type="submit" class="btn btn-outline btn-success">확인</button>
<button type="button" class="btn btn-outline btn-info" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=LIST_FORM');">목록</button>
</form>
<?
}
?>
</div>
<!-- /.panel-body -->
</div>
</div>
</div>