자폭기능 스킨

자폭기능 스킨

QA

자폭기능 스킨

본문

아래글은 NHEAD이 제작해주신 그누보드4용 자폭기능입니다...

나름데로 그누보드5에 적용해서 유용하게 써보려고 애는 썻습니다만.........

실력이 너무 미천해서 작업을 하다가 결국 포기를 하게 되었네요...

그래서 회원분들께 부탁을 드리려 합니다...

아래소스는 그누보드4에 적용된 자폭기능스킨입니다. 

이것을 그누보드5에 활용할 수 있도록 꼭 좀 도와주셨으면 합니다.

반드시 필요한 기능인데... 수정을 하려니 여러부분이 앞을 가로막네요... 

그누보드5에 적용해서 사용가능하도록 꼭 좀 도와주세요... 부탁드립니다...!!​

 

 <!--- 아래 부터 그누보드4용 자폭기능 스킨소스--->

스킨의 view.skin.php / list.skin.php / write.skin.php 를 수정합니다 예비필드 wr_10 을 사용합니다

view.skin.php 의 상단에 아래 소스를 추가합니다.
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 , 아래 정도

//자폭시작
if ($view[wr_10]) {
$g4[time_ymd] = date("Y-m-d H:i", $g4[server_time]); 
$stoday = $g4[time_ymd];

$bombdate = $view[wr_10];

if ($stoday > $bombdate) {
$sql = " select wr_id, mb_id, wr_is_comment from $write_table where wr_parent = '$view[wr_id]' order by wr_id ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result)) 
{
    // 원글이라면
    if (!$row[wr_is_comment]) 
    {
        // 원글 포인트 삭제
        if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '쓰기'))
            insert_point($row[mb_id], $board[bo_write_point] * (-1), "$board[bo_subject] $row[wr_id] 글삭제");
        // 업로드된 파일이 있다면 파일삭제
        $sql2 = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ";
        $result2 = sql_query($sql2);
        while ($row2 = sql_fetch_array($result2)){
            @unlink("$g4[path]/data/file/$bo_table/$row2[bf_file]");
   @unlink("$g4[path]/data/file/$bo_table/thumb/$write[wr_id]"); //썸네일 삭제 
   @unlink("$g4[path]/data/file/$bo_table/latest_thumb/$write[wr_id]"); //최근게시물 썸네일 삭제
  }

  //추천기록 삭제
  sql_query(" delete from g4_board_good where wr_id = '$row[wr_id]' AND bo_table = '$bo_table' "); //수정
            
        // 파일테이블 행 삭제
        sql_query(" delete from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ");
        $count_write++;
    } 
    else 
    {
        // 코멘트 포인트 삭제
        if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '코멘트'))
            insert_point($row[mb_id], $board[bo_comment_point] * (-1), "$board[bo_subject] {$view[wr_id]}-{$row[wr_id]} 코멘트삭제");
        $count_comment++;
    }
}
// 게시글 삭제
sql_query(" delete from $write_table where wr_parent = '$view[wr_id]' ");
// 최근게시물 삭제
sql_query(" delete from $g4[board_new_table] where bo_table = '$bo_table' and wr_parent = '$view[wr_id]' ");
// 스크랩 삭제
sql_query(" delete from $g4[scrap_table] where bo_table = '$bo_table' and wr_id = '$view[wr_id]' ");

// 공지사항 삭제
$notice_array = explode("\n", trim($board[bo_notice]));
$bo_notice = "";
for ($k=0; $k<count($notice_array); $k++)
    if ((int)$write[wr_id] != (int)$notice_array[$k])
        $bo_notice .= $notice_array[$k] . "\n";
$bo_notice = trim($bo_notice);
sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");

// 글숫자 감소
if ($count_write > 0 || $count_comment > 0)
    sql_query(" update $g4[board_table] set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
 
 if($view[mb_id] != $member[mb_id]){
  $Bpoint = rand(10,100);
  $smsg = "글을 폭파 시켰습니다. 폭탄제거 포인트 ".$Bpoint."점 획득.";
  insert_point($member['mb_id'], $Bpoint, "폭탄제거 포인트", "@bomb", $write['mb_id'], "자폭");
 } else {
  $smsg = "글을 폭파 시켰습니다.";
 }
 alert($smsg, "./board.php?bo_table=$bo_table");

 }
  $BombDay = "<a href=\"javascript:alert('자폭 설정이 되어 있습니다.\\n자폭일 : ".$view[wr_10]."')\"><font color=red class=small>(자폭 설정이 작동 중입니다. 지정일: $bombdate)</font></a><br>";
}
//자폭 끝

그리고 원하는 부분에 <?=$BombDay?> 를 추가합니다.
언제 폭파되는지 나타내는 부분입니다.


list.skin.php 의 상단에 아래 소스를 추가합니다

//자폭 시작
for ($i=0; $i<count($list); $i++) {

 $count_write = 0;
 $count_comment = 0;

 if($list[$i][wr_10]) { 
  $g4[time_ymd] = date("Y-m-d H:i", $g4[server_time]); 
  $stoday = $g4[time_ymd];

  $bombdate = $list[$i][wr_10];

  $By = substr($bombdate,0,4);
  $Bm = substr($bombdate,5,2);
  $Bd = substr($bombdate,8,2) + 7;
  $Bh = substr($bombdate,11,2);
  $Bi = substr($bombdate,14,2);

  $bombdate7 = date("Y-m-d H:i",mktime($Bh,$Bi,0,$Bm,$Bd,$By) );

  $bombc = $list[$i][wr_id];

  if ($stoday > $bombdate7) {
  $sql = " select wr_id, mb_id, wr_is_comment from $write_table where wr_parent = '$bombc' order by wr_id ";
  $result = sql_query($sql);
  while ($row = sql_fetch_array($result)) 
  {
   // 원글이라면
   if (!$row[wr_is_comment]) 
   {
    // 원글 포인트 삭제
    if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '쓰기'))
     insert_point($row[mb_id], $board[bo_write_point] * (-1), "$board[bo_subject] $row[wr_id] 글삭제");
    // 업로드된 파일이 있다면 파일삭제
    $sql2 = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ";
    $result2 = sql_query($sql2);
    while ($row2 = sql_fetch_array($result2)){
     @unlink("$g4[path]/data/file/$bo_table/$row2[bf_file]");
     @unlink("$g4[path]/data/file/$bo_table/thumb/$write[wr_id]"); //썸네일 삭제 
     @unlink("$g4[path]/data/file/$bo_table/latest_thumb/$write[wr_id]"); //최근게시물 썸네일 삭제
    }

    //추천기록 삭제
    sql_query(" delete from g4_board_good where wr_id = '$row[wr_id]' AND bo_table = '$bo_table' "); //수정
     
    // 파일테이블 행 삭제
    sql_query(" delete from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ");
    $count_write++;
   } 
   else 
   {
    // 코멘트 포인트 삭제
    if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '코멘트'))
     insert_point($row[mb_id], $board[bo_comment_point] * (-1), "$board[bo_subject] {$view[wr_id]}-{$row[wr_id]} 코멘트삭제");
    $count_comment++;
   }
  }
  // 게시글 삭제
  sql_query(" delete from $write_table where wr_parent = '$bombc' ");
  // 최근게시물 삭제
  sql_query(" delete from $g4[board_new_table] where bo_table = '$bo_table' and wr_parent = '$bombc' ");
  // 스크랩 삭제
  sql_query(" delete from $g4[scrap_table] where bo_table = '$bo_table' and wr_id = '$bombc' ");

  // 공지사항 삭제
  $notice_array = explode("\n", trim($board[bo_notice]));
  $bo_notice = "";
  for ($k=0; $k<count($notice_array); $k++)
   if ((int)$bombc != (int)$notice_array[$k])
    $bo_notice .= $notice_array[$k] . "\n";
  $bo_notice = trim($bo_notice);
  sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");

  // 글숫자 감소
  if ($count_write > 0 || $count_comment > 0)
   sql_query(" update $g4[board_table] set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");
  $bend = 1;
  }
 }
 if(count($list) == $i+1 && $bend == 1){
  goto_url("./board.php?bo_table=$bo_table&page=$page");}
}
//자폭 끝

그리고 echo $list[$i][subject]; 이부분 위에 아래 소스를 추가합니다. 제목을 나타내는 부분위에 넣으세요

  if($list[$i][wr_10]){
   echo "<img src='$board_skin_path/img/bomb.gif' align='absmiddle'>";
  }


마지막으로 wirte.skin.php 를 수정합니다.

아래 스크립트를 상단 부분 아무데나 넣습니다.
<!-- 자폭값 표시 -->
<script language="JavaScript" type="text/javascript"> 
function changeclass(thediv,msg) {
 thediv.className=(thediv.className=="redtext")?"bluetext":"redtext";
 if(msg !="")
  thediv.innerText=msg + "에 자동 폭파 실시";
 else
  thediv.innerText="자동 폭파 사용 안함";
}

function chk1(obj) {
 var switchB = document.getElementById('wr_10');
 if (obj.checked)
 {
  switchB.disabled = false; 
 } else {
  switchB.disabled = true;
  document.getElementById('wr_10').value = "";
  document.getElementById('mytext').innerText="자동 폭파 사용 안함";
 }
}
</script> 
<script>
function doIt(_f) {
    changeclass(document.getElementById('mytext'),_f);
}
</script>
<!-- 자폭값 표시 끝 -->

그리고 input 값 마구 마온곳에
<? if ($w =="u") { ?>
<input type=hidden name=wr_10   value="<?=$write[wr_10]?>">
<? } ?>
를 추가합니다.

자폭 설정을 나타낼 부분을 찾아서 아래 소스를 추가합니다
<!-- 자폭 부분 -->
<? if ($w =="") { ?>
 <tr>
    <td style='padding-left:20px; height:30px;'>· 자폭설정</td>
    <td><input type=checkbox name="bcheck" value="checkbox" onclick="chk1(this);" >
<?
 echo "<SELECT name=wr_10 style=\"FONT-SIZE: 9pt\" onchange=doIt(this.value) disabled >";
 echo "<OPTION value=\"\" selected>자폭안함</option>";
 echo "<option value=\"".date("Y-m-d H:i", time() + (int)(0.125*60*60*24))."\" >3시간 후</option>";
 echo "<option value=\"".date("Y-m-d H:i", time() + (int)(0.25*60*60*24))."\" >6시간 후</option>";
 echo "<option value=\"".date("Y-m-d H:i", time() + (int)(0.5 *60*60*24))."\">12시간 후</option>";
 for($i=1;$i<31; $i++) {
  echo "<option value=\"".date("Y-m-d H:i", time() + (int)($i*60*60*24))."\" >$i"."일 후</option>";
 }
 echo "</select>";
?>
 </select>
 <div id="mytext" class="redtext" style="display:inline" onclick="changeclass(this,'hi')">자동 폭파 사용 안함</div>

 </td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
 <? } ?>
<!-- 자폭 부분 -->


위 이미지 중 폭탄이미지를 다운받아서 스킨의 이미지 폴더에 넣습니다.

게시물을 폭파 시킨 사람에게는 10~100점 사이의 랜덤 포인트를 추가합니다.
이 것을 없에거나 수정하고 싶으신 분은 view.skin.php 수정 부분 중

  $Bpoint = rand(10,100);
  $smsg = "글을 폭파 시켰습니다. 폭탄제거 포인트 ".$Bpoint."점 획득.";
  insert_point($member['mb_id'], $Bpoint, "폭탄제거 포인트", "@bomb", $write['mb_id'], "자폭");
이부분을 수정하세요

이전에 올렸던거에서 자폭포인트 지급 부분이 잘 못됐었는데 수정했습니다.
자바스크립트 부분도 형식에 맞게 수정 하였습니다.

자폭지정일이 7일이 지난 게시물은 list.skin.php에서 자동 삭제 합니다.
(이전엔 자폭 게시물 잔상이 한번은 보였는데 이것도 수정하였습니다)

제가 빼먹은 부분이 있을 수 있으니 안되면 알려주세요

alik님과 헐랭이 님의 소스를 참고하였습니다. 폭탄 아이콘은 alik님 홈피에서 가져왔습니다.

버그 같은게 있으면 알려주세요 

이 질문에 댓글 쓰기 :

답변 1

소스 문법 자체가 문제가 있을거 같지는 않고,

$g4[time_ymd]

위와 같이 그누보드4 에서 사용하던 변수값이나 쿼리 선언문 부분만

5 버전에 맞게 전체이름 바꾸기 하는걸로 적용되지 않을까요??

 

답변을 작성하시기 전에 로그인 해주세요.
전체 125,873 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT